def refresh(_NEXUS): ''' should be able to add new scripts on the fly and then call this ''' unload() global grammar grammar = Grammar("si/kuli") def refresh_sick_command(): server_proxy.terminate() refresh(_NEXUS) mapping = { "launch sick IDE": Function(launch_IDE), "launch sick server": Function(launch_server), "refresh sick you Lee": Function(refresh_sick_command), "sick shot": Key("cs-2"), } rule = MergeRule(name="sik", mapping=mapping) gfilter.run_on(rule) grammar.add_rule(rule) grammar.load() # start server try: # if the server is already running, this should go off without a hitch start_server_proxy() except Exception: launch_server() seconds5 = 5 control.nexus().timer.add_callback(server_proxy_timer_fn, seconds5)
def server_proxy_timer_fn(): print("Attempting Caster-Sikuli connection [...]") try: start_server_proxy() control.nexus().timer.remove_callback(server_proxy_timer_fn) except Exception: pass
def fix_dragon_double(): try: lr = control.nexus().history[len(control.nexus().history) - 1] lu = " ".join(lr) Key("left/5:" + str(len(lu)) + ", del").execute() except Exception: utilities.simple_log(False)
def check_for_response(): global LAST_QUERY, TRIES if LAST_QUERY != None: data = None try: data = control.nexus().comm.get_com("hmc").get_message() except Exception: TRIES+=1 if TRIES>9: TRIES=0 control.nexus().timer.remove_callback(check_for_response) return if data == None: return try: LAST_QUERY.callback(data) except Exception: utilities.simple_log(False) LAST_QUERY = None if LAST_QUERY == None: control.nexus().timer.remove_callback(check_for_response)
def pita(textnv): global OLD_ACTIVE_WINDOW_TITLE, ACTIVE_FILE_PATH filename, folders, title = utilities.get_window_title_info() active_has_changed = OLD_ACTIVE_WINDOW_TITLE != title # check to see if the active file has changed; if not, skip this step if active_has_changed: OLD_ACTIVE_WINDOW_TITLE = title ACTIVE_FILE_PATH = scanner.guess_file_based_on_window_title(filename, folders) if filename == None: utilities.report("pita: filename pattern not found in window title") return if ACTIVE_FILE_PATH[0] != None: global CHOICES CHOICES = selector.get_similar_symbol_name(str(textnv), scanner.DATA["directories"][ACTIVE_FILE_PATH[0]][ACTIVE_FILE_PATH[1]]["names"]) try: if settings.SETTINGS["miscellaneous"]["status_window_enabled"]: display = "" counter = 1 for result in CHOICES: if counter>1: display+="\n" display+=str(counter)+" "+result[1] counter+=1 control.nexus().intermediary.hint(display) except Exception: utilities.simple_log()
def get_symbol(n, sticky): n = int(n) - 1 if n < 0 or n > len(control.nexus().sticky) - 1: return Text(control.nexus().sticky[n]).execute() if not utilities.window_exists(None, settings.S_LIST_VERSION): enable_sticky_list(sticky)
def check_for_response(): global LAST_QUERY, TRIES if LAST_QUERY != None: data = None try: data = control.nexus().comm.get_com("hmc").get_message() except Exception: utilities.simple_log() TRIES+=1 if TRIES>9: # try 10 times max if there's no Homonculus TRIES=0 control.nexus().timer.remove_callback(check_for_response) return if data == None: return try: LAST_QUERY.callback(data) except Exception: utilities.simple_log(False) LAST_QUERY = None if LAST_QUERY == None: control.nexus().timer.remove_callback(check_for_response)
def toggle_language(): global AUTO_ENABLED_LANGUAGE, LAST_EXTENSION filename, folders, title = utilities.get_window_title_info() extension = None if filename != None: extension = "." + filename.split(".")[-1] if LAST_EXTENSION != extension: message = None if extension != None and extension in settings.SETTINGS["ccr"][ "registered_extensions"]: chosen_extension = settings.SETTINGS["ccr"][ "registered_extensions"][extension] ccr.set_active_command(1, chosen_extension) AUTO_ENABLED_LANGUAGE = chosen_extension LAST_EXTENSION = extension message = "Enabled '" + chosen_extension + "'" elif AUTO_ENABLED_LANGUAGE != None: message = "Disabled '" + AUTO_ENABLED_LANGUAGE + "'" ccr.set_active_command(0, AUTO_ENABLED_LANGUAGE) AUTO_ENABLED_LANGUAGE = None if message != None: if settings.SETTINGS["miscellaneous"]["status_window_enabled"]: control.nexus().comm.get_com("status").text(message) LAST_EXTENSION = extension
def repeat_that(n): try: if len(control.nexus().history) > 0: for i in range(int(n)): Playback([([str(x) for x in " ".join(control.nexus().history[len(control.nexus().history) - 1]).split()], 0.0)])._execute() except Exception: utilities.simple_log(False)
def update(name, value): # settings try: control.nexus().node_rule_active(name, value) ccr.set_active() ccr.refresh() except Exception: utilities.simple_log()
def toggle_status(): enabled = settings.SETTINGS["miscellaneous"]["status_window_enabled"] if enabled: control.nexus().intermediary.kill() else: launch_status() settings.SETTINGS["miscellaneous"]["status_window_enabled"] = not enabled settings.save_config()
def remove_word(n, sticky): n = int(n) del control.nexus().sticky[n - 1] utilities.save_json_file(control.nexus().sticky, settings.SETTINGS["paths"]["S_LIST_JSON_PATH"]) if utilities.window_exists(None, settings.S_LIST_VERSION): control.nexus().comm.get_com("sticky_list").remove_symbol(n) else: enable_sticky_list(sticky)
def toggle_status(): enabled = settings.SETTINGS["miscellaneous"]["status_window_enabled"] if enabled: control.nexus().intermediary.kill() else: launch_status() settings.SETTINGS["miscellaneous"]["status_window_enabled"] = not enabled settings.save_config()
def load_recorded_rules(): recorded_macros = utilities.load_json_file(settings.SETTINGS["paths"]["RECORDED_MACROS_PATH"]) for spec in recorded_macros: commands = recorded_macros[spec]# this is a list of lists rule = RecordedRule(commands=commands, spec=spec, name="recorded_rule_" + spec, extras=[IntegerRef("n", 1, 50)], defaults={"n":1}) control.nexus().macros_grammar.add_rule(rule) if len(control.nexus().macros_grammar.rules) > 0: control.nexus().macros_grammar.load()
def update(name, value): # settings try: control.nexus().node_rule_active(name, value) ccr.set_active() ccr.refresh() except Exception: utilities.simple_log()
def _execute(self, data=None): choices = self.choice_generator(data) display_string = "" for i in range(0, 10): display_string += str(i+1)+" - "+choices[i] if i+1<10: display_string += "\n" control.nexus().intermediary.hint(display_string) self.mutable_list["value"] = choices self.state.add(self.state.generate_context_seeker_stack_item(self, data))
def _execute(self, data=None): choices = self.choice_generator(data) display_string = "" for i in range(0, 10): display_string += str(i + 1) + " - " + choices[i] if i + 1 < 10: display_string += "\n" control.nexus().intermediary.hint(display_string) self.mutable_list["value"] = choices self.state.add( self.state.generate_context_seeker_stack_item(self, data))
def make_selection(nw): global CHOICES, TEN n = -1 while len(nw)>2:# in the event the last words spoken were a command chain, nw.pop() # get only the number trigger j = " ".join(nw) if j in TEN: n = TEN.index(j) if n == -1: n = 0 Text(CHOICES[n][1]).execute() control.nexus().intermediary.text("PITA Completion")
def record_from_history(): # save the list as it was when the command was spoken control.nexus().preserved = control.nexus().history[:] # format for display formatted = "" for t in control.nexus().preserved: for w in t: formatted += w.split("\\")[0] + "[w]" formatted += "[s]" h_launch.launch(settings.QTYPE_RECORDING, add_recorded_macro, formatted)
def record_from_history(): # save the list as it was when the command was spoken control.nexus().preserved = control.nexus().history[:] # format for display formatted = "" for t in control.nexus().preserved: for w in t: formatted += w.split("\\")[0] + "[w]" formatted += "[s]" h_launch.launch(settings.QTYPE_RECORDING, add_recorded_macro, formatted)
def repeat_that(n): try: if len(control.nexus().history) > 0: p = [ str(x) for x in " ".join(control.nexus().history[ len(control.nexus().history) - 1]).split() ] # print p for i in range(int(n)): Playback([(p, 0.0)]).execute() except Exception: utilities.simple_log(False)
def load_recorded_rules(): recorded_macros = utilities.load_json_file( settings.SETTINGS["paths"]["RECORDED_MACROS_PATH"]) for spec in recorded_macros: commands = recorded_macros[spec] # this is a list of lists rule = RecordedRule(commands=commands, spec=spec, name="recorded_rule_" + spec, extras=[IntegerRef("n", 1, 50)], defaults={"n": 1}) control.nexus().macros_grammar.add_rule(rule) if len(control.nexus().macros_grammar.rules) > 0: control.nexus().macros_grammar.load()
def add_recorded_macro(data): # use a response window to get a spec for the new macro: handled by calling function commands = [] for i in data["selected_indices"]: commands.append(control.nexus().preserved[i]) spec = data["word"] # clean the results for l in commands: for w in l: if "\\" in w: w = w.split("\\")[0] recorded_macros = None if spec != "" and len(commands) > 0: extras = None defaults = None if data["repeatable"]: spec += " [times <n>]" extras = [IntegerRef("n", 1, 50)] defaults = {"n":1} recorded_macros = utilities.load_json_file(settings.SETTINGS["paths"]["RECORDED_MACROS_PATH"]) recorded_macros[spec] = commands utilities.save_json_file(recorded_macros, settings.SETTINGS["paths"]["RECORDED_MACROS_PATH"]) # immediately make a new compound rule and add to a set grammar control.nexus().macros_grammar.unload() rule = RecordedRule(commands=commands, spec=spec, name="recorded_rule_" + spec, extras=extras, defaults=defaults) control.nexus().macros_grammar.add_rule(rule) control.nexus().macros_grammar.load() # clear the dictation cache control.nexus().preserved = None
def analyze_for_configure(self): '''solves the problem of the editor not being smart about toggles by using text to see which toggles are active''' '''regex toggle check''' Key("escape").execute() # get out of Find result = CONTEXT.read_nmax_tries(10) if result == self.analysis_chars: self.regex = False Key("backspace").execute() elif result == self.analysis_chars[1]: self.regex = True Key("delete, backspace").execute() else: control.nexus().intermediary.text( "Eclipse configuration failed (" + result + ")")
def _merge_node_compatibility(): global current_combined_rule_ccr if current_combined_rule_ccr==None: return for node_rule in control.nexus().noderules: if node_rule.master_node.active: _merge_node_compatible_check(node_rule)
def __init__(self, base, rspec="default", rdescript=None, rundo=None): ActionBase.__init__(self) self.state = control.nexus().state self.base = base self.rspec = rspec self.rdescript = rdescript self.rundo = rundo
def create_repeat_rule(language_rule): alts = [RuleRef(rule=language_rule)] for noderule in control.nexus().noderules: if noderule.master_node.active: alts.append(RuleRef(rule=noderule)) single_action = Alternative(alts) sequence_name = "sequence_" + "language" sequence = Repetition(single_action, min=1, max=16, name=sequence_name) #--------------------------------------------------------------------------- # Here we define the top-level rule which the user can say. class RepeatRule(CompoundRule): # Here we define this rule's spoken-form and special elements. spec = "<" + sequence_name + ">" extras = [sequence] # Sequence of actions defined above. def _process_recognition(self, node, extras): sequence = extras[sequence_name] # A sequence of actions. for action in sequence: action.execute() #--------------------------------------------------------------------------- return RepeatRule()
def _merge_node_compatibility(): global current_combined_rule_ccr if current_combined_rule_ccr == None: return for node_rule in control.nexus().noderules: if node_rule.master_node.active: _merge_node_compatible_check(node_rule)
def mouse_alternates(mode): if control.nexus().dep.PIL: try: if mode == "legion": if utilities.window_exists(None, "legiongrid"): pass else: ls = LegionScanner() ls.scan() #[500, 500, 1000, 1000] tscan = ls.get_update() Popen([ "pythonw", settings.SETTINGS["paths"]["LEGION_PATH"], "-t", tscan[0] ]) #, "-d", "500_500_500_500" elif mode == "rainbow": Popen([ "pythonw", settings.SETTINGS["paths"]["RAINBOW_PATH"], "-m", "r" ]) elif mode == "douglas": Popen([ "pythonw", settings.SETTINGS["paths"]["DOUGLAS_PATH"], "-m", "d" ]) except Exception: utilities.simple_log(True) else: utilities.availability_message(mode.title(), "PIL")
def toggle(): if control.nexus().dep.NATLINK and natlink.getMicState()!="on": return '''determines whether to toggle and then if so toggles appropriately''' global _LAST, _HAS_RUN_FIRST_TIME, _ON, _OFF should_toggle = False if not _HAS_RUN_FIRST_TIME: should_toggle = True _HAS_RUN_FIRST_TIME = True if not settings.SETTINGS["auto_com"]["change_language_only"]: current_window = utilities.get_active_window_path().split("\\")[-1] should_be_on = current_window in settings.SETTINGS["auto_com"]["executables"] should_toggle = should_be_on != _LAST _LAST = should_be_on if should_toggle: e = _ON if _LAST else _OFF e.execute() # language switching section if settings.SETTINGS["auto_com"]["change_language"]: language.toggle_language()
def create_repeat_rule(language_rule): alts = [RuleRef(rule=language_rule)] for noderule in control.nexus().noderules: if noderule.master_node.active: alts.append(RuleRef(rule=noderule)) single_action = Alternative(alts) sequence_name = "sequence_" + "language" sequence = Repetition(single_action, min=1, max=16, name=sequence_name) #--------------------------------------------------------------------------- # Here we define the top-level rule which the user can say. class RepeatRule(CompoundRule): # Here we define this rule's spoken-form and special elements. spec = "<" + sequence_name + ">" extras = [ sequence ] # Sequence of actions defined above. def _process_recognition(self, node, extras): sequence = extras[sequence_name] # A sequence of actions. for action in sequence: action.execute() #--------------------------------------------------------------------------- return RepeatRule()
def start_server_proxy(): global server_proxy server_proxy = control.nexus().comm.get_com("sikuli") fns = server_proxy.list_functions() if len(fns) > 0: generate_commands(fns) print("Caster-Sikuli server started successfully.")
def send_input(n, action): s = control.nexus().comm.get_com("grids") int_a = int(action) response = None if int_a != 2: s.go(str(n)) elif int_a == 2: response = s.retrieve_data_for_highlight(str(int(n))) s.kill() grids.wait_for_death(settings.LEGION_TITLE) if int_a == 0: Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: Playback([(["mouse", "right", "click"], 0.0)]).execute() elif int_a == 2: x1 = response["l"] + 2 x2 = response["r"] y = response["y"] win32api.SetCursorPos((x1, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x1, y, 0, 0) time.sleep(0.5) win32api.SetCursorPos((x2, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x2, y, 0, 0)
def send_input(n, action): s = control.nexus().comm.get_com("grids") int_a = int(action) response = None if int_a != 2: s.go(str(n)) elif int_a == 2: response = s.retrieve_data_for_highlight(str(int(n))) s.kill() grids.wait_for_death(settings.LEGION_TITLE) if int_a == 0: Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: Playback([(["mouse", "right", "click"], 0.0)]).execute() elif int_a == 2: x1 = response["l"]+2 x2 = response["r"] y = response["y"] win32api.SetCursorPos((x1, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x1, y, 0, 0) time.sleep(0.5) win32api.SetCursorPos((x2, y)) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x2, y, 0, 0)
def __init__(self, executable=None, title=None, time_in_seconds=1, repetitions=15, rdescript="unnamed command (SFW)", blocking=False): assert executable != None or title != None, "SuperFocusWindow needs executable or title" def attempt_focus(): for win in Window.get_all_windows(): w = win found_match = True if title != None: found_match = title in w.title if found_match and executable != None: found_match = executable in w.executable if found_match: try: # this is still broken win32gui.SetWindowPos( w.handle, win32con.HWND_NOTOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE + win32con.SWP_NOSIZE) win32gui.SetWindowPos( w.handle, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE + win32con.SWP_NOSIZE) win32gui.SetWindowPos( w.handle, win32con.HWND_NOTOPMOST, 0, 0, 0, 0, win32con.SWP_SHOWWINDOW + win32con.SWP_NOMOVE + win32con.SWP_NOSIZE) Key("alt").execute() time.sleep(0.5) win32gui.SetForegroundWindow(w.handle) w.set_foreground() except Exception: utilities.report("Unable to set focus:\ntitle: " + w.title + "\nexe: " + w.executable) break # do not assume that it worked success = SuperFocusWindow.focus_was_success(title, executable) if not success: if title != None: print "title failure: ", title, w.title if executable != None: print "executable failure: ", executable, w.executable, executable in w.executable return success forward = [L(S(["cancel"], attempt_focus))] AsynchronousAction.__init__( self, forward, time_in_seconds=time_in_seconds, repetitions=repetitions, rdescript=rdescript, blocking=blocking, finisher=Function(control.nexus().intermediary.text, message="SuperFocus Complete") + Key("escape")) self.show = False
def clipboard_to_file(nnavi500, do_copy=False): if do_copy: Key("c-c").execute() key = str(nnavi500) while True: failure = False try: time.sleep(0.05) # time for keypress to execute win32clipboard.OpenClipboard() control.nexus().clip[key] = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() utilities.save_json_file(control.nexus().clip, settings.SETTINGS["paths"]["SAVED_CLIPBOARD_PATH"]) except Exception: failure = True if not failure: break
def _execute(self, data=None): output = control.nexus().temp Text(output).execute() if output: Key(self.action_if_text).execute() else: Key(self.action_if_no_text).execute() return True
def __init__(self, back=None, forward=None, rspec="default", rdescript="unnamed command (CS)"): RegisteredAction.__init__(self, None) self.back = back self.forward = forward self.rspec = rspec self.rdescript = rdescript self.state = control.nexus().state assert self.back != None or self.forward != None, "Cannot create ContextSeeker with no levels"
def __init__(self, base, rspec="default", rdescript="unnamed command (RA)", rundo=None, show=True): ActionBase.__init__(self) self.state = control.nexus().state self.base = base self.rspec = rspec self.rdescript = rdescript self.rundo = rundo self.show = show
def __init__(self, back=None, forward=None, rspec="default", rdescript="unnamed command (CS)"): RegisteredAction.__init__(self, None) self.back = back self.forward = forward self.rspec = rspec self.rdescript = rdescript self.state = control.nexus().state assert self.back != None or self.forward != None, "Cannot create ContextSeeker with no levels"
def _passes_tests(symbol, scanned_file, language_filter): # short words can be gotten faster by just spelling them too_short = len(symbol) < 4 already_in_names = symbol in scanned_file["names"] is_digit = symbol.isdigit() is_keyword = symbol in language_filter.keywords typeable = (settings.SETTINGS["pita"]["filter_strict"] and control.nexus().dep.NATLINK and not _difficult_to_type(symbol)) return not (is_keyword or already_in_names or too_short or is_digit or typeable)
def __init__(self, forward, time_in_seconds=1, repetitions=0, rdescript="unnamed command (A)"): ContextSeeker.__init__(self, None, forward) # self.forward = forward self.repetitions = repetitions self.time_in_seconds = time_in_seconds self.rdescript = rdescript self.state = control.nexus().state assert self.forward != None, "Cannot create Continuer with no termination commands" assert len(self.forward) == 1, "Cannot create Continuer with > or < one purpose"
def drop(nnavi500): key = str(nnavi500) while True: failure = False try: if key in control.nexus().clip: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(control.nexus().clip[key]) win32clipboard.CloseClipboard() Key("c-v").execute() else: dragonfly.get_engine().speak("slot empty") time.sleep(0.05) except Exception: failure = True if not failure: break
def __init__(self, base, rspec="default", rdescript="unnamed command (RA)", rundo=None, show=True): ActionBase.__init__(self) self.state = control.nexus().state self.base = base self.rspec = rspec self.rdescript = rdescript self.rundo = rundo self.show = show
def drop(nnavi500): key = str(nnavi500) while True: failure = False try: if key in control.nexus().clip: win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(control.nexus().clip[key]) win32clipboard.CloseClipboard() Key("c-v").execute() else: dragonfly.get_engine().speak("slot empty") time.sleep(0.05) except Exception: failure = True if not failure: break
def _execute(self, data=None): if control.nexus().dep.NATLINK: executable = utilities.get_active_window_path(natlink).split("\\")[-1] is_executable = executable in self.executables if (is_executable and not self.negate) or (self.negate and not is_executable): self.action._execute() else: utilities.availability_message("SelectiveAction", "natlink") self.action._execute()
def clipboard_to_file(nnavi500, do_copy=False): if do_copy: Key("c-c").execute() key = str(nnavi500) while True: failure = False try: time.sleep(0.05) # time for keypress to execute win32clipboard.OpenClipboard() control.nexus().clip[key] = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() utilities.save_json_file( control.nexus().clip, settings.SETTINGS["paths"]["SAVED_CLIPBOARD_PATH"]) except Exception: failure = True if not failure: break
def begin(self): '''here pass along a closure to the timer multiplexer''' eCL = self.executeCL cl = self.forward[0] r = self.repetitions c = {"value":0} # count e = self.execute def closure(): terminate = eCL(cl) if terminate: e(terminate) elif r != 0: # if not run forever c["value"] += 1 if c["value"] == r: e(False) self.closure = closure control.nexus().timer.add_callback(self.closure, self.time_in_seconds) self.closure()
def curse(direction, direction2, nnavi500, dokick): x, y = 0, 0 d = str(direction) d2 = str(direction2) if d == "up" or d2 == "up": y = -nnavi500 if d == "down" or d2 == "down": y = nnavi500 if d == "left" or d2 == "left": x = -nnavi500 if d == "right" or d2 == "right": x = nnavi500 Mouse("<" + str(x) + ", " + str(y) + ">").execute() if int(dokick) != 0: if int(dokick) == 1: left_click(control.nexus()) elif int(dokick) == 2: right_click(control.nexus())
def curse(direction, direction2, nnavi500, dokick): x, y = 0, 0 d = str(direction) d2 = str(direction2) if d == "up" or d2 == "up": y = -nnavi500 if d == "down" or d2 == "down": y = nnavi500 if d == "left" or d2 == "left": x = -nnavi500 if d == "right" or d2 == "right": x = nnavi500 Mouse("<" + str(x) + ", " + str(y) + ">").execute() if int(dokick) != 0: if int(dokick) == 1: left_click(control.nexus()) elif int(dokick) == 2: right_click(control.nexus())
def send_input(n, n2, action): s = control.nexus().comm.get_com("grids") s.move_mouse(int(n), int(n2)) s.kill() grids.wait_for_death(settings.DOUGLAS_TITLE) int_a = int(action) if int_a == 0: Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: Playback([(["mouse", "right", "click"], 0.0)]).execute()
def add_alias(text): text = str(text) if text == "": return alias_key = "alias_key" navigation.clipboard_to_file(alias_key, True) time.sleep(0.1) symbol = control.nexus().clip[alias_key] rewrite_alias_module(None, (str(text), symbol)) ccr.refresh_from_files("aliases")
def add_alias(text): text = str(text) if text == "": return alias_key = "alias_key" navigation.clipboard_to_file(alias_key, True) time.sleep(0.1) symbol = control.nexus().clip[alias_key] rewrite_alias_module(None, (str(text), symbol)) ccr.refresh_from_files("aliases")
def _passes_tests(symbol, scanned_file, language_filter): # short words can be gotten faster by just spelling them too_short = len(symbol) < 4 already_in_names = symbol in scanned_file["names"] is_digit = symbol.isdigit() is_keyword = symbol in language_filter.keywords typeable = (settings.SETTINGS["pita"]["filter_strict"] and control.nexus().dep.NATLINK and not _difficult_to_type(symbol)) return not (is_keyword or already_in_names or too_short or is_digit or typeable)
def __init__(self, forward, time_in_seconds=1, repetitions=0, rdescript="unnamed command (A)", blocking=True, finisher=None): ContextSeeker.__init__(self, None, forward) # self.forward = forward self.repetitions = repetitions self.time_in_seconds = time_in_seconds self.rdescript = rdescript self.blocking = blocking self.state = control.nexus().state self.base = finisher assert self.forward != None, "Cannot create AsynchronousAction with no termination commands" assert len(self.forward) == 1, "Cannot create AsynchronousAction with > or < one purpose"