[GRASS-SVN] r65517 - in grass/branches/releasebranch_7_0/gui/wxpython: iclass iscatt

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 22 07:46:41 PDT 2015


Author: annakrat
Date: 2015-06-22 07:46:41 -0700 (Mon, 22 Jun 2015)
New Revision: 65517

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/iclass/frame.py
   grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py
   grass/branches/releasebranch_7_0/gui/wxpython/iscatt/core_c.py
   grass/branches/releasebranch_7_0/gui/wxpython/iscatt/iscatt_core.py
Log:
wxGUI/iclass: fix basic functionality for Windows (merge from trunk, r65506)

Modified: grass/branches/releasebranch_7_0/gui/wxpython/iclass/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/iclass/frame.py	2015-06-22 08:52:49 UTC (rev 65516)
+++ grass/branches/releasebranch_7_0/gui/wxpython/iclass/frame.py	2015-06-22 14:46:41 UTC (rev 65517)
@@ -675,7 +675,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])
@@ -744,8 +744,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
@@ -767,15 +767,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
         
@@ -1120,8 +1120,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/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py	2015-06-22 08:52:49 UTC (rev 65516)
+++ grass/branches/releasebranch_7_0/gui/wxpython/iscatt/controllers.py	2015-06-22 14:46:41 UTC (rev 65517)
@@ -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/branches/releasebranch_7_0/gui/wxpython/iscatt/core_c.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/iscatt/core_c.py	2015-06-22 08:52:49 UTC (rev 65516)
+++ grass/branches/releasebranch_7_0/gui/wxpython/iscatt/core_c.py	2015-06-22 14:46:41 UTC (rev 65517)
@@ -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/branches/releasebranch_7_0/gui/wxpython/iscatt/iscatt_core.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/iscatt/iscatt_core.py	2015-06-22 08:52:49 UTC (rev 65516)
+++ grass/branches/releasebranch_7_0/gui/wxpython/iscatt/iscatt_core.py	2015-06-22 14:46:41 UTC (rev 65517)
@@ -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