Ejemplo n.º 1
0
    def _parse_spec(self, spec):
        """Overrides the normal Text class behavior. To handle dictation of
        special characters like / . _
        Unfortunately, I have not found a better place to solve this.

        """
        events = []
        try:
            parts = re.split("\%\([a-z_0-9]+\)s", self._spec)
            if len(parts) > 2:
                raise Exception("SCText only supports one variable, yet.")
            start = len(parts[0])
            end = len(spec) - len(parts[1])
            words = spec[start:end]
            words = lib.format.strip_dragon_info(words)
            newText = ""
            for word in words:
                if (newText != "" and newText[-1:].isalnum()
                        and word[-1:].isalnum()):
                    word = " " + word  # Adds spacing between normal words.
                newText += word
            spec = parts[0] + newText + parts[1]
            if should_send_to_aenea():
                return spec
            for character in spec:
                if character in self._specials:
                    typeable = self._specials[character]
                else:
                    typeable = Keyboard.get_typeable(character)
                events.extend(typeable.events(self._pause))
        except Exception as e:
            print self._spec, parts
            print("Error: %s" % e)
        return events
Ejemplo n.º 2
0
    def _parse_spec(self, spec):
        """Overrides the normal Text class behavior. To handle dictation of
        special characters like / . _
        Unfortunately, I have not found a better place to solve this.

        """
        events = []
        try:
            parts = re.split("\%\([a-z_0-9]+\)s", self._spec)
            if len(parts) > 2:
                raise Exception("SCText only supports one variable, yet.")
            start = len(parts[0])
            end = len(spec) - len(parts[1])
            words = spec[start:end]
            words = lib.format.strip_dragon_info(words)
            newText = ""
            for word in words:
                if (newText != "" and newText[-1:].isalnum() and
                        word[-1:].isalnum()):
                    word = " " + word  # Adds spacing between normal words.
                newText += word
            spec = parts[0] + newText + parts[1]
            if should_send_to_aenea():
                return spec
            for character in spec:
                if character in self._specials:
                    typeable = self._specials[character]
                else:
                    typeable = Keyboard.get_typeable(character)
                events.extend(typeable.events(self._pause))
        except Exception as e:
            print self._spec, parts
            print("Error: %s" % e)
        return events
Ejemplo n.º 3
0
def mouse_pos(pos1, pos2=None, pos3=None, pos4=None, pos5=None, pos6=None,
              pos7=None, pos8=None, pos9=None, action=None):
    if should_send_to_aenea():
        lib.grid_base_x.mouse_pos(pos1, pos2, pos3, pos4, pos5, pos6, pos7,
            pos8, pos9, action)
    else:
        lib.grid_base_win.mouse_pos(pos1, pos2, pos3, pos4, pos5, pos6, pos7,
            pos8, pos9, action)
Ejemplo n.º 4
0
def mouse_grid_start(pos1=None, pos2=None, pos3=None, pos4=None, pos5=None,
    pos6=None, pos7=None, pos8=None, pos9=None, action=None):
    if should_send_to_aenea():
        lib.grid_base_x.set_grammar_reference(grammarNavigation)
        grammarNavigation.enable()
        lib.grid_base_x.mouse_grid(pos1, pos2, pos3, pos4, pos5, pos6, pos7,
            pos8, pos9, action)
    else:
        lib.grid_base_win.set_grammar_reference(grammarNavigation)
        grammarNavigation.enable()
        lib.grid_base_win.mouse_grid(pos1, pos2, pos3, pos4, pos5, pos6, pos7,
            pos8, pos9, action)
Ejemplo n.º 5
0
def hide_grids():
    if should_send_to_aenea():
        lib.grid_base_x.hide_grids()
    else:
        lib.grid_base_win.hide_grids()
Ejemplo n.º 6
0
def mouse_drag():
    if should_send_to_aenea():
        lib.grid_base_x.mouse_drag()
    else:
        lib.grid_base_win.mouse_drag()
Ejemplo n.º 7
0
def shift_click():
    if should_send_to_aenea():
        lib.grid_base_x.shift_click()
    else:
        lib.grid_base_win.shift_click()
Ejemplo n.º 8
0
def control_click():
    if should_send_to_aenea():
        lib.grid_base_x.control_click()
    else:
        lib.grid_base_win.control_click()
Ejemplo n.º 9
0
def double_click():
    if should_send_to_aenea():
        lib.grid_base_x.double_click()
    else:
        lib.grid_base_win.double_click()
Ejemplo n.º 10
0
def right_click():
    if should_send_to_aenea():
        lib.grid_base_x.right_click()
    else:
        lib.grid_base_win.right_click()
Ejemplo n.º 11
0
def unload_grids():
    if should_send_to_aenea():
        pass  # The grid Windows are on the server side, no need to unload.
    else:
        lib.grid_base_win.unload_grids()
Ejemplo n.º 12
0
def go():
    if should_send_to_aenea():
        lib.grid_base_x.go()
    else:
        lib.grid_base_win.go()