dabo Commit
Revision 4614
Date: 2008-10-26 16:57:49 -0700 (Sun, 26 Oct 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4614
Changed:
U trunk/dabo/ui/uiwx/dLabel.py
Log:
Fixes the issues noted in Trac #1114: WordWrap was not showing properly on Mac
and Windows when a label was initially shown.
Diff:
Modified: trunk/dabo/ui/uiwx/dLabel.py
===================================================================
--- trunk/dabo/ui/uiwx/dLabel.py 2008-10-26 17:20:59 UTC (rev 4613)
+++ trunk/dabo/ui/uiwx/dLabel.py 2008-10-26 23:57:49 UTC (rev 4614)
@@ -16,6 +16,7 @@
def __init__(self, parent, properties=None, attProperties=None, *args,
**kwargs):
self._baseClass = dLabel
self._wordWrap = False
+ self._inResizeEvent = False
preClass = wx.PreStaticText
cm.dControlMixin.__init__(self, preClass, parent, properties,
attProperties,
*args, **kwargs)
@@ -25,12 +26,34 @@
"""Event binding is set when Wrap=True. Tell the label
to wrap to its current width.
"""
- dabo.ui.callAfterInterval(50, self.__onResizeExecute)
+ if self._inResizeEvent:
+ return
+ self._inResizeEvent = True
+ dabo.ui.callAfter(self.__onResizeExecute)
def __onResizeExecute(self):
# We need to set the caption to the internally-saved caption,
since
# WordWrap can introduce additional linefeeds.
+ self.Form.lockDisplay()
+ plat = self.Application.Platform
+ try:
+ first = self._firstResizeEvent
+ except AttributeError:
+ first = True
+ self._firstResizeEvent = False
+ if plat == "Win":
+ self.InvalidateBestSize()
+ self.Parent.layout()
+ self.Parent.layout()
self.SetLabel(self._caption)
self.Wrap(self.Width)
+ if plat == "Win":
+ self.Width, self.Height = self.GetBestSize().Get()
+ elif plat == "Mac":
+ self.Parent.layout()
+ self.SetLabel(self._caption)
+ self.Wrap(self.Width)
+ self._inResizeEvent = False
+ self.Form.unlockDisplay()
# property get/set functions
_______________________________________________
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]