dabo Commit
Revision 4337
Date: 2008-08-02 16:56:05 -0700 (Sat, 02 Aug 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4337

Changed:
U   trunk/ide/ClassDesignerComponents.py

Log:
Fixed a problem when copying/saving labels. The AutoResize was changing the 
Width, causing it to be saved, which prevents AutoResize from working properly 
after that. With this change, the Width and Height are not copied or saved if 
AutoResize is True and it matches the fontMetric.


Diff:
Modified: trunk/ide/ClassDesignerComponents.py
===================================================================
--- trunk/ide/ClassDesignerComponents.py        2008-08-02 23:07:34 UTC (rev 
4336)
+++ trunk/ide/ClassDesignerComponents.py        2008-08-02 23:56:05 UTC (rev 
4337)
@@ -145,6 +145,18 @@
                        if (hasSizer or isinstance(self, dabo.ui.dPage) or 
isSplitPanel) and prop in ("Width",
                                        "Height") and 
self.ControllingSizer.getItemProp(self, "Expand"):
                                continue
+                       if isinstance(self, dabo.ui.dLabel) and prop in 
("Width", "Height"):
+                               # Don't copy the size if AutoSize=True and the 
width is close to the default size.
+                               if self.AutoResize:
+                                       defWd, defHt = 
dabo.ui.fontMetric(wind=self)
+                                       isDefaultSize = False
+                                       if prop == "Width":
+                                               isDefaultSize = (abs(self.Width 
- defWd) <= 1)
+                                       elif prop == "Height":
+                                               isDefaultSize = 
(abs(self.Height - defHt) <= 1)
+                                       if isDefaultSize:
+                                               # ignore it.
+                                               continue
                        if prop == "BackColor" and isinstance(self, 
(LayoutPanel, LayoutSpacerPanel)):
                                continue
 




_______________________________________________
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]

Reply via email to