strongwind r13 - in trunk: . strongwind



Author: jtai
Date: Tue Jan  8 02:14:03 2008
New Revision: 13
URL: http://svn.gnome.org/viewvc/strongwind?rev=13&view=rev

Log:
2008-01-07  Jonathan Tai  <jon tgpsolutions com>

	* strongwind/accessibles.py: Add select() to the PageTab class; add
	  assertSelected() to the PageTab and TableCell classes.


Modified:
   trunk/ChangeLog
   trunk/strongwind/accessibles.py

Modified: trunk/strongwind/accessibles.py
==============================================================================
--- trunk/strongwind/accessibles.py	(original)
+++ trunk/strongwind/accessibles.py	Tue Jan  8 02:14:03 2008
@@ -759,7 +759,7 @@
 class PageTabList(Accessible):
     def getPageTabNames(self):
         'Returns the string name of all the page tabs'
-
+    
         names = []
         for child in self:
             names.append(child.name)
@@ -804,8 +804,32 @@
 
         return tab
 
-class PageTab(Accessible): # keep this around in case we want to add to it someday; application wrappers around tabs should extend from this class
-    pass
+class PageTab(Accessible): # application wrappers around tabs should extend from this class
+    def select(self, log=True):
+        '''
+        Select the page tab
+
+        This method should not be used to initially select a tab; PageTabList.select()
+        should be used instead.  Using PageTabList.findPageTab() may cause bogus search
+        errors if the tab's class's constructor looks for sub-widgets and that are
+        lazy-loaded.
+        '''
+
+        if log:
+            procedurelogger.action('Select the %s.' % self, self.parent)
+
+        self.parent.selectChild(self.getIndexInParent())
+
+    def assertSelected(self, log=True):
+        'Raise an exception if this tab is not selected'
+
+        if log:
+            procedurelogger.expectedResult('The %s is selected.' % self)
+
+        def selected():
+            return self.selected
+
+        assert utils.retryUntilTrue(selected)
 
 class Table(Accessible):
     def __getattr__(self, attr):
@@ -880,6 +904,17 @@
 
         self.grabFocus()
 
+    def assertSelected(self, log=True):
+        'Raise an exception if this tab is not selected'
+
+        if log:
+            procedurelogger.expectedResult('%s is selected.' % self)
+
+        def selected():
+            return self.selected
+
+        assert utils.retryUntilTrue(selected)
+
     def activate(self, log=True):
         'Activate (double-click) the table cell'
 



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