[Thuban-commits] r2718 - in trunk/thuban: . Thuban/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sat Jan 6 00:43:51 CET 2007


Author: dpinte
Date: 2007-01-06 00:43:49 +0100 (Sat, 06 Jan 2007)
New Revision: 2718

Modified:
   trunk/thuban/ChangeLog
   trunk/thuban/Thuban/UI/baserenderer.py
   trunk/thuban/Thuban/UI/controls.py
   trunk/thuban/Thuban/UI/tableview.py
   trunk/thuban/Thuban/UI/view.py
Log:
2007-01-06 Didrik Pinte <dpinte at itae.be>

       UTF-8 locales support reading non utf-8 files. This is a workaround and
       not a real bugfix. See
       http://wald.intevation.org/tracker/index.php?func=detail&aid=118 for
       more details

       * Thuban/UI/
       tableview.py, controls.py, baserenderer.py, view.py: decode text from
       iso-8859-1 encoding.




Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog	2007-01-01 21:44:05 UTC (rev 2717)
+++ trunk/thuban/ChangeLog	2007-01-05 23:43:49 UTC (rev 2718)
@@ -1,3 +1,14 @@
+2007-01-06 Didrik Pinte <dpinte at itae.be>
+
+	UTF-8 locales support reading non utf-8 files. This is a workaround and not
+	a real bugfix. See 
+	http://wald.intevation.org/tracker/index.php?func=detail&aid=118 for more
+	details
+
+	* Thuban/UI/ 
+	tableview.py, controls.py, baserenderer.py, view.py: decode text from
+	iso-8859-1 encoding.
+
 2007-01-01 Bernhard Reiter <bernhard at intevation.de>
 	* test/postgissupport.py, test/test_postgis_db.py: adding an 
 	explicit WITH OIDS to the create table commands. This fixes tests

Modified: trunk/thuban/Thuban/UI/baserenderer.py
===================================================================
--- trunk/thuban/Thuban/UI/baserenderer.py	2007-01-01 21:44:05 UTC (rev 2717)
+++ trunk/thuban/Thuban/UI/baserenderer.py	2007-01-05 23:43:49 UTC (rev 2718)
@@ -583,7 +583,7 @@
                 x, y = forward(x, y)
             x = int(round(x * scale + offx))
             y = int(round(-y * scale + offy))
-            width, height = self.dc.GetTextExtent(text)
+            width, height = self.dc.GetTextExtent(text.decode('iso-8859-1'))
             if label.halign == ALIGN_LEFT:
                 # nothing to be done
                 pass
@@ -598,4 +598,4 @@
                 y = y - height
             elif label.valign == ALIGN_CENTER:
                 y = y - height/2
-            self.dc.DrawText(text, x, y)
+            self.dc.DrawText(text.decode('iso-8859-1'), x, y)

Modified: trunk/thuban/Thuban/UI/controls.py
===================================================================
--- trunk/thuban/Thuban/UI/controls.py	2007-01-01 21:44:05 UTC (rev 2717)
+++ trunk/thuban/Thuban/UI/controls.py	2007-01-05 23:43:49 UTC (rev 2718)
@@ -51,7 +51,7 @@
                 name = names[i]
                 value = record[name]
                 self.InsertStringItem(i, name)
-                self.SetStringItem(i, 1, str(value))
+                self.SetStringItem(i, 1, str(value).decode('iso-8859-1'))
                 values[i] = value
 
         self.values = values

Modified: trunk/thuban/Thuban/UI/tableview.py
===================================================================
--- trunk/thuban/Thuban/UI/tableview.py	2007-01-01 21:44:05 UTC (rev 2717)
+++ trunk/thuban/Thuban/UI/tableview.py	2007-01-05 23:43:49 UTC (rev 2718)
@@ -71,7 +71,16 @@
     # Renderer understands the type too,) not just strings as in the
     # C++ version.
     def GetValue(self, row, col):
-        record = self.table.ReadRowAsDict(row, row_is_ordinal = 1)
+        try:
+            record = self.table.ReadRowAsDict(row, row_is_ordinal = 1)
+        except UnicodeError:
+            record = dict()
+            for (key, val) in self.table.ReadRowAsDict(row, \
+                              row_is_ordinal = 1).items():
+                if isinstance(val, str):
+                    record[key] = val.decode('iso-8859-1')
+                else:
+                    record[key] = val
         return record[self.columns[col][0]]
 
     def SetValue(self, row, col, value):

Modified: trunk/thuban/Thuban/UI/view.py
===================================================================
--- trunk/thuban/Thuban/UI/view.py	2007-01-01 21:44:05 UTC (rev 2717)
+++ trunk/thuban/Thuban/UI/view.py	2007-01-05 23:43:49 UTC (rev 2718)
@@ -425,7 +425,7 @@
         dc = wx.ClientDC(self)
         font = wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL)
         dc.SetFont(font)
-        return dc.GetTextExtent(text)
+        return dc.GetTextExtent(text.decode('iso-8859-1'))
 
     def LabelShapeAt(self, x, y, text=None):
         """Add or remove a label at window position x, y.



More information about the Thuban-commits mailing list