Esempio n. 1
0
 def __init__(self, key_code=None, key_name=None, delta_time=0):
   """
   Initialize L{KeyReleaseAction}. Could use either a hardware keycode, 
   a key name, or both.
   
   @param delta_time: Time to wait before performing this step.
   @type delta_time: integer
   @param key_code: Hardware keycode.
   @type key_code: integer.
   @param key_name: Key name.
   @type key_name: string.
   """
   if (None, None) == (key_name, key_code):
     raise TypeError("Need either a key code or a key name")
   if delta_time > release_max: delta_time = release_max
   self._key_name = key_name
   if key_code is None:
     self.key_op = KeyboardOp()
     key_vals = self.key_op.get_keyval_id(key_name)
     if not key_vals:
       return
     for key_val in key_vals:
       AtomicAction.__init__(self, delta_time, self._keyRelease, key_val.value)
   else:
     AtomicAction.__init__(self, delta_time, self._keyRelease, key_code)
Esempio n. 2
0
 def __init__(self, key_code=None, key_name=None, delta_time=0):
   """
   Initialize L{KeyReleaseAction}. Could use either a hardware keycode, 
   a key name, or both.
   
   @param delta_time: Time to wait before performing this step.
   @type delta_time: integer
   @param key_code: Hardware keycode.
   @type key_code: integer.
   @param key_name: Key name.
   @type key_name: string.
   """
   if (None, None) == (key_name, key_code):
     raise TypeError("Need either a key code or a key name")
   if delta_time > release_max: delta_time = release_max
   self._key_name = key_name
   if key_code is None:
     self.key_op = KeyboardOp()
     key_vals = self.key_op.get_keyval_id(key_name)
     if not key_vals:
       return
     for key_val in key_vals:
       AtomicAction.__init__(self, delta_time, self._keyRelease, key_val.value)
   else:
     AtomicAction.__init__(self, delta_time, self._keyRelease, key_code)
Esempio n. 3
0
 def __init__(self, key_combo, delta_time=0):    
   '''
   Initialize L{KeyComboAction}.
   
   @param key_combo: Name of key combination or single key press-release.
   @type key_combo: string
   @param delta_time: Time to wait before performing step.
   @type delta_time: integer
   '''
   keyval, modifiers = gtk.accelerator_parse(key_combo)
   key_code = utils.getKeyCodeFromVal(keyval)
   self._key_combo = key_combo
   if delta_time < min_delta: delta_time = min_delta
   AtomicAction.__init__(self, delta_time, self._doCombo, key_code, modifiers)
 def __init__(self, key_combo, delta_time=0):
     '''
 Initialize L{KeyComboAction}.
 
 @param key_combo: Name of key combination or single key press-release.
 @type key_combo: string
 @param delta_time: Time to wait before performing step.
 @type delta_time: integer
 '''
     keyval, modifiers = gtk.accelerator_parse(key_combo)
     key_code = utils.getKeyCodeFromVal(keyval)
     self._key_combo = key_combo
     if delta_time < min_delta: delta_time = min_delta
     AtomicAction.__init__(self, delta_time, self._doCombo, key_code,
                           modifiers)
Esempio n. 5
0
 def __init__(self, key_combo, delta_time=0):    
   """
   Initialize L{KeyComboAction}.
   
   @param key_combo: Name of key combination or single key press-release.
   @type key_combo: string
   @param delta_time: Time to wait before performing step.
   @type delta_time: integer
   """
   self.key_op = KeyboardOp()
   key_vals = self.key_op.get_keyval_id(key_combo)
   if not key_vals:
     return
   self._key_combo = key_vals
   if delta_time < min_delta: delta_time = min_delta
   AtomicAction.__init__(self, delta_time, self._doCombo)
Esempio n. 6
0
 def __init__(self, key_combo, delta_time=0):    
   """
   Initialize L{KeyComboAction}.
   
   @param key_combo: Name of key combination or single key press-release.
   @type key_combo: string
   @param delta_time: Time to wait before performing step.
   @type delta_time: integer
   """
   self.key_op = KeyboardOp()
   key_vals = self.key_op.get_keyval_id(key_combo)
   if not key_vals:
     return
   self._key_combo = key_vals
   if delta_time < min_delta: delta_time = min_delta
   AtomicAction.__init__(self, delta_time, self._doCombo)
 def __init__(self, string_to_type, delta_time=0, interval=None):
     '''
 Initialize L{TypeAction}
 
 @param string_to_type: String to type.
 @type string_to_type: string
 @param delta_time: time before starting this step.
 @type delta_time: integer
 @param interval: Time between keystrokes.
 @type interval: integer
 '''
     self._string_to_type = string_to_type
     if interval:
         self.interval = interval
     else:
         self.interval = keystroke_interval
     if delta_time < min_delta: delta_time = min_delta
     AtomicAction.__init__(self, delta_time, self._doType, string_to_type)
Esempio n. 8
0
 def __init__(self, string_to_type, delta_time=0, interval=None):    
   '''
   Initialize L{TypeAction}
   
   @param string_to_type: String to type.
   @type string_to_type: string
   @param delta_time: time before starting this step.
   @type delta_time: integer
   @param interval: Time between keystrokes.
   @type interval: integer
   '''
   self._string_to_type = string_to_type
   if interval:
     self.interval = interval
   else:
     self.interval = keystroke_interval
   if delta_time < min_delta: delta_time = min_delta
   AtomicAction.__init__(self, delta_time, self._doType, string_to_type)
Esempio n. 9
0
 def __init__(self, delta_time, key_code=None, key_name=None):
   '''
   Initialize L{KeyReleaseAction}. Could use either a hardware keycode, 
   a key name, or both.
   
   @param delta_time: Time to wait before performing this step.
   @type delta_time: integer
   @param key_code: Hardware keycode.
   @type key_code: integer.
   @param key_name: Key name.
   @type key_name: string.
   '''
   if (None, None) == (key_name, key_code):
     raise TypeError("Need either a key code or a key name")
   if delta_time > release_max: delta_time = release_max
   self._key_name = key_name
   if key_code is None:
     key_code = utils.getKeyCodeFromVal(gtk.gdk.keyval_from_name(key_name))
   AtomicAction.__init__(self, delta_time, self._keyRelease, key_code)
 def __init__(self, delta_time, key_code=None, key_name=None):
     '''
 Initialize L{KeyReleaseAction}. Could use either a hardware keycode, 
 a key name, or both.
 
 @param delta_time: Time to wait before performing this step.
 @type delta_time: integer
 @param key_code: Hardware keycode.
 @type key_code: integer.
 @param key_name: Key name.
 @type key_name: string.
 '''
     if (None, None) == (key_name, key_code):
         raise TypeError("Need either a key code or a key name")
     if delta_time > release_max: delta_time = release_max
     self._key_name = key_name
     if key_code is None:
         key_code = utils.getKeyCodeFromVal(
             gtk.gdk.keyval_from_name(key_name))
     AtomicAction.__init__(self, delta_time, self._keyRelease, key_code)