فهرست منبع

Improved error trapping for wx.Font creation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48194 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton 13 سال پیش
والد
کامیت
8e47d39352
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      gui/wxpython/gui_modules/psmap.py

+ 8 - 6
gui/wxpython/gui_modules/psmap.py

@@ -711,10 +711,13 @@ class PsMapFrame(wx.Frame):
             weight = wx.FONTWEIGHT_NORMAL
         
         try:
-            fn = wx.Font(pointSize=fontsize, family=family, style=style, weight=weight, face=face)
-            return fn
+            fn = wx.Font(pointSize=fontsize, family=wx.FONTFAMILY_DEFAULT, 
+                         style=wx.FONTSTYLE_NORMAL, weight=wx.FONTWEIGHT_NORMAL)
         except:
-            return False
+            fn = wx.Font(pointSize=10, family=family, style=style, weight=weight, face=face)
+
+        return fn
+       
        
     def getTextExtent(self, textDict):
         #fontsize = str(fontsize if fontsize >= 4 else 4)
@@ -722,12 +725,11 @@ class PsMapFrame(wx.Frame):
        
         fn = self.makePSFont(textDict)
 
-        if fn:
+        try:
             dc.SetFont(fn)
             w,h,lh = dc.GetMultiLineTextExtent(textDict['text'])
             return (w,h)
-#            return dc.GetTextExtent(textDict['text'])
-        else:
+        except:
             return (0,0)
     
     def getInitMap(self):