Skip to content

Commit

Permalink
fixes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
synkarius committed Jul 3, 2015
1 parent 16d2d65 commit df393ad
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 63 deletions.
6 changes: 3 additions & 3 deletions _caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ 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)

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")

Expand Down
4 changes: 2 additions & 2 deletions caster/apps/grid/douglasgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
4 changes: 2 additions & 2 deletions caster/apps/grid/legiongrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions caster/apps/grid/rainbowgrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion caster/asynch/_stickylist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions caster/asynch/hmc/h_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion caster/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ class DevRule(MappingRule):
"Agrippa <filetype> <path>": Function(grep_this),

# experimental/incomplete commands

"zone test": R(Text("a")+Text("b")),

"experiment <text>": Function(experiment),
#
Expand Down
20 changes: 10 additions & 10 deletions caster/lib/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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()
Expand All @@ -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
4 changes: 2 additions & 2 deletions caster/lib/dfplus/additions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

4 changes: 2 additions & 2 deletions caster/lib/dfplus/state/stackitems.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
30 changes: 15 additions & 15 deletions caster/lib/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand All @@ -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):
'''
Expand Down Expand Up @@ -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):
'''
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions caster/lib/password.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Text(base).execute()
22 changes: 8 additions & 14 deletions caster/lib/pita/fn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions caster/lib/recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit df393ad

Please sign in to comment.