commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7102 - in trunk/gnue-forms/src: . uidrivers/wx


From: kilo
Subject: [gnue] r7102 - in trunk/gnue-forms/src: . uidrivers/wx
Date: Mon, 7 Mar 2005 08:09:19 -0600 (CST)

Author: kilo
Date: 2005-03-07 08:09:18 -0600 (Mon, 07 Mar 2005)
New Revision: 7102

Modified:
   trunk/gnue-forms/src/GFConfig.py
   trunk/gnue-forms/src/uidrivers/wx/common.py
Log:
WX now properly handles fixed/non-fixed width font setting.
Proper font size handling is also added.

Modified: trunk/gnue-forms/src/GFConfig.py
===================================================================
--- trunk/gnue-forms/src/GFConfig.py    2005-03-07 07:14:11 UTC (rev 7101)
+++ trunk/gnue-forms/src/GFConfig.py    2005-03-07 14:09:18 UTC (rev 7102)
@@ -345,7 +345,7 @@
     'Description': 'If fixedWidthFont is set to true, then this is the '
                  + 'point size used for fonts.',
     'Typecast'   : GTypecast.whole,
-    'Default'    : 14 },
+    'Default'    : 0 },
 
   { 'Name'       : 'faceName',
     'Type'       : 'Setting',

Modified: trunk/gnue-forms/src/uidrivers/wx/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/common.py 2005-03-07 07:14:11 UTC (rev 
7101)
+++ trunk/gnue-forms/src/uidrivers/wx/common.py 2005-03-07 14:09:18 UTC (rev 
7102)
@@ -89,6 +89,10 @@
   return _pointSize or setPointSize(gConfigForms('pointSize'))
 
 def setPointSize(size):
+  #If no point size is given in the config file, fetch system font size
+  if size == 0:
+    size = wxSystemSettings_GetFont(wxSYS_SYSTEM_FONT).GetPointSize()
+    
   global _pointSize
   _pointSize = size
   return size
@@ -102,16 +106,18 @@
   return name
 
 def initFont(widget, affectsLayout=1):
-  if gConfigForms('fixedWidthFont'):
-    try:
-      enc=encodings[gConfigForms('textEncoding')]
-    except:
-      gDebug (1, u_('Encoding %s is not supported by the wx UI driver') % \
-                            gConfigForms('textEncoding'))
-      enc=encodings['iso8859-1']
-    widget.SetFont(wxFont(int (getPointSize()), wxMODERN,wxNORMAL,\
-                          wxNORMAL,FALSE,getFaceName(),enc))
-
+  try:
+    enc=encodings[gConfigForms('textEncoding')]
+  except:
+    gDebug (1, u_('Encoding %s is not supported by the wx UI driver') % \
+                          gConfigForms('textEncoding'))
+    enc=encodings['iso8859-1']
+  
+  #wxMODERN is a fixed pitch font, wxSWISS is a sans-serif font.
+  fontFamily = gConfigForms('fixedWidthFont') and wxMODERN or wxSWISS
+  widget.SetFont(wxFont(int(getPointSize()), fontFamily, wxNORMAL,\
+                        wxNORMAL, FALSE, getFaceName(), enc))
+    
 #
 # Disable En/Decoding in Unicode mode (wx>2.5)
 #





reply via email to

[Prev in Thread] Current Thread [Next in Thread]