strongwind r27 - in trunk: . strongwind
- From: bgmerrell svn gnome org
- To: svn-commits-list gnome org
- Subject: strongwind r27 - in trunk: . strongwind
- Date: Wed, 3 Dec 2008 02:53:33 +0000 (UTC)
Author: bgmerrell
Date: Wed Dec 3 02:53:33 2008
New Revision: 27
URL: http://svn.gnome.org/viewvc/strongwind?rev=27&view=rev
Log:
* strongwind/accessibles.py: Provide a method that can move the mouse
to an accessible without clicking. (#563039)
Modified:
trunk/ChangeLog
trunk/strongwind/accessibles.py
Modified: trunk/strongwind/accessibles.py
==============================================================================
--- trunk/strongwind/accessibles.py (original)
+++ trunk/strongwind/accessibles.py Wed Dec 3 02:53:33 2008
@@ -469,6 +469,15 @@
sleep(config.KEYCOMBO_DELAY)
pyatspi.Registry.generateKeyboardEvent(key_code, None, pyatspi.KEY_RELEASE)
+ def mouseMove(self, xOffset=0, yOffset=0, log=True):
+ 'Move the mouse cursor to the Accessible'
+
+ if log:
+ procedurelogger.action('Move the mouse cursor to the %s.' % (self), self)
+
+ x, y = self._getAccessibleCenter()
+ pyatspi.Registry.generateMouseEvent(x + xOffset, y + yOffset, 'abs')
+
def mouseClick(self, button=1, xOffset=0, yOffset=0, log=True):
'Synthesize a left, middle, or right mouse click on this Accessible'
@@ -484,10 +493,16 @@
procedurelogger.action('%s the %s.' % (button_name, self), self)
+ x, y = self._getAccessibleCenter()
+ pyatspi.Registry.generateMouseEvent(x + xOffset, y + yOffset, 'b%dc' % button)
+
+ def _getAccessibleCenter(self):
+ 'Calculate and return the x,y coordinates of the visual center of the accessible'
+
bbox = self.extents
- x = bbox.x + (bbox.width / 2) + xOffset
- y = bbox.y + (bbox.height / 2) + yOffset
- pyatspi.Registry.generateMouseEvent(x, y, 'b%dc' % button)
+ x = bbox.x + (bbox.width / 2)
+ y = bbox.y + (bbox.height / 2)
+ return (x, y)
# interface methods
def _doAction(self, action):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]