コード例 #1
0
ファイル: keypress_actions.py プロジェクト: eeejay/ldtp2
 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)
コード例 #2
0
ファイル: keypress_actions.py プロジェクト: eeejay/ldtp2
 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)