Trees | Indices | Help |
|
---|
|
1 ''' 2 Defines an L{AEEvent} indicating a gesture has been performed on an L{AEInput} 3 device. 4 5 @author: Peter Parente 6 @author: Scott Haeger 7 @organization: IBM Corporation 8 @copyright: Copyright (c) 2005, 2007 IBM Corporation 9 @license: The BSD License 10 11 @author: Frank Zenker 12 @author: Ramona Bunk 13 @organization: IT Science Center Ruegen gGmbH, Germany 14 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen 15 @license: The BSD License 16 17 All rights reserved. This program and the accompanying materials are made 18 available under the terms of the BSD license which accompanies 19 this distribution, and is available at 20 U{http://www.opensource.org/licenses/bsd-license.php} 21 ''' 22 23 import AccessEngine 24 from AccessEngine import AEInput 25 import Base 2628 ''' 29 Event that fires when some L{AEInput.Gesture} is detected on an L{AEInput} 30 device. Always defaults to the focused layer. 31 32 This class registers its name and whether it should be monitored by default in 33 an L{AEMonitor} using the L{Base.registerEventType} function 34 when this module is first imported. The L{AEMonitor} can use this 35 information to build its menus. 36 37 @ivar gesture: Gesture detected 38 @type gesture: L{AEInput.Gesture} 39 @ivar timestamp: Time at which the gesture was received on the device 40 @type timestamp: float 41 @ivar kwargs: Additional arguments to be passed to a Input-Task 42 @type kwargs: dictionary 43 ''' 44 Base.registerEventType('InputGesture', True)12546 ''' 47 Calls the base class (which sets the event priority) and then stores the 48 L{AEInput.GestureList} that will be used to trigger a task. 49 50 @param gesture: Gestures detected on an L{AEInput} device 51 @type gesture: L{AEInput.Gesture} 52 @param timestamp: Time at which the gesture was received on the device 53 @type timestamp: float 54 @param kwargs: Additional arguments to be passed to a Input-Task 55 @type kwargs: dictionary 56 ''' 57 Base.AEEvent.__init__(self, focused=True, **kwargs) 58 self.gesture = gesture 59 self.timestamp = timestamp 60 self.kwargs = kwargs6163 ''' 64 Returns a human readable representation of this event including its name, 65 its gesture codes, and its device. 66 67 @return: Information about this event 68 @rtype: string 69 ''' 70 name = Base.AEEvent.__str__(self) 71 return '%s:\n\tgesture: %s\n\tdevice: %s' % \ 72 (name, self.gesture, self.gesture.getDevice().getName())7375 ''' 76 Contacts the L{AETierManager} and asks it to manage this event as a gesture. 77 78 @return: True to indicate the event executed properly 79 @rtype: boolean 80 ''' 81 AccessEngine.AETierManager.manageGesture(self) 82 return True8385 ''' 86 Gets the L{AEInput.GestureList} that triggered this event. This 87 information is used to locate the task that should handle this event. 88 89 @return: Gesture seen on an L{AEInput} device 90 @rtype: L{AEInput.GestureList} 91 ''' 92 g = self.gesture 93 return AEInput.GestureList(g.getDevice(), gestures=[g])9496 ''' 97 Gets the timestamp for when the event occurred. This timestamp is useful 98 for connecting input events to changes on the desktop. For instance, the 99 timestamp for keyboard input is needed when key presses open a new dialog 100 on some platforms such that the window manager can activate the dialog 101 once it appears. 102 103 @return: Gesture timestamp 104 @rtype: float 105 ''' 106 return self.timestamp107109 ''' 110 Fetches data out of this L{InputGesture} for use by a 111 Input Task. 112 113 @return: Dictionary of parameters to be passed to a Input-Task 114 as follows: 115 - timestamp: The time when the input gesture occurred. The scale and 116 absolute zero is device dependent. 117 - any additional data in the L{kwargs} instance variable 118 @rtype: dictionary 119 ''' 120 d = {} 121 d.update(self.kwargs) 122 d['timestamp'] = self.timestamp 123 d['gesture'] = self.gesture 124 return d
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon Jun 30 13:06:08 2008 | http://epydoc.sourceforge.net |