commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r6918 - trunk/gnue-forms/src/uidrivers/wx


From: jan
Subject: [gnue] r6918 - trunk/gnue-forms/src/uidrivers/wx
Date: Sun, 23 Jan 2005 16:24:54 -0600 (CST)

Author: jan
Date: 2005-01-23 16:24:53 -0600 (Sun, 23 Jan 2005)
New Revision: 6918

Modified:
   trunk/gnue-forms/src/uidrivers/wx/UIWXSplashScreen.py
   trunk/gnue-forms/src/uidrivers/wx/common.py
Log:
Adapt code to work with wxWidgets Ver > 2.4 in Unicode mode


Modified: trunk/gnue-forms/src/uidrivers/wx/UIWXSplashScreen.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/UIWXSplashScreen.py       2005-01-23 
22:23:09 UTC (rev 6917)
+++ trunk/gnue-forms/src/uidrivers/wx/UIWXSplashScreen.py       2005-01-23 
22:24:53 UTC (rev 6918)
@@ -38,6 +38,7 @@
 
 from gnue.common.apps import GConfig
 from gnue.forms import VERSION
+from common import wxEncode
 
 class UIWXSplashScreen(SplashScreen):
   def __init__(self):
@@ -65,25 +66,25 @@
     self.SetForegroundColour(wxColour(0xFF, 0xFF, 0xFF))
     self.SetFont(wxFont(20,wxSWISS,wxNORMAL,wxBOLD))
 
-    text = _("GNU Enterprise Forms")
+    text = wxEncode(u_("GNU Enterprise Forms"))
     twidth,theight = self.GetTextExtent(text)
-    wxStaticText(parent=self, id=-1, label=str(text),
+    wxStaticText(parent=self, id=-1, label=text,
                  
size=wxSize(swidth,theight),pos=wxPoint(1,1),style=wxALIGN_CENTRE)
 
     self.SetFont(wxFont(10,wxSWISS,wxNORMAL,wxBOLD))
     
-    text = _("Version %s") % VERSION
+    text = wxEncode(u_("Version %s") % VERSION)
     twidth,theight = self.GetTextExtent(text)
-    wxStaticText(parent=self, id=-1, label=str(text),
+    wxStaticText(parent=self, id=-1, label=text,
                  size=wxSize(swidth,theight), 
pos=wxPoint(1,25),style=wxALIGN_CENTRE)
 
-    text = "(c)2000-2004 Free Software Foundation"
+    text = wxEncode(u_("(c)2000-2004 Free Software Foundation"))
     twidth,theight = self.GetTextExtent(text)
-    wxStaticText(self, -1, str(text),
+    wxStaticText(self, -1, text,
                  wxPoint(1,50),wxSize(swidth,theight),wxALIGN_CENTRE)
 
-    text = _("Protected by GNU General Public Licence 2.0")
-    wxStaticText(self, -1, str(text),
+    text = wxEncode(u_("Protected by GNU General Public Licence 2.0"))
+    wxStaticText(self, -1, text,
                  
wxPoint(1,sheight-(theight+10)),wxSize(swidth-5,theight),wxALIGN_RIGHT)
 
     self.CenterOnScreen()

Modified: trunk/gnue-forms/src/uidrivers/wx/common.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx/common.py 2005-01-23 22:23:09 UTC (rev 
6917)
+++ trunk/gnue-forms/src/uidrivers/wx/common.py 2005-01-23 22:24:53 UTC (rev 
6918)
@@ -32,6 +32,7 @@
 import string
 from types import UnicodeType, StringType
 from wxPython.wx import *
+import wx
 from gnue.common import events
 from gnue.common.apps import GDebug
 
@@ -111,8 +112,17 @@
     widget.SetFont(wxFont(int (getPointSize()), wxMODERN,wxNORMAL,\
                           wxNORMAL,FALSE,getFaceName(),enc))
 
+#
+# Disable En/Decoding in Unicode mode (wx>2.5)
+#
+if wx.VERSION >= (2,5) and \
+  "unicode" in wx.PlatformInfo:
 
-def wxEncode(u_string):    
+  def wxEncode(u_string):
+    return u_string
+
+else:
+  def wxEncode(u_string):    
     if type(u_string)==UnicodeType:
         return u_string.encode(gConfig('textEncoding'),'replace')
     else:





reply via email to

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