From df393ad41fb6a85fd42a74290482e3608a2df695 Mon Sep 17 00:00:00 2001 From: Dave Date: Thu, 2 Jul 2015 20:22:06 -0400 Subject: [PATCH] fixes #67 --- _caster.py | 6 +++--- caster/apps/grid/douglasgrid.py | 4 ++-- caster/apps/grid/legiongrid.py | 4 ++-- caster/apps/grid/rainbowgrid.py | 4 ++-- caster/asynch/_stickylist.py | 2 +- caster/asynch/hmc/h_launch.py | 6 +++--- caster/dev.py | 2 +- caster/lib/context.py | 20 +++++++++--------- caster/lib/dfplus/additions.py | 4 ++-- caster/lib/dfplus/state/stackitems.py | 4 ++-- caster/lib/navigation.py | 30 +++++++++++++-------------- caster/lib/password.py | 8 +++---- caster/lib/pita/fn.py | 22 +++++++------------- caster/lib/recording.py | 4 ++-- 14 files changed, 57 insertions(+), 63 deletions(-) diff --git a/_caster.py b/_caster.py index ed12f8185..50147fbae 100644 --- a/_caster.py +++ b/_caster.py @@ -61,7 +61,7 @@ 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() + Key("left/5:" + str(len(lu)) + ", del").execute() except Exception: utilities.simple_log(False) @@ -69,13 +69,13 @@ 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() + 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 change_monitor(): if settings.SETTINGS["miscellaneous"]["sikuli_enabled"]: - Playback([(["monitor", "select"], 0.0)])._execute() + Playback([(["monitor", "select"], 0.0)]).execute() else: utilities.report("This command requires SikuliX to be enabled in the settings file") diff --git a/caster/apps/grid/douglasgrid.py b/caster/apps/grid/douglasgrid.py index 4b39b67bf..01c2dc278 100644 --- a/caster/apps/grid/douglasgrid.py +++ b/caster/apps/grid/douglasgrid.py @@ -24,9 +24,9 @@ def send_input(n, n2, action): grids.wait_for_death(settings.DOUGLAS_TITLE) int_a = int(action) if int_a == 0: - Playback([(["mouse", "left", "click"], 0.0)])._execute() + Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: - Playback([(["mouse", "right", "click"], 0.0)])._execute() + Playback([(["mouse", "right", "click"], 0.0)]).execute() class GridControlRule(MappingRule): diff --git a/caster/apps/grid/legiongrid.py b/caster/apps/grid/legiongrid.py index f02ed134b..44e9a08c5 100644 --- a/caster/apps/grid/legiongrid.py +++ b/caster/apps/grid/legiongrid.py @@ -34,9 +34,9 @@ def send_input(n, action): grids.wait_for_death(settings.LEGION_TITLE) if int_a == 0: - Playback([(["mouse", "left", "click"], 0.0)])._execute() + Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: - Playback([(["mouse", "right", "click"], 0.0)])._execute() + Playback([(["mouse", "right", "click"], 0.0)]).execute() elif int_a == 2: x1 = response["l"]+2 x2 = response["r"] diff --git a/caster/apps/grid/rainbowgrid.py b/caster/apps/grid/rainbowgrid.py index 77b21429c..9e52d3cb2 100644 --- a/caster/apps/grid/rainbowgrid.py +++ b/caster/apps/grid/rainbowgrid.py @@ -22,9 +22,9 @@ def send_input(pre, color, n, action): grids.wait_for_death(settings.RAINBOW_TITLE) int_a = int(action) if int_a == 0: - Playback([(["mouse", "left", "click"], 0.0)])._execute() + Playback([(["mouse", "left", "click"], 0.0)]).execute() elif int_a == 1: - Playback([(["mouse", "right", "click"], 0.0)])._execute() + Playback([(["mouse", "right", "click"], 0.0)]).execute() class GridControlRule(MappingRule): diff --git a/caster/asynch/_stickylist.py b/caster/asynch/_stickylist.py index aba47ae47..cdf327827 100644 --- a/caster/asynch/_stickylist.py +++ b/caster/asynch/_stickylist.py @@ -27,7 +27,7 @@ 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() + Text(control.nexus().sticky[n]).execute() if not utilities.window_exists(None, settings.S_LIST_VERSION): enable_sticky_list(sticky) diff --git a/caster/asynch/hmc/h_launch.py b/caster/asynch/hmc/h_launch.py index efb760739..2eb2ea535 100644 --- a/caster/asynch/hmc/h_launch.py +++ b/caster/asynch/hmc/h_launch.py @@ -30,9 +30,9 @@ def launch(hmc_type, callback, data=None): Popen(instructions) hmc_title=_get_title(hmc_type) - WaitWindow(title=hmc_title, timeout=5)._execute() - FocusWindow(title=hmc_title)._execute() - Key("tab")._execute() + WaitWindow(title=hmc_title, timeout=5).execute() + FocusWindow(title=hmc_title).execute() + Key("tab").execute() from caster.asynch.hmc import squeue squeue.add_query(callback) diff --git a/caster/dev.py b/caster/dev.py index 586010682..36e5240b6 100644 --- a/caster/dev.py +++ b/caster/dev.py @@ -132,7 +132,7 @@ class DevRule(MappingRule): "Agrippa ": Function(grep_this), # experimental/incomplete commands - + "zone test": R(Text("a")+Text("b")), "experiment ": Function(experiment), # diff --git a/caster/lib/context.py b/caster/lib/context.py index 8e73c591d..45baf0634 100644 --- a/caster/lib/context.py +++ b/caster/lib/context.py @@ -41,11 +41,11 @@ def navigate_to_character(direction3, target): break # make sure nothing is highlighted to boot - Key("right, left" if look_left else "left, right")._execute() + Key("right, left" if look_left else "left, right").execute() if look_left: - Key("cs-left")._execute() + Key("cs-left").execute() else: - Key("cs-right")._execute() + Key("cs-right").execute() # max_highlights = 100 index = -1 # last_copy_was_successful = True @@ -66,18 +66,18 @@ def navigate_to_character(direction3, target): # highlight only the target if index != -1: - Key("left" if look_left else "right")._execute() + Key("left" if look_left else "right").execute() nt = index if look_left else len(context) - index - 1 # number of times to press left or right before the highlight if nt != 0: - Key("right/5:" + str(nt) if look_left else "left/5:" + str(nt))._execute() + Key("right/5:" + str(nt) if look_left else "left/5:" + str(nt)).execute() if is_character: - Key("s-right" if look_left else "s-left")._execute() + Key("s-right" if look_left else "s-left").execute() else: - Key("cs-right" if look_left else "cs-left")._execute() + Key("cs-right" if look_left else "cs-left").execute() return True else: # reset cursor - Key("left" if look_left else "right")._execute() + Key("left" if look_left else "right").execute() return False except Exception: @@ -117,7 +117,7 @@ def read_selected_without_altering_clipboard(same_is_okay=False): prior_content = Clipboard.get_system_text() Clipboard.set_system_text("") - Key("c-c")._execute() + Key("c-c").execute() time.sleep(0.05) # time for keypress to execute temporary = Clipboard.get_system_text() cb.copy_to_system() @@ -141,5 +141,5 @@ def fill_within_line(target): def nav(parameters): result = navigate_to_character(str(parameters[0]), str(parameters[1])) if result: - Key(str(parameters[0]))._execute() + Key(str(parameters[0])).execute() return result \ No newline at end of file diff --git a/caster/lib/dfplus/additions.py b/caster/lib/dfplus/additions.py index f4cb8f7d2..76d73688a 100644 --- a/caster/lib/dfplus/additions.py +++ b/caster/lib/dfplus/additions.py @@ -23,8 +23,8 @@ def _execute(self, data=None): 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() + self.action.execute() else: utilities.availability_message("SelectiveAction", "natlink") - self.action._execute() + self.action.execute() diff --git a/caster/lib/dfplus/state/stackitems.py b/caster/lib/dfplus/state/stackitems.py index a58f12d01..7fcade2ff 100644 --- a/caster/lib/dfplus/state/stackitems.py +++ b/caster/lib/dfplus/state/stackitems.py @@ -29,7 +29,7 @@ def __init__(self, registered_action, type="raction"): self.preserved = [] def execute(self): self.complete = True - self.base._execute(self.dragonfly_data) + self.base.execute(self.dragonfly_data) # do presentation here self.clean() def clean(self): @@ -74,7 +74,7 @@ def executeCL(self, cl):# the return value is whether to terminate a continuer return action(fnparams) else: # it's a dragonfly action, and the parameters are the spec - action(cl.parameters)._execute(cl.dragonfly_data) + action(cl.parameters).execute(cl.dragonfly_data) return False def eat(self, level, stack_item): self.spoken[level] = stack_item.preserved diff --git a/caster/lib/navigation.py b/caster/lib/navigation.py index 7a3359912..b0b97b97f 100644 --- a/caster/lib/navigation.py +++ b/caster/lib/navigation.py @@ -74,31 +74,31 @@ def word_number(wn): 8: "eight", 9: "nine" } - Text(numbers_to_words[int(wn)])._execute() + Text(numbers_to_words[int(wn)]).execute() def numbers2(wnKK): - Text(str(wnKK))._execute() + Text(str(wnKK)).execute() def letters(big, dict1, dict2, letter): '''used with alphabet.txt''' d1 = str(dict1) if d1 != "": - Text(d1)._execute() + Text(d1).execute() if str(big) != "": - Key("shift:down")._execute() - letter._execute() + Key("shift:down").execute() + letter.execute() if str(big) != "": - Key("shift:up")._execute() + Key("shift:up").execute() d2 = str(dict2) if d2 != "": - Text(d2)._execute() + Text(d2).execute() def letters2(big, letter): if str(big) != "": - Key("shift:down")._execute() - Key(letter)._execute() + Key("shift:down").execute() + Key(letter).execute() if str(big) != "": - Key("shift:up")._execute() + Key("shift:up").execute() def mouse_alternates(mode): try: @@ -150,7 +150,7 @@ def drop(nnavi500): win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(control.nexus().clip[key]) win32clipboard.CloseClipboard() - Key("c-v")._execute() + Key("c-v").execute() else: dragonfly.get_engine().speak("slot empty") time.sleep(0.05) @@ -165,7 +165,7 @@ def erase_multi_clipboard(): def volume_control(n, volume_mode): for i in range(0, int(n)): - Key("volume" + str(volume_mode))._execute() + Key("volume" + str(volume_mode)).execute() def master_format_text(capitalization, spacing, textnv): ''' @@ -211,7 +211,7 @@ def master_format_text(capitalization, spacing, textnv): t = "-".join(t.split(" ")) elif spacing == 3: t = "_".join(t.split(" ")) - Text(t)._execute() + Text(t).execute() def master_text_nav(mtn_mode, mtn_dir, nnavi500, extreme): ''' @@ -252,11 +252,11 @@ def kill_grids_and_wait(): def kick(): kill_grids_and_wait() - Playback([(["mouse", "left", "click"], 0.0)])._execute() + Playback([(["mouse", "left", "click"], 0.0)]).execute() def kick_right(): kill_grids_and_wait() - Playback([(["mouse", "right", "click"], 0.0)])._execute() + Playback([(["mouse", "right", "click"], 0.0)]).execute() def kick_middle(): kill_grids_and_wait() diff --git a/caster/lib/password.py b/caster/lib/password.py index e4a03f76c..aa9e4b674 100644 --- a/caster/lib/password.py +++ b/caster/lib/password.py @@ -9,16 +9,16 @@ def hash_password(text, text2, text3): composite = str(text) + str(text) + str(text) + settings.SETTINGS["password"]["seed1"] hash_object = hashlib.sha256(composite) result = hash_object.hexdigest()[0:16] - Text(result)._execute() + Text(result).execute() def get_password(text, text2, text3): base = settings.SETTINGS["password"]["seed1"] + str(string.lowercase.index(str(text)[0]) + 1) + str(string.lowercase.index(str(text2)[0]) + 1) + str(string.lowercase.index(str(text3)[0]) + 1) - Text(base)._execute() + Text(base).execute() def get_restricted_password(text, text2, text3): base = settings.SETTINGS["password"]["seed2"] + str(string.lowercase.index(str(text)[0]) + 1) + str(string.lowercase.index(str(text2)[0]) + 1) + str(string.lowercase.index(str(text3)[0]) + 1) - Text(base)._execute() + Text(base).execute() def get_simple_password(text, text2, text3): base = settings.SETTINGS["password"]["seed3"] + str(text)[0] + str(text2)[0] + str(text3)[0] + settings.SETTINGS["password"]["seed4"] - Text(base)._execute() \ No newline at end of file + Text(base).execute() \ No newline at end of file diff --git a/caster/lib/pita/fn.py b/caster/lib/pita/fn.py index 4fa02fe83..ebed21ed9 100644 --- a/caster/lib/pita/fn.py +++ b/caster/lib/pita/fn.py @@ -43,17 +43,11 @@ def pita(textnv): 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() - - -# Text(result)._execute() + 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) diff --git a/caster/lib/recording.py b/caster/lib/recording.py index ef5acd06c..eb776e3d4 100644 --- a/caster/lib/recording.py +++ b/caster/lib/recording.py @@ -22,9 +22,9 @@ def __init__(self, commands, name=None, spec=None, extras=None, def _process_recognition(self, node, extras): if "n" in extras: for i in range(0, int(extras["n"])): - Playback(self.playback_array)._execute() + Playback(self.playback_array).execute() else: - Playback(self.playback_array)._execute() + Playback(self.playback_array).execute() def add_alias(text): text = str(text)