예제 #1
0
파일: scanner.py 프로젝트: carver7/caster
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()
예제 #2
0
파일: actions2.py 프로젝트: mrob95/caster
    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
예제 #3
0
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()
예제 #4
0
파일: _hmc.py 프로젝트: seekM/caster
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()
예제 #5
0
 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()
예제 #6
0
 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()
예제 #7
0
파일: history.py 프로젝트: tyoung87/caster
 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()
예제 #8
0
 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
예제 #9
0
파일: _hmc.py 프로젝트: carver7/caster
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()