[GRASS-SVN] r36380 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 14 10:37:28 EDT 2009


Author: martinl
Date: 2009-03-14 10:37:27 -0400 (Sat, 14 Mar 2009)
New Revision: 36380

Modified:
   grass/trunk/gui/wxpython/gui_modules/dbm.py
Log:
wxGUI: dbm.py synchronized with relbr64


Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2009-03-14 14:34:50 UTC (rev 36379)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2009-03-14 14:37:27 UTC (rev 36380)
@@ -3142,24 +3142,18 @@
 
     def OnSubmit(self, event):
         """Submit records"""
-        sqlCommands = self.GetSQLString(updateValues=True)
-        if len(sqlCommands) > 0:
-            sqlFile = tempfile.NamedTemporaryFile(mode="w")
-            for sql in sqlCommands:
-                enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
-                if not enc and \
-                        os.environ.has_key('GRASS_DB_ENCODING'):
-                    enc = os.environ['GRASS_DB_ENCODING']
-                if enc:
-                    sqlFile.file.write(sql.encode(enc))
-                else:
-                    sqlFile.file.write(sql)
-                sqlFile.file.write(os.linesep)
-                sqlFile.file.flush()
-                gcmd.RunCommand('db.execute',
-                                quiet = True,
-                                input = sqlFile.name)
-
+        for sql in self.GetSQLString(updateValues=True):
+            enc = UserSettings.Get(group='atm', key='encoding', subkey='value')
+            if not enc and \
+                    os.environ.has_key('GRASS_DB_ENCODING'):
+                enc = os.environ['GRASS_DB_ENCODING']
+            if enc:
+                sql = sql.encode(enc)
+            
+            gcmd.RunCommand('db.execute',
+                            quiet = True,
+                            stdin = sql)
+        
         if self.closeDialog.IsChecked():
             self.OnCancel(event)
 
@@ -3378,6 +3372,12 @@
         Return line id or None if no line is found"""
         line = None
         nselected = 0
+        
+        if os.environ.has_key("LC_ALL"):
+            locale = os.environ["LC_ALL"]
+            os.environ["LC_ALL"] = "C"
+        
+        ### FIXME (implement script-style output)        
         ret = gcmd.RunCommand('v.what',
                               quiet = True,
                               read = True,
@@ -3387,6 +3387,9 @@
                                   (float(queryCoords[0]), float(queryCoords[1])),
                               distance = float(qdist))
         
+        if os.environ.has_key("LC_ALL"):
+            os.environ["LC_ALL"] = locale
+        
         data = {}
         if ret:
             readAttrb = False



More information about the grass-commit mailing list