[GRASS-SVN] r65506 - in grass/trunk/gui/wxpython: iclass iscatt

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 20 14:42:54 PDT 2015


Author: annakrat
Date: 2015-06-20 14:42:54 -0700 (Sat, 20 Jun 2015)
New Revision: 65506

Modified:
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/iscatt/controllers.py
   grass/trunk/gui/wxpython/iscatt/core_c.py
   grass/trunk/gui/wxpython/iscatt/iscatt_core.py
Log:
wxGUI/iclass: fix basic functionality for Windows

Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2015-06-20 12:01:04 UTC (rev 65505)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2015-06-20 21:42:54 UTC (rev 65506)
@@ -676,7 +676,7 @@
                                  layer = 1,
                                  columns = ','.join(columns),
                                  read = True)
-            records = ret.strip().split('\n')
+            records = ret.strip().splitlines()
             for record in records:
                 record = record.split('|')
                 listCtrl.AddCategory(cat = int(record[0]), name = record[1], color = record[2])
@@ -745,8 +745,8 @@
         except KeyError:
             wx.EndBusyCursor()
             return False
-        
-        dbFile = tempfile.NamedTemporaryFile(mode = 'w')
+
+        dbFile = tempfile.NamedTemporaryFile(mode='w', delete=False)
         if dbInfo['driver'] != 'dbf':
             dbFile.write("BEGIN\n")
         # populate table
@@ -768,15 +768,15 @@
                 
         if dbInfo['driver'] != 'dbf':
             dbFile.write("COMMIT\n")
-        dbFile.file.flush()
-        
-        if 0 != RunCommand('db.execute', input=dbFile.name, driver=dbInfo['driver'], database=dbInfo['database']):
-            wx.EndBusyCursor()
-            return False
+        dbFile.file.close()
 
+        ret = RunCommand('db.execute', input=dbFile.name, driver=dbInfo['driver'], database=dbInfo['database'])
         wx.EndBusyCursor()
+        os.remove(dbFile.name)
+        if ret != 0:
+            return False
         return True
-    
+
     def _runDBUpdate(self, tmpFile, table, column, value, cat):
         """Helper function for UPDATE statement
         
@@ -1121,8 +1121,8 @@
                          flags = 'g',
                          group = group,
                          read = True, **kwargs).strip()
-        if res.split('\n')[0]:
-            return sorted(res.split('\n'))
+        if res.splitlines()[0]:
+            return sorted(res.splitlines())
         
         return []
     

Modified: grass/trunk/gui/wxpython/iscatt/controllers.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/controllers.py	2015-06-20 12:01:04 UTC (rev 65505)
+++ grass/trunk/gui/wxpython/iscatt/controllers.py	2015-06-20 21:42:54 UTC (rev 65506)
@@ -1106,6 +1106,6 @@
                          group = group,
                          read = True, **kwargs).strip()
 
-        if res.split('\n')[0]:
-            bands = res.split('\n')
+        if res.splitlines()[0]:
+            bands = res.splitlines()
             self.scatt_mgr.SetBands(bands)

Modified: grass/trunk/gui/wxpython/iscatt/core_c.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/core_c.py	2015-06-20 12:01:04 UTC (rev 65505)
+++ grass/trunk/gui/wxpython/iscatt/core_c.py	2015-06-20 21:42:54 UTC (rev 65506)
@@ -155,7 +155,7 @@
                     'ewres' : 'ew_res'}
 
     for k, v in region.iteritems():
-        if k in ["rows", "cols", "cells"]:
+        if k in ["rows", "cols", "cells", "zone"]:  # zone added in r65224
             v = int(v)
         else:
             v = float(v)

Modified: grass/trunk/gui/wxpython/iscatt/iscatt_core.py
===================================================================
--- grass/trunk/gui/wxpython/iscatt/iscatt_core.py	2015-06-20 12:01:04 UTC (rev 65505)
+++ grass/trunk/gui/wxpython/iscatt/iscatt_core.py	2015-06-20 21:42:54 UTC (rev 65506)
@@ -831,7 +831,7 @@
     if  ret != 0:
         raise GException("r.info failed:\n%s" % msg)
 
-    out = out.split("\n")
+    out = out.splitlines()
     raster_info = {} 
 
     for b in out:



More information about the grass-commit mailing list