def getMacroKeys(macrodict, state): macrokeys = list(macrodict.keys()) linenum = Macro(None, "") linenum.name = "__LINE__" linenum.payload = str(state.row) linenum.nameregex = lineNameRegex filename = Macro(None, "") filename.name = "__FILE__" filename.payload = str('"' + state.filename + '"') filename.nameregex = fileNameRegex # temporary concatenation macro, must run LAST concat = Macro(None, "") concat.name = " ## " concat.payload = "" concat.nameregex = concatNameRegex macrodict[linenum.name] = linenum macrodict[filename.name] = filename macrodict[concat.name] = concat macrokeys = list(macrodict.keys()) macrokeys.append(linenum.name) macrokeys.append(filename.name) macrokeys.append(concat.name) return macrokeys
def getMacroKeys(macrodict, state): macrokeys = list(macrodict.keys()) linenum = Macro(None, "") linenum.name = "__LINE__" linenum.payload = str(state.row) linenum.nameregex = lineNameRegex filename= Macro(None, "") filename.name = "__FILE__" filename.payload = str('"' + state.filename + '"') filename.nameregex = fileNameRegex # temporary concatenation macro, must run LAST concat = Macro(None, "") concat.name = " ## " concat.payload = "" concat.nameregex = concatNameRegex macrodict[linenum.name] = linenum macrodict[filename.name] = filename macrodict[concat.name] = concat macrokeys = list(macrodict.keys()) macrokeys.append(linenum.name) macrokeys.append(filename.name) macrokeys.append(concat.name) return macrokeys
def GetDefaultCommandAsMacro(cmd, charIndex, page, slot): from macro import Macro, MacroLine # Initialize the default macro to None, # in case we don't find the desired command. defaultMacro = None # Try to get the default command from the local dictionary. defaultCommand = DEFAULTCOMMANDS.get(cmd) # If it's not one of the default commands here, # check if it's a skill in the skillInfo dictionary # and create a macro from that. if not defaultCommand: skillInfo = GetSkillInfo(cmd, False) if skillInfo: defaultMacro = Macro(charIndex, page, slot) defaultMacro.name = cmd defaultMacro.icon = skillInfo.icon if not defaultMacro.icon.startswith("SPELLICON_"): defaultMacro.icon = "icons/%s" % defaultMacro.icon defaultMacro.description = skillInfo.name defaultMacro.appendMacroLine(MacroLine(command="/skill %s" % cmd)) else: defaultMacro = Macro(charIndex, page, slot) defaultMacro.name = defaultCommand.name defaultMacro.icon = defaultCommand.icon if not defaultMacro.icon.startswith("SPELLICON_"): defaultMacro.icon = "icons/%s" % defaultMacro.icon defaultMacro.description = defaultCommand.tooltip defaultMacro.appendMacroLine(MacroLine(command=defaultCommand.command)) # Return the default macro. return defaultMacro
def GetDefaultCommandAsMacro(cmd, charIndex, page, slot): from macro import Macro, MacroLine # Initialize the default macro to None, # in case we don't find the desired command. defaultMacro = None # Try to get the default command from the local dictionary. defaultCommand = DEFAULTCOMMANDS.get(cmd) # If it's not one of the default commands here, # check if it's a skill in the skillInfo dictionary # and create a macro from that. if not defaultCommand: skillInfo = GetSkillInfo(cmd, False) if skillInfo: defaultMacro = Macro(charIndex, page, slot) defaultMacro.name = cmd defaultMacro.icon = skillInfo.icon if not defaultMacro.icon.startswith('SPELLICON_'): defaultMacro.icon = 'icons/%s' % defaultMacro.icon defaultMacro.description = skillInfo.name defaultMacro.appendMacroLine(MacroLine(command='/skill %s' % cmd)) else: defaultMacro = Macro(charIndex, page, slot) defaultMacro.name = defaultCommand.name defaultMacro.icon = defaultCommand.icon if not defaultMacro.icon.startswith('SPELLICON_'): defaultMacro.icon = 'icons/%s' % defaultMacro.icon defaultMacro.description = defaultCommand.tooltip defaultMacro.appendMacroLine(MacroLine(command=defaultCommand.command)) # Return the default macro. return defaultMacro
def createMacro(self): newMacro = Macro(self.charIndex, self.page, self.slot) newMacro.name = self.guiName.getValue() newMacro.description = self.guiToolTip.getValue() hotkey = self.guiHotkey.getValue() if hotkey == 'None': newMacro.hotkey = '' else: newMacro.hotkey = hotkey newMacro.icon = self.icon newMacro.waitAll = int(self.guiWaitAll.getValue()) == 1 try: manualDelay = int(self.guiManualDelay.getValue) if manualDelay < 0: manualDelay = 0 except: manualDelay = 0 newMacro.manualDelay = manualDelay for lineIndex in xrange(10): lineCommand = self.guiLines[lineIndex].getValue().lstrip().rstrip() mandatory = int(self.guiMandatory[lineIndex].getValue()) == 1 try: lineDelay = int(self.guiDelays[lineIndex].getValue()) if lineDelay < 0: lineDelay = 0 except: lineDelay = 0 if not lineCommand and not lineDelay: continue newMacroLine = MacroLine(lineCommand, mandatory, lineDelay) newMacro.insertMacroLine(lineIndex, newMacroLine) if newMacro.macroLineNum == 0: del newMacro return None return newMacro
def createMacro(self): newMacro = Macro(self.charIndex,self.page,self.slot) newMacro.name = self.guiName.getValue() newMacro.description = self.guiToolTip.getValue() hotkey = self.guiHotkey.getValue() if hotkey == 'None': newMacro.hotkey = '' else: newMacro.hotkey = hotkey newMacro.icon = self.icon newMacro.waitAll = int(self.guiWaitAll.getValue()) == 1 try: manualDelay = int(self.guiManualDelay.getValue) if manualDelay < 0: manualDelay = 0 except: manualDelay = 0 newMacro.manualDelay = manualDelay for lineIndex in xrange(10): lineCommand = self.guiLines[lineIndex].getValue().lstrip().rstrip() mandatory = int(self.guiMandatory[lineIndex].getValue()) == 1 try: lineDelay = int(self.guiDelays[lineIndex].getValue()) if lineDelay < 0: lineDelay = 0 except: lineDelay = 0 if not lineCommand and not lineDelay: continue newMacroLine = MacroLine(lineCommand,mandatory,lineDelay) newMacro.insertMacroLine(lineIndex,newMacroLine) if newMacro.macroLineNum == 0: del newMacro return None return newMacro