[GRASS-SVN] r53026 - in grass/trunk/gui/wxpython: core wxplot

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 31 10:14:23 PDT 2012


Author: cmbarton
Date: 2012-08-31 10:14:22 -0700 (Fri, 31 Aug 2012)
New Revision: 53026

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/wxplot/base.py
   grass/trunk/gui/wxpython/wxplot/dialogs.py
   grass/trunk/gui/wxpython/wxplot/histogram.py
   grass/trunk/gui/wxpython/wxplot/profile.py
   grass/trunk/gui/wxpython/wxplot/scatter.py
Log:
Fix for broken plotting modules

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/core/settings.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -535,7 +535,7 @@
                     },
                 },
              'scatter': {
-                'rasters' : {
+                'raster' : {
                     'pcolor' : (0, 0, 255, 255),
                     'pfill' : 'solid',
                     'psize' : 1,

Modified: grass/trunk/gui/wxpython/wxplot/base.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/base.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/wxplot/base.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -51,7 +51,7 @@
 
         wx.Frame.__init__(self, parent, id, size = size, style = style, **kwargs)
         
-        self.parent = parent            # MapFrame
+        self.parent = parent            # MapFrame for a plot type
         self.mapwin = self.parent.MapWindow
         self.Map    = Map()             # instance of render.Map to be associated with display
         self.rasterList = rasterList    #list of rasters to plot
@@ -124,6 +124,8 @@
     def InitPlotOpts(self, plottype):
         """!Initialize options for entire plot
         """
+ 
+ ## change get more saved values for initialization
         
         self.plottype = plottype                # histogram, profile, or scatter
 
@@ -134,11 +136,17 @@
                                                     wx.FONTSTYLE_NORMAL,
                                                     wx.FONTWEIGHT_NORMAL)
         
+        self.properties['raster'] = {}
+        self.properties['raster'] = UserSettings.Get(group = self.plottype, key = 'raster')
+        colstr = str(self.properties['raster']['pcolor'])
+        self.properties['raster']['pcolor'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
+
         if self.plottype == 'profile':
             self.properties['marker'] = UserSettings.Get(group = self.plottype, key = 'marker')
             # changing color string to tuple for markers/points
             colstr = str(self.properties['marker']['color'])
             self.properties['marker']['color'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
+ 
 
         self.properties['grid'] = UserSettings.Get(group = self.plottype, key = 'grid')        
         colstr = str(self.properties['grid']['color']) # changing color string to tuple        
@@ -176,6 +184,9 @@
 
         rdict = {} # initialize a dictionary
 
+#        self.properties['raster'] = {}
+        self.properties['raster'] = UserSettings.Get(group = self.plottype, key = 'raster')
+
         for r in rasterList:
             idx = rasterList.index(r)
             
@@ -185,9 +196,8 @@
                 continue
                 # if r.info cannot parse map, skip it
                
-            self.raster[r] = UserSettings.Get(group = plottype, key = 'raster') # some default settings
+            self.raster[r] = self.properties['raster'] # some default settings
             rdict[r] = {} # initialize sub-dictionaries for each raster in the list
-
             
             rdict[r]['units'] = ''
             if ret['units'] not in ('(none)', '"none"', '', None):
@@ -197,11 +207,32 @@
             rdict[r]['datalist'] = [] # list of cell value,frequency pairs for plotting histogram
             rdict[r]['pline'] = None
             rdict[r]['datatype'] = ret['datatype']
-            rdict[r]['pwidth'] = 1
-            rdict[r]['pstyle'] = 'solid'
-            
+
+## change init with saved values
+
+            #    
+            #initialize with saved values
+            #
+            if self.properties['raster']['pwidth'] != None:
+                rdict[r]['pwidth'] = self.properties['raster']['pwidth']
+            else:
+                rdict[r]['pwidth'] = 1
+                
+            if self.properties['raster']['pstyle'] != None and \
+                self.properties['raster']['pstyle'] != '':
+                rdict[r]['pstyle'] = self.properties['raster']['pstyle']
+            else:
+                rdict[r]['pstyle'] = 'solid'
+                        
             if idx <= len(self.colorList):
-                rdict[r]['pcolor'] = self.colorDict[self.colorList[idx]]
+                if idx == 0:
+                    # use saved color for first plot
+                    if self.properties['raster']['pcolor'] != None:
+                        rdict[r]['pcolor'] = self.properties['raster']['pcolor'] 
+                    else:
+                        rdict[r]['pcolor'] = self.colorDict[self.colorList[idx]]
+                else:
+                    rdict[r]['pcolor'] = self.colorDict[self.colorList[idx]]
             else:
                 r = randint(0, 255)
                 b = randint(0, 255)
@@ -216,6 +247,8 @@
         """
         
         if len(rasterList) == 0: return
+        
+## change to init with saved values
 
         rdict = {} # initialize a dictionary
         for rpair in rasterList:
@@ -243,11 +276,26 @@
                 
             rdict[rpair]['plegend'] = rpair[0].split('@')[0] + ' vs ' + rpair[1].split('@')[0]
             rdict[rpair]['datalist'] = [] # list of cell value,frequency pairs for plotting histogram
-            rdict[rpair]['ptype'] = 'dot'
             rdict[rpair][0]['datatype'] = ret0['datatype']
             rdict[rpair][1]['datatype'] = ret1['datatype']
-            rdict[rpair]['psize'] = 1
-            rdict[rpair]['pfill'] = 'solid'
+                 
+            #    
+            #initialize with saved values
+            #
+            if self.properties['raster']['ptype'] != None and \
+                self.properties['raster']['ptype'] != '':
+                rdict[rpair]['ptype'] = self.properties['raster']['ptype']
+            else:
+                rdict[rpair]['ptype'] = 'dot'
+            if self.properties['raster']['psize'] != None:
+                rdict[rpair]['psize'] = self.properties['raster']['psize']
+            else:
+                 rdict[rpair]['psize'] = 1
+            if self.properties['raster']['pfill'] != None and \
+                self.properties['raster']['pfill'] != '':
+                rdict[rpair]['pfill'] = self.properties['raster']['pfill']
+            else:
+                 rdict[rpair]['pfill'] = 'solid'
             
             if idx <= len(self.colorList):
                 rdict[rpair]['pcolor'] = self.colorDict[self.colorList[idx]]
@@ -269,6 +317,8 @@
         self.client.SetEnableZoom(self.zoom)
         self.client.SetEnableDrag(self.drag)
         
+## change - changed order so that grid settings go last and axis go first
+
         #
         # axis settings
         #
@@ -295,26 +345,32 @@
                                                  self.properties['y-axis']['prop']['max'])
         else:
             self.properties['y-axis']['axis'] = None
-
-        self.client.SetEnableGrid(self.properties['grid']['enabled'])
-        
-        self.client.SetGridColour(wx.Color(self.properties['grid']['color'][0],
-                                           self.properties['grid']['color'][1],
-                                           self.properties['grid']['color'][2],
-                                           255))
-
-        self.client.SetFontSizeLegend(self.properties['font']['prop']['legendSize'])
-        self.client.SetEnableLegend(self.properties['legend']['enabled'])
-
+            
         if self.properties['x-axis']['prop']['log'] == True:
             self.properties['x-axis']['axis'] = None
             self.client.SetXSpec('min')
         if self.properties['y-axis']['prop']['log'] == True:
             self.properties['y-axis']['axis'] = None
             self.client.SetYSpec('min')
-            
+                        
         self.client.setLogScale((self.properties['x-axis']['prop']['log'],
                                  self.properties['y-axis']['prop']['log']))
+        
+        #
+        # grid settings
+        #
+        self.client.SetEnableGrid(self.properties['grid']['enabled'])
+                
+        self.client.SetGridColour(wx.Color(self.properties['grid']['color'][0],
+                                           self.properties['grid']['color'][1],
+                                           self.properties['grid']['color'][2],
+                                           255))
+        
+        #
+        # legend settings
+        #
+        self.client.SetFontSizeLegend(self.properties['font']['prop']['legendSize'])
+        self.client.SetEnableLegend(self.properties['legend']['enabled'])
 
     def DrawPlot(self, plotlist):
         """!Draw line and point plot from list plot elements.
@@ -454,7 +510,8 @@
         self.ptitle = dlg.ptitle
         self.xlabel = dlg.xlabel
         self.ylabel = dlg.ylabel
-        dlg.UpdateSettings()
+## change these are redundant and can cause problems
+#        dlg.UpdateSettings()
 
         self.client.SetFont(self.properties['font']['wxfont'])
         self.client.SetFontSizeTitle(self.properties['font']['prop']['titleSize'])
@@ -464,7 +521,8 @@
             self.plot.setTitle(dlg.ptitle)
             self.plot.setXLabel(dlg.xlabel)
             self.plot.setYLabel(dlg.ylabel)
-        
+
+#        dlg.OnSave()        
         self.OnRedraw(event = None)
     
     def PlotText(self, event):
@@ -474,27 +532,34 @@
                                  plottype = self.plottype, 
                                  title = _('Histogram text settings'))
 
-        if dlg.ShowModal() == wx.ID_OK:
-            self.OnPlotText(dlg)
+## change to work correctly
 
-        dlg.Destroy()
+        btnval = dlg.ShowModal()
+        if btnval == wx.ID_SAVE or btnval == wx.ID_OK or btnval == wx.ID_CANCEL:
+#            self.OnPlotText(dlg)
+            dlg.Destroy()            
 
+
     def PlotOptions(self, event):
         """!Set various profile options, including: line width, color,
         style; marker size, color, fill, and style; grid and legend
         options.  Calls OptDialog class.
         """
+       
         dlg = OptDialog(parent = self, id = wx.ID_ANY, 
                         plottype = self.plottype, 
                         title = _('Plot settings'))
         btnval = dlg.ShowModal()
 
-        if btnval == wx.ID_SAVE:
-            dlg.UpdateSettings()            
-            self.SetGraphStyle()            
+## change buttons to be like text options
+
+        if btnval == wx.ID_SAVE or btnval == wx.ID_OK or btnval == wx.ID_CANCEL:
+            
+## change these are redundant and can cause problems
+
+#            dlg.UpdateSettings()            
+#            self.SetGraphStyle()            
             dlg.Destroy()            
-        elif btnval == wx.ID_CANCEL:
-            dlg.Destroy()
 
     def PrintMenu(self, event):
         """!Print options and output menu

Modified: grass/trunk/gui/wxpython/wxplot/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/dialogs.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/wxplot/dialogs.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -110,7 +110,7 @@
 
         wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
 
-        self.parent = parent
+        self.parent = parent 
         self.rasterList = self.parent.rasterList
         self.bins = self.parent.bins
         self.scattertype = self.parent.scattertype
@@ -487,7 +487,7 @@
         
 
 class TextDialog(wx.Dialog):
-    def __init__(self, parent, id, title, plottype = '',
+    def __init__(self, parent, id, title, plottype = '', 
                  style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
         """!Dialog to set histogram text options: font, title
         and font size, axis labels and font size
@@ -514,6 +514,7 @@
                          'bold' : wx.FONTWEIGHT_BOLD }
 
         self.parent = parent
+        self.plottype = plottype
 
         self.ptitle = self.parent.ptitle
         self.xlabel = self.parent.xlabel
@@ -716,12 +717,12 @@
 
     def OnSave(self, event):
         """!Button 'Save' pressed"""
-        self.UpdateSettings()
+        self.OnApply(None)
         fileSettings = {}
-        UserSettings.ReadSettingsFile(settings=fileSettings)
-        fileSettings['plot'] = UserSettings.Get(group = 'plot')
-        file = UserSettings.SaveToFile(fileSettings)
-        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot text settings saved to file \'%s\'.') % file)
+        UserSettings.ReadSettingsFile(settings = fileSettings)
+        fileSettings[self.plottype] = UserSettings.Get(group = self.plottype)
+        UserSettings.SaveToFile(fileSettings)
+        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot text sizes saved to file \'%s\'.') % UserSettings.filePath)
         self.EndModal(wx.ID_OK)
 
     def OnApply(self, event):
