Update of /cvsroot/pythoncard/PythonCard/components
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1660/components
Modified Files:
notebook.py
Log Message:
added stringSelection attribute to match list, choice, etc.
Index: notebook.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/components/notebook.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** notebook.py 14 Sep 2004 17:28:45 -0000 1.1
--- notebook.py 16 Sep 2004 04:42:29 -0000 1.2
***************
*** 59,62 ****
--- 59,80 ----
self._bindEvents(self._spec._events)
+ def _getPageNames(self):
+ names = []
+ for i in range(self.GetPageCount()):
+ names.append(self.GetPageText(i))
+ return names
+
+ def _getStringSelection(self):
+ return self.GetPageText(self.GetSelection())
+
+ def _setStringSelection(self, s):
+ names = self._getPageNames()
+ try:
+ self.SetSelection(names.index(s))
+ except:
+ # what kind of exception should we throw here for
+ # an invalid string selection?
+ pass
+
# KEA 2004-09-14
# rather than using all these methods there could
***************
*** 80,83 ****
--- 98,102 ----
selection = property(wx.Notebook.GetSelection, wx.Notebook.SetSelection)
+ stringSelection = property(_getStringSelection, _setStringSelection)
|