Browse Source

wxGUI: fix wxplot modules (after major code reorganization)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49432 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
4e8b50eeff
3 changed files with 27 additions and 25 deletions
  1. 3 3
      gui/wxpython/wxplot/base.py
  2. 12 11
      gui/wxpython/wxplot/histogram.py
  3. 12 11
      gui/wxpython/wxplot/scatter.py

+ 3 - 3
gui/wxpython/wxplot/base.py

@@ -167,11 +167,11 @@ class BasePlotFrame(wx.Frame):
             except:
                 continue
                 # if r.info cannot parse map, skip it
-                
+               
             self.raster[r] = UserSettings.Get(group = plottype, key = 'raster') # some default settings
             rdict[r] = {} # initialize sub-dictionaries for each raster in the list
-
-            if ret['units'] == '(none)' or ret['units'] == '' or ret['units'] == None:
+            
+            if ret['units'] in ('(none)', '"none"', '', None):
                 rdict[r]['units'] = ''
             else:
                 self.raster[r]['units'] = ret['units']

+ 12 - 11
gui/wxpython/wxplot/histogram.py

@@ -26,6 +26,7 @@ from gui_core.toolbars import BaseToolbar
 from wxplot.base       import BasePlotFrame
 from icons.icon        import Icons
 from wxplot.dialogs    import HistRasterDialog, PlotStatsFrame
+from core.gcmd         import RunCommand, GException, GError
 
 class Histogram2Frame(BasePlotFrame):
     def __init__(self, parent, id, pos, style, size, rasterList = []):
@@ -141,14 +142,14 @@ class Histogram2Frame(BasePlotFrame):
         if self.histtype == 'area': freqflag = 'an'
                 
         try:
-            ret = gcmd.RunCommand("r.stats",
-                                  parent = self,
-                                  input = raster,
-                                  flags = freqflag,
-                                  nsteps = self.bins,
-                                  fs = ',',
-                                  quiet = True,
-                                  read = True)
+            ret = RunCommand("r.stats",
+                             parent = self,
+                             input = raster,
+                             flags = freqflag,
+                             nsteps = self.bins,
+                             fs = ',',
+                             quiet = True,
+                             read = True)
             
             if not ret:
                 return datalist
@@ -164,9 +165,9 @@ class Histogram2Frame(BasePlotFrame):
                 datalist.append((cellval,histval))
 
             return datalist
-        except gcmd.GException, e:
-            gcmd.GError(parent = self,
-                        message = e.value)
+        except GException, e:
+            GError(parent = self,
+                   message = e.value)
             return None
         
     def CreatePlotList(self):

+ 12 - 11
gui/wxpython/wxplot/scatter.py

@@ -26,6 +26,7 @@ from wxplot.base       import BasePlotFrame
 from gui_core.toolbars import BaseToolbar
 from icons.icon        import Icons
 from wxplot.dialogs    import ScatterRasterDialog, PlotStatsFrame
+from core.gcmd         import RunCommand, GException, GError
 
 class ScatterFrame(BasePlotFrame):
     """!Mainframe for displaying bivariate scatter plot of two raster maps. Uses wx.lib.plot.
@@ -163,14 +164,14 @@ class ScatterFrame(BasePlotFrame):
             freqflag = 'n'
                 
         try:
-            ret = gcmd.RunCommand("r.stats",
-                                  parent = self,
-                                  input = '%s,%s' % rpair,
-                                  flags = freqflag,
-                                  nsteps = self.bins,
-                                  fs = ',',
-                                  quiet = True,
-                                  read = True)
+            ret = RunCommand("r.stats",
+                             parent = self,
+                             input = '%s,%s' % rpair,
+                             flags = freqflag,
+                             nsteps = self.bins,
+                             fs = ',',
+                             quiet = True,
+                             read = True)
             
             if not ret:
                 return datalist
@@ -188,9 +189,9 @@ class ScatterFrame(BasePlotFrame):
                 datalist.append((rast1,rast2))
 
             return datalist
-        except gcmd.GException, e:
-            gcmd.GError(parent = self,
-                        message = e.value)
+        except GException, e:
+            GError(parent = self,
+                   message = e.value)
             return None
         
     def CreatePlotList(self):