def scan_directory(nexus): on_complete = AsynchronousAction.hmc_complete(lambda data: _scan_directory(data, nexus), nexus) h_launch.launch(settings.QTYPE_DIRECTORY) AsynchronousAction([L(S(["cancel"], on_complete))], time_in_seconds=0.5, repetitions=300, blocking=False).execute()
def __init__(self, base, rspec="default", rdescript="unnamed command (CA)", instructions="instructions missing", nexus=None): self.set_nexus(nexus) on_complete = AsynchronousAction.hmc_complete( lambda data: receive_response(data), self.nexus()) AsynchronousAction.__init__( self, [L(S(["cancel"], on_complete))], 1, 60, rdescript, False ) # cannot block, if it does, it'll block its own confirm command self.base = base self.rspec = rspec self.instructions = instructions mutable_integer = {"value": 0} def receive_response( data ): # signals to the stack to cease waiting, return True terminates ''' receives response from homunculus, uses it to stop the stack and tell the ConfirmAction how to execute ''' mutable_integer["value"] = data["confirm"] self.mutable_integer = mutable_integer
def settings_window(nexus): h_launch.launch(settings.WXTYPE_SETTINGS) on_complete = AsynchronousAction.hmc_complete( lambda data: receive_settings(data), nexus) AsynchronousAction([L(S(["cancel"], on_complete))], time_in_seconds=1, repetitions=300, blocking=False).execute()
def settings_window(nexus): h_launch.launch(settings.WXTYPE_SETTINGS) on_complete = AsynchronousAction.hmc_complete(lambda data: receive_settings(data), nexus) AsynchronousAction( [L(S(["cancel"], on_complete))], time_in_seconds=1, repetitions=300, blocking=False).execute()
def chain_alias(self): text = read_highlighted(10) if text is not None: h_launch.launch(settings.QTYPE_INSTRUCTIONS, data="Enter_spec_for_command|") on_complete = AsynchronousAction.hmc_complete(lambda data: self.refresh(data[0].replace("\n", ""), text), self.nexus) AsynchronousAction([L(S(["cancel"], on_complete, None))], time_in_seconds=0.5, repetitions=300, blocking=False).execute()
def chain_alias(self): text = read_highlighted(10) if text is not None: h_launch.launch(settings.QTYPE_INSTRUCTIONS, data="Enter_spec_for_command|") on_complete = AsynchronousAction.hmc_complete( lambda data: self.refresh(data[0].replace("\n", ""), text), self.nexus) AsynchronousAction( [L(S(["cancel"], on_complete))], time_in_seconds=0.5, repetitions=300, blocking=False).execute()
def record_from_history(self): # save the list as it was when the command was spoken self.nexus.preserved = self.nexus.history[:] # format for display formatted = "" for t in self.nexus.preserved: for w in t: formatted += w.split("\\")[0] + "[w]" formatted += "[s]" # use a response window to get a spec and word sequences for the new macro h_launch.launch(settings.QTYPE_RECORDING, data=formatted) on_complete = AsynchronousAction.hmc_complete(lambda data: self.add_recorded_macro(data), self.nexus) AsynchronousAction([L(S(["cancel"], on_complete))], time_in_seconds=0.5, repetitions=300, blocking=False).execute()
def __init__(self, base, rspec="default", rdescript="unnamed command (CA)", instructions="instructions missing", nexus=None): self.set_nexus(nexus) on_complete = AsynchronousAction.hmc_complete(lambda data: receive_response(data), self.nexus()) AsynchronousAction.__init__(self, [L(S(["cancel"], on_complete, None))], 1, 60, rdescript, False)# cannot block, if it does, it'll block its own confirm command self.base = base self.rspec = rspec self.instructions = instructions mutable_integer = {"value": 0} def receive_response(data): # signals to the stack to cease waiting, return True terminates ''' receives response from homunculus, uses it to stop the stack and tell the ConfirmAction how to execute ''' mutable_integer["value"] = data["confirm"] self.mutable_integer = mutable_integer
def settings_window(nexus): if not utilities.window_exists(None, settings.STATUS_WINDOW_TITLE + settings.SOFTWARE_VERSION_NUMBER): h_launch.launch(settings.WXTYPE_SETTINGS) on_complete = AsynchronousAction.hmc_complete(lambda data: receive_settings(data), nexus) AsynchronousAction([L(S(["cancel"], on_complete))], time_in_seconds=1, repetitions=300, blocking=False).execute()