[GRASS-SVN] r41581 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 27 17:31:43 EDT 2010


Author: martinl
Date: 2010-03-27 17:31:41 -0400 (Sat, 27 Mar 2010)
New Revision: 41581

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
Log:
wxGUI/dbm: unicode bug fix


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2010-03-27 18:26:23 UTC (rev 41580)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm.py	2010-03-27 21:31:41 UTC (rev 41581)
@@ -58,21 +58,6 @@
 from dbm_dialogs import ModifyTableRecord
 from preferences import globalSettings as UserSettings
 
-def unicodeValue(value):
-    """!Encode value"""
-    enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
-    if enc:
-        value = unicode(value, enc)
-    elif os.environ.has_key('GRASS_DB_ENCODING'):
-        value = unicode(value, os.environ['GRASS_DB_ENCODING'])
-    else:
-        try:
-            value = unicode(value, 'ascii')
-        except UnicodeDecodeError:
-            value = _("Unable to decode value. Set encoding in GUI preferences ('Attributes').")
-    
-    return value
-
 class Log:
     """
     The log output is redirected to the status bar of the containing frame.
@@ -301,7 +286,7 @@
             else:
                 # encode string values
                 try:
-                    self.itemDataMap[i].append(unicodeValue(value))
+                    self.itemDataMap[i].append(dbm_base.unicodeValue(value))
                 except UnicodeDecodeError:
                     self.itemDataMap[i].append(_("Unable to decode value. "
                                                  "Set encoding in GUI preferences ('Attributes')."))

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py	2010-03-27 18:26:23 UTC (rev 41580)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/dbm_base.py	2010-03-27 21:31:41 UTC (rev 41581)
@@ -21,7 +21,23 @@
 
 import gselect
 import gcmd
+from preferences import globalSettings as UserSettings
 
+def unicodeValue(value):
+    """!Encode value"""
+    enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
+    if enc:
+        value = unicode(value, enc)
+    elif os.environ.has_key('GRASS_DB_ENCODING'):
+        value = unicode(value, os.environ['GRASS_DB_ENCODING'])
+    else:
+        try:
+            value = unicode(value, 'ascii')
+        except UnicodeDecodeError:
+            value = _("Unable to decode value. Set encoding in GUI preferences ('Attributes').")
+    
+    return value
+
 def createDbInfoDesc(panel, mapDBInfo, layer):
     """!Create database connection information content"""
     infoFlexSizer = wx.FlexGridSizer (cols=2, hgap=1, vgap=1)



More information about the grass-commit mailing list