dabo Commit
Revision 6641
Date: 2011-06-30 01:38:53 -0700 (Thu, 30 Jun 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6641
Changed:
U trunk/dabo/ui/uiwx/dPage.py
Log:
Changes:
- added display locking on item creation
- added DeferredUpdates property to handle delayed updates, until page become
selected
- Caption property return default caption if not set in parent.
Diff:
Modified: trunk/dabo/ui/uiwx/dPage.py
===================================================================
--- trunk/dabo/ui/uiwx/dPage.py 2011-06-28 15:07:21 UTC (rev 6640)
+++ trunk/dabo/ui/uiwx/dPage.py 2011-06-30 08:38:53 UTC (rev 6641)
@@ -11,6 +11,8 @@
"""Creates a page to appear as a tab in a pageframe."""
def __init__(self, *args, **kwargs):
self._caption = ""
+ self._pendingUpdates = False
+ self._deferredUpdates = False
kwargs["AlwaysResetSizer"] = self._extractKey(kwargs,
"AlwaysResetSizer", True)
super(dPage, self).__init__(*args, **kwargs)
self._baseClass = dPage
@@ -40,9 +42,11 @@
def _createItems(self):
+ self.lockDisplay()
self.createItems()
self.itemsCreated = True
self.layout()
+ self.unlockDisplay()
def createItems(self):
@@ -55,9 +59,24 @@
pass
+ def update(self):
+ if self.DeferredUpdates:
+ try:
+ if self.Parent.SelectedPage == self:
+ self._pendingUpdates = False
+ else:
+ self._pendingUpdates = True
+ return
+ except (ValueError, AttributeError):
+ pass
+ super(dPage, self).update()
+
+
def __onPageEnter(self, evt):
if not self.itemsCreated:
self._createItems()
+ if self._pendingUpdates:
+ self.update()
def __onPageLeave(self, evt):
@@ -82,6 +101,8 @@
pos = self._getPagePosition()
if pos > -1:
ret = self.Parent.GetPageText(pos)
+ if not ret:
+ ret = self._caption
return ret
def _setCaption(self, val):
@@ -94,6 +115,13 @@
self._properties["Caption"] = val
+ def _getDeferredUpdates(self):
+ return self._deferredUpdates
+
+ def _setDeferredUpdates(self, val):
+ self._deferredUpdates = val
+
+
def _getImage(self):
return self.Parent.getPageImage(self)
@@ -105,14 +133,17 @@
Caption = property(_getCaption, _setCaption, None,
- _("The text identifying this particular page. (str)") )
+ _("The text identifying this particular page. (str)"))
+ DeferredUpdates = property(_getDeferredUpdates, _setDeferredUpdates,
None,
+ _("Allow to defer controls updates until page become
active. (bool)"))
+
Image = property(_getImage, _setImage, None,
_("""Sets the image that is displayed on the page tab.
This is
determined by the key value passed, which must refer to
an
image already added to the parent pageframe.
When used to retrieve an image, it returns the index of
the
- page's image in the parent pageframe's image list.
(int)""") )
+ page's image in the parent pageframe's image list.
(int)"""))
DynamicCaption = makeDynamicProperty(Caption)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]