[pyatspi2] Add ScrollTo and ScrollToPoint component interfaces



commit cac62d37f6491e49374070efe3bc7b0a8fc3fdec
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Tue Feb 13 16:41:15 2018 +0100

    Add ScrollTo and ScrollToPoint component interfaces

 pyatspi/component.py |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/pyatspi/component.py b/pyatspi/component.py
index 04be988..19b166e 100644
--- a/pyatspi/component.py
+++ b/pyatspi/component.py
@@ -33,6 +33,14 @@ __all__ = [
            "LAYER_POPUP",
            "LAYER_WIDGET",
            "LAYER_WINDOW",
+           "ScrollType",
+           "SCROLL_TOP_LEFT",
+           "SCROLL_BOTTOM_RIGHT",
+           "SCROLL_TOP_EDGE",
+           "SCROLL_BOTTOM_EDGE",
+           "SCROLL_LEFT_EDGE",
+           "SCROLL_RIGHT_EDGE",
+           "SCROLL_ANYWHERE",
           ]
 
 #------------------------------------------------------------------------------
@@ -41,10 +49,12 @@ class CoordType(AtspiEnum):
         _enum_lookup = {
                 0:'XY_SCREEN',
                 1:'XY_WINDOW',
+                2:'XY_PARENT',
         }
 
 XY_SCREEN = CoordType(0)
 XY_WINDOW = CoordType(1)
+XY_PARENT = CoordType(2)
 
 #------------------------------------------------------------------------------
 
@@ -73,6 +83,27 @@ LAYER_WINDOW = ComponentLayer(7)
 
 #------------------------------------------------------------------------------
 
+class ScrollType(AtspiEnum):
+        _enum_lookup = {
+                0:'SCROLL_TOP_LEFT',
+                1:'SCROLL_BOTTOM_RIGHT',
+                2:'SCROLL_TOP_EDGE',
+                3:'SCROLL_BOTTOM_EDGE',
+                4:'SCROLL_LEFT_EDGE',
+                5:'SCROLL_RIGHT_EDGE',
+                6:'SCROLL_ANYWHERE',
+        }
+
+SCROLL_ANYWHERE = ScrollType(6)
+SCROLL_BOTTOM_EDGE = ScrollType(3)
+SCROLL_BOTTOM_RIGHT = ScrollType(1)
+SCROLL_LEFT_EDGE = ScrollType(4)
+SCROLL_RIGHT_EDGE = ScrollType(5)
+SCROLL_TOP_EDGE = ScrollType(2)
+SCROLL_TOP_LEFT = ScrollType(0)
+
+#------------------------------------------------------------------------------
+
 class Component(interface):
         """
         The Component interface is implemented by objects which occupy
@@ -170,4 +201,20 @@ class Component(interface):
                 """
                 return Atspi.Component.grab_focus(self.obj)
 
+        def scrollTo(self, scroll_type):
+                """
+                Makes the object visible on the screen at a given position by
+                scrolling all necessary parents.
+                @return True if scrolling was successful.
+                """
+                return Atspi.Component.scroll_to(self.obj, scroll_type)
+
+        def scrollToPoint(self, coord_type, x, y):
+                """
+                Makes the object visible on the screen at a given position by
+                scrolling all necessary parents.
+                @return True if scrolling was successful.
+                """
+                return Atspi.Component.scroll_to_point(self.obj, coord_type, x, y)
+
 #END----------------------------------------------------------------------------


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]