@@ -731,7 +732,7 @@
         
     def OnOk(self, event):
         """!Button 'OK' pressed"""
-        self.UpdateSettings()
+        self.OnApply(None)
         self.EndModal(wx.ID_OK)
 
     def OnCancel(self, event):
@@ -739,17 +740,19 @@
         self.EndModal(wx.ID_CANCEL)
         
 class OptDialog(wx.Dialog):
-    def __init__(self, parent, id, title, plottype = '',
+    def __init__(self, parent, id, title, plottype = '', 
                  style = wx.DEFAULT_DIALOG_STYLE, **kwargs): 
         """!Dialog to set various options for data plotted, including: line
         width, color, style; marker size, color, fill, and style; grid
         and legend options.
         """
         wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
+
         # init variables
         self.parent = parent
         self.linestyledict = parent.linestyledict
         self.ptfilldict = parent.ptfilldict
+        self.parent = parent
         self.plottype = plottype
         
         self.pttypelist = ['circle',
@@ -794,8 +797,8 @@
         return list
 
     def _do_layout(self):
-        """!Do layout"""
-        # dialog layout
+        """!Options dialog layout
+        """
         sizer = wx.BoxSizer(wx.VERTICAL)
 
         box = wx.StaticBox(parent = self, id = wx.ID_ANY,
@@ -1105,43 +1108,78 @@
         #
         btnSave = wx.Button(self, wx.ID_SAVE)
         btnApply = wx.Button(self, wx.ID_APPLY)
+        btnOk = wx.Button(self, wx.ID_OK)
         btnCancel = wx.Button(self, wx.ID_CANCEL)
-        btnSave.SetDefault()
+        btnOk.SetDefault()
 
+#        btnSave = wx.Button(self, wx.ID_SAVE)
+#        btnApply = wx.Button(self, wx.ID_APPLY)
+#        btnCancel = wx.Button(self, wx.ID_CANCEL)
+#        btnSave.SetDefault()
+
         # tooltips for buttons
         btnApply.SetToolTipString(_("Apply changes for the current session"))
+        btnOk.SetToolTipString(_("Apply changes for the current session and close dialog"))
         btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
-        btnSave.SetDefault()
         btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
 
+        
+#        btnApply.SetToolTipString(_("Apply changes for the current session"))
+#        btnSave.SetToolTipString(_("Apply and save changes to user settings file (default for next sessions)"))
+#        btnSave.SetDefault()
+#        btnCancel.SetToolTipString(_("Close dialog and ignore changes"))
+
+
         # sizers
         btnStdSizer = wx.StdDialogButtonSizer()
+        btnStdSizer.AddButton(btnOk)
+        btnStdSizer.AddButton(btnApply)
         btnStdSizer.AddButton(btnCancel)
-        btnStdSizer.AddButton(btnSave)
-        btnStdSizer.AddButton(btnApply)
         btnStdSizer.Realize()
         
-        sizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+        btnSizer.Add(item = btnSave, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
+        btnSizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+        sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
+
+#        # sizers
+#        btnStdSizer = wx.StdDialogButtonSizer()
+#        btnStdSizer.AddButton(btnCancel)
+#        btnStdSizer.AddButton(btnSave)
+#        btnStdSizer.AddButton(btnApply)
+#        btnStdSizer.Realize()
+        
+#        sizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+
         #
         # bindings for buttons and map plot settings controls
         #
         self.mapchoice.Bind(wx.EVT_CHOICE, self.OnSetMap)
-        
-        if self.plottype != 'scatter':
-            color.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
-            width.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
-            style.Bind(wx.EVT_CHOICE, self.OnSetOpt)
-            legend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+
+## change        
+        # Bindings not needed. Will update with OnApply
+#        if self.plottype != 'scatter':
+#            color.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+#            width.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+#            style.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+#            legend.Bind(wx.EVT_TEXT, self.OnSetOpt)
             
-        if self.plottype != 'histogram':
-            ptcolor.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
-            ptsize.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
-            ptfill.Bind(wx.EVT_CHOICE, self.OnSetOpt)
-            ptlegend.Bind(wx.EVT_TEXT, self.OnSetOpt)
-            pttype.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+#        if self.plottype != 'histogram':
+#            ptcolor.Bind(csel.EVT_COLOURSELECT, self.OnSetOpt)
+#            ptsize.Bind(wx.EVT_SPINCTRL, self.OnSetOpt)
+#            ptfill.Bind(wx.EVT_CHOICE, self.OnSetOpt)
+#            ptlegend.Bind(wx.EVT_TEXT, self.OnSetOpt)
+#            pttype.Bind(wx.EVT_CHOICE, self.OnSetOpt)
             
+#        btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
+#        btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
+#        btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+
+        # bindings
         btnApply.Bind(wx.EVT_BUTTON, self.OnApply)
+        btnOk.Bind(wx.EVT_BUTTON, self.OnOk)
+        btnOk.SetDefault()
         btnSave.Bind(wx.EVT_BUTTON, self.OnSave)
         btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel)
 
@@ -1175,25 +1213,36 @@
         self.map = self.rasterList[self.mapchoice.GetCurrentSelection()]
         self.UpdateSettings()
         self.parent.SetGraphStyle()
-        if self.parent.plot:
-            p = self.parent.CreatePlotList()
-            self.parent.DrawPlot(p)
+        p = self.parent.CreatePlotList()
+        self.parent.DrawPlot(p)
 
+## change if clause not relevant
+#        if self.parent.plot:
+#            p = self.parent.CreatePlotList()
+#            self.parent.DrawPlot(p)
+
     def UpdateSettings(self):
         """!Apply settings to each map and to entire plot"""
-        
+## change updating properties for pcolor, pwidth, pstyle, psize, ptype, pfill        
         # update plot settings for selected map
         self.raster[self.map]['pcolor'] = self.FindWindowById(self.wxId['pcolor']).GetColour()
+        self.properties['raster']['pcolor'] = self.raster[self.map]['pcolor']
+        
         self.raster[self.map]['plegend'] = self.FindWindowById(self.wxId['plegend']).GetValue()
         
         if self.plottype != 'scatter':
             self.raster[self.map]['pwidth'] = int(self.FindWindowById(self.wxId['pwidth']).GetValue())
+            self.properties['raster']['pwidth'] = self.raster[self.map]['pwidth']
             self.raster[self.map]['pstyle'] = self.FindWindowById(self.wxId['pstyle']).GetStringSelection()
+            self.properties['raster']['pstyle'] = self.raster[self.map]['pstyle']
             
         elif self.plottype == 'scatter':
             self.raster[self.map]['psize'] = self.FindWindowById(self.wxId['psize']).GetValue()
+            self.properties['raster']['psize'] = self.raster[self.map]['psize']
             self.raster[self.map]['ptype'] = self.FindWindowById(self.wxId['ptype']).GetValue()
+            self.properties['raster']['ptype'] = self.raster[self.map]['ptype']
             self.raster[self.map]['pfill'] = self.FindWindowById(self.wxId['pfill']).GetValue()
+            self.properties['raster']['pfill'] = self.raster[self.map]['pfill']
 
         # update settings for entire plot
         for axis in ('x-axis', 'y-axis'):
@@ -1212,6 +1261,8 @@
         self.properties['grid']['color'] = self.FindWindowById(self.wxId['grid']['color']).GetColour()
         self.properties['grid']['enabled'] = self.FindWindowById(self.wxId['grid']['enabled']).IsChecked()
 
+        # this makes more sense in the text properties, including for settings update. But will need to change
+        # layout for controls to text dialog too.
         self.properties['font']['prop']['legendSize'] = self.FindWindowById(self.wxId['font']['legendSize']).GetValue()
         self.properties['legend']['enabled'] = self.FindWindowById(self.wxId['legend']['enabled']).IsChecked()
 
@@ -1221,17 +1272,26 @@
         fileSettings = {}
         UserSettings.ReadSettingsFile(settings = fileSettings)
         fileSettings[self.plottype] = UserSettings.Get(group = self.plottype)
-        file = UserSettings.SaveToFile(fileSettings)
-        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot settings saved to file \'%s\'.') % file)
+        UserSettings.SaveToFile(fileSettings)
+        self.parent.parent.GetLayerManager().goutput.WriteLog(_('Plot settings saved to file \'%s\'.') % UserSettings.filePath)
         self.Close()
 
     def OnApply(self, event):
         """!Button 'Apply' pressed. Does not close dialog"""
         self.UpdateSettings()
         self.parent.SetGraphStyle()
-        if self.parent.plot:
-            p = self.parent.CreatePlotList()
-            self.parent.DrawPlot(p)
+        p = self.parent.CreatePlotList()
+        self.parent.DrawPlot(p)
+##change
+
+#        if self.parent.plot:
+#            p = self.parent.CreatePlotList()
+#            self.parent.DrawPlot(p)
+
+    def OnOk(self, event):
+        """!Button 'OK' pressed"""
+        self.OnApply(None)
+        self.EndModal(wx.ID_OK)
         
     def OnCancel(self, event):
         """!Button 'Cancel' pressed"""

Modified: grass/trunk/gui/wxpython/wxplot/histogram.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/histogram.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/wxplot/histogram.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -55,11 +55,13 @@
                     "aqua", "black", "grey", "orange", "brown", "purple", "violet", \
                     "indigo"]
         
+        self._initOpts()
+
         if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
             self.InitRasterOpts(self.rasterList, self.plottype)
+        else:
+            self.raster = {}
 
-        self._initOpts()
-
     def _initOpts(self):
         """!Initialize plot options
         """

Modified: grass/trunk/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/profile.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/wxplot/profile.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -66,13 +66,13 @@
                            "aqua", "black", "grey", "orange", "brown", "purple", "violet",
                            "indigo"]
         
+        self._initOpts()
+
         if len(self.rasterList) > 0: # set raster name(s) from layer manager if a map is selected
             self.raster = self.InitRasterOpts(self.rasterList, self.plottype)
         else:
             self.raster = {}
-        
-        self._initOpts()
-        
+                
         # determine units (axis labels)
         if self.parent.Map.projinfo['units'] != '':
             self.xlabel = _('Distance (%s)') % self.parent.Map.projinfo['units']

Modified: grass/trunk/gui/wxpython/wxplot/scatter.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/scatter.py	2012-08-31 16:56:02 UTC (rev 53025)
+++ grass/trunk/gui/wxpython/wxplot/scatter.py	2012-08-31 17:14:22 UTC (rev 53026)
@@ -54,11 +54,13 @@
                     "aqua", "grey", "orange", "brown", "purple", "violet", \
                     "indigo"]
         
+        self._initOpts()
+
         if len(self.rasterList) > 1: # set raster name(s) from layer manager if a map is selected
             self.InitRasterOpts(self.rasterList, 'scatter')
+        else:
+            self.raster = {}
 
-        self._initOpts()
-
     def _initOpts(self):
         """!Initialize plot options
         """



More information about the grass-commit mailing list