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

Changed:
U   trunk/dabo/ui/uiwx/dFont.py

Log:
Fixes the problem that was exposed when trying to add a treeview control in the 
Class Designer. There are several places where we assume that the nativeFont 
has been set; this handles the cases where it hasn't.


Diff:
Modified: trunk/dabo/ui/uiwx/dFont.py
===================================================================
--- trunk/dabo/ui/uiwx/dFont.py 2008-08-02 21:29:01 UTC (rev 4335)
+++ trunk/dabo/ui/uiwx/dFont.py 2008-08-02 23:07:34 UTC (rev 4336)
@@ -25,7 +25,9 @@
 
        
        def _getBold(self):
-               return (self._nativeFont.GetWeight() == wx.FONTWEIGHT_BOLD)
+               if self._nativeFont:
+                       return (self._nativeFont.GetWeight() == 
wx.FONTWEIGHT_BOLD)
+               return False
 
        def _setBold(self, val):
                if val:
@@ -45,7 +47,9 @@
 
 
        def _getFace(self):
-               return self._nativeFont.GetFaceName()
+               if self._nativeFont:
+                       return self._nativeFont.GetFaceName()
+               return ""
 
        def _setFace(self, val):
                if not val:
@@ -86,7 +90,9 @@
 
 
        def _getItalic(self):
-               return (self._nativeFont.GetStyle() == wx.FONTSTYLE_ITALIC)
+               if self._nativeFont:
+                       return (self._nativeFont.GetStyle() == 
wx.FONTSTYLE_ITALIC)
+               return False
 
        def _setItalic(self, val):
                if val:
@@ -101,7 +107,10 @@
                        multiplier = .75
                else:
                        multiplier = 1          
-               return multiplier * self._nativeFont.GetPointSize()
+               if self._nativeFont:
+                       return multiplier * self._nativeFont.GetPointSize()
+               # No native font yet; return a reasonable default.
+               return 9
 
        def _setSize(self, val):
                try:
@@ -125,7 +134,9 @@
 
 
        def _getUnderline(self):
-               return self._nativeFont.GetUnderlined()
+               if self._nativeFont:
+                       return self._nativeFont.GetUnderlined()
+               return False
 
        def _setUnderline(self, val):
                self._nativeFont.SetUnderlined(val)




_______________________________________________
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