Exemplo n.º 1
0
def cycle_modifiers():
    """Cycle through the list of modifiers."""
    application.modifier_index += 1
    if application.modifier_index >= len(application.modifiers):
        application.modifier_index = 0
    key = application.modifiers[application.modifier_index]
    ao2.speak('%s%s' % (key, ' pressed' if key in keyboard.pressed else ''),
              interrupt=True)
Exemplo n.º 2
0
 def toggle(self, key):
  """Toggle the state of a modifier key."""
  key_name = self.modifier_names.get(key, key)
  if key in self.pressed:
   self.pressed.remove(key)
   self._send('keyup %s' % key_name)
   action = 'released'
  else:
   self.pressed.append(key)
   self._send('keydown %s' % key_name)
   action = 'pressed'
  ao2.speak('%s %s.' % (key, action), interrupt = True)
Exemplo n.º 3
0
 def press(self, key):
  """Press one of the arrow keys depending on mode."""
  if modes[self.mode] == mode_arrows:
   self.send(key)
  else:
   if key == 'Up':
    application.grid_y = max(0, application.grid_y - 1)
   elif key == 'Down':
    application.grid_y = min(application.grid_y + 1, len(application.grid) - 1)
   elif key == 'Left':
    application.grid_x = max(0, application.grid_x - 1)
   elif key == 'Right':
    application.grid_x = min(application.grid_x + 1, len(application.grid[application.grid_y]) - 1)
   if application.grid_x >= len(application.grid[application.grid_y]):
    application.grid_x = len(application.grid[application.grid_y]) - 1
   ao2.speak(self.get_friendly_name(application.grid[application.grid_y][application.grid_x]), interrupt = True)
Exemplo n.º 4
0
 def on_joyhat_motion(self, joystick, hat_x, hat_y):
     """Joystick hat was pressed."""
     ao2.speak('%s, %s.' % (x, y))
Exemplo n.º 5
0
 def on_joybutton_release(self, joystick, button):
     if button in buttons:
         buttons[button]()
     else:
         ao2.speak(str(button))
Exemplo n.º 6
0
def toggle_speech():
    keyboard.speak = not keyboard.speak
    ao2.speak('Speech %s.' % ('enabled' if keyboard.speak else 'disabled'))
Exemplo n.º 7
0
def change_mode():
    keyboard.mode += 1
    if keyboard.mode >= len(modes):
        keyboard.mode = 0
    ao2.speak(modes[keyboard.mode])