Bläddra i källkod

wxgui: update to fix situation when scatterplot is launched with one map displayed

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48648 15284696-431f-4ddb-bdfa-cd5b030d7da7
Michael Barton 13 år sedan
förälder
incheckning
6738d6918c
2 ändrade filer med 10 tillägg och 5 borttagningar
  1. 5 2
      gui/wxpython/gui_modules/wxplot.py
  2. 5 3
      gui/wxpython/gui_modules/wxplot_dialogs.py

+ 5 - 2
gui/wxpython/gui_modules/wxplot.py

@@ -1052,7 +1052,7 @@ class ScatterFrame(AbstractPlotFrame):
                     "aqua", "grey", "orange", "brown", "purple", "violet", \
                     "indigo"]
         
-        if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
+        if len(self.rasterList) > 1: # set raster name(s) from layer manager if a map is selected
             self.InitRasterOpts(self.rasterList, 'scatter')
 
         self._initOpts()
@@ -1080,7 +1080,10 @@ class ScatterFrame(AbstractPlotFrame):
 
         if dlg.ShowModal() == wx.ID_OK:
             rlist = dlg.rasterList
-            if rlist < 2: return                        # need at least 2 rasters for scatterplot
+            if rlist < 2: 
+                dlg.Destroy()
+                return                        # need at least 2 rasters for scatterplot
+
             self.bins = dlg.bins                        # bins for r.stats with float and dcell maps
             self.scattertype = dlg.scattertype          # scatterplot or bubbleplot
             self.rasterList = self.CreatePairs(rlist)   # list of raster pairs (tuples)

+ 5 - 3
gui/wxpython/gui_modules/wxplot_dialogs.py

@@ -138,7 +138,10 @@ class ScatterRasterDialog(wx.Dialog):
         rastText = ''
         if len(self.rasterList) > 0:
             for r in self.rasterList:
-                rastText += '%s,%s,' % r
+                if isinstance(r, tuple):
+                    rastText += '%s,%s,' % r
+                else:
+                    rastText += '%s,' % r
             rastText = rastText.rstrip(',')
         
         # select rasters
@@ -1140,5 +1143,4 @@ class OptDialog(wx.Dialog):
     def OnCancel(self, event):
         """!Button 'Cancel' pressed"""
         self.Close()
-
-#### merge with generic options dialog        
+