[GRASS-SVN] r50323 - in grass/trunk/gui/wxpython: lmgr mapdisp modules wxplot xml

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 20 12:35:20 EST 2012


Author: martinl
Date: 2012-01-20 09:35:20 -0800 (Fri, 20 Jan 2012)
New Revision: 50323

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/modules/histogram.py
   grass/trunk/gui/wxpython/wxplot/base.py
   grass/trunk/gui/wxpython/wxplot/histogram.py
   grass/trunk/gui/wxpython/wxplot/profile.py
   grass/trunk/gui/wxpython/wxplot/scatter.py
   grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: fix histogramming / profile tools (launch from mapdisp)


Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -1189,29 +1189,26 @@
         
         win.Show()
         
-    def DispHistogram(self, event):
+    def OnHistogram(self, event):
+        """!Init histogram display canvas and tools
         """
-        Init histogram display canvas and tools
+        win = HistogramFrame(self)
+        
+        win.CentreOnParent()
+        win.Show()
+        win.Refresh()
+        win.Update()
+        
+    def OnProfile(self, event):
+        """!Launch profile tool
         """
-        self.histogram = HistFrame(self, id = wx.ID_ANY, pos = wx.DefaultPosition, size = (400,300),
-                                   style = wx.DEFAULT_FRAME_STYLE)
-
-        #show new display
-        self.histogram.Show()
-        self.histogram.Refresh()
-        self.histogram.Update()
-
-    def DispProfile(self, event):
-        """
-        Init profile canvas and tools
-        """
-        self.profile = profile.ProfileFrame(self,
-                                           id = wx.ID_ANY, pos = wx.DefaultPosition, size = (400,300),
-                                           style = wx.DEFAULT_FRAME_STYLE)
-        self.profile.Show()
-        self.profile.Refresh()
-        self.profile.Update()
+        win = profile.ProfileFrame(parent = self)
         
+        win.CentreOnParent()
+        win.Show()
+        win.Refresh()
+        win.Update()
+        
     def OnMapCalculator(self, event, cmd = ''):
         """!Init map calculator for interactive creation of mapcalc statements
         """

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -980,19 +980,20 @@
         return dist
 
     def OnProfile(self, event):
-        """!Init profile canvas and tools
+        """!Launch profile tool
         """
         raster = []
         if self.tree.layer_selected and \
                 self.tree.GetPyData(self.tree.layer_selected)[0]['type'] == 'raster':
             raster.append(self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].name)
 
-        self.profile = ProfileFrame(self, size = wx.Size(700, 300),
-                                    rasterList = raster)
-        self.profile.Show()
-        # Open raster select dialog to make sure that a raster (and the desired raster)
-        # is selected to be profiled
-        self.profile.OnSelectRaster(None)
+        win = ProfileFrame(parent = self, rasterList = raster)
+        
+        win.CentreOnParent()
+        win.Show()
+        # Open raster select dialog to make sure that a raster (and
+        # the desired raster) is selected to be profiled
+        win.OnSelectRaster(None)
 
     def FormatDist(self, dist):
         """!Format length numbers and units in a nice way,
@@ -1055,14 +1056,12 @@
                 continue
             raster.append(self.tree.GetPyData(layer)[0]['maplayer'].GetName())
 
-        self.histogramPyPlot = Histogram2Frame(self, id = wx.ID_ANY, 
-                                               pos = wx.DefaultPosition, size = (700,300),
-                                               style = wx.DEFAULT_FRAME_STYLE, 
-                                               rasterList = raster)
-        self.histogramPyPlot.Show()
+        win = Histogram2Frame(parent = self, rasterList = raster)
+        win.CentreOnParent
+        win.Show()
         # Open raster select dialog to make sure that a raster (and the desired raster)
         # is selected to be histogrammed
-        self.histogramPyPlot.OnSelectRaster(None)
+        win.OnSelectRaster(None)
         
     def OnScatterplot(self, event):
         """!Init PyPlot scatterplot display canvas and tools
@@ -1073,26 +1072,24 @@
             if self.tree.GetPyData(layer)[0]['maplayer'].GetType() != 'raster':
                 continue
             raster.append(self.tree.GetPyData(layer)[0]['maplayer'].GetName())
-
-        self.scatterplot = ScatterFrame(self, id = wx.ID_ANY, 
-                                                pos = wx.DefaultPosition, size = (700,300),
-                                                style = wx.DEFAULT_FRAME_STYLE, 
-                                                rasterList = raster)
-        self.scatterplot.Show()
+            
+        win = ScatterFrame(parent = self, rasterList = raster)
+        
+        win.CentreOnParent()
+        win.Show()
         # Open raster select dialog to make sure that at least 2 rasters (and the desired rasters)
         # are selected to be plotted
-        self.scatterplot.OnSelectRaster(None)
+        win.OnSelectRaster(None)
 
     def OnHistogram(self, event):
         """!Init histogram display canvas and tools
         """
-        self.histogram = HistogramFrame(parent = self, id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
-                                        style = wx.DEFAULT_FRAME_STYLE)
+        win = HistogramFrame(self)
         
-        # show new display
-        self.histogram.Show()
-        self.histogram.Refresh()
-        self.histogram.Update()
+        win.CentreOnParent()
+        win.Show()
+        win.Refresh()
+        win.Update()
        
     def OnAddBarscale(self, event):
         """!Handler for scale/arrow map decoration menu selection.

Modified: grass/trunk/gui/wxpython/modules/histogram.py
===================================================================
--- grass/trunk/gui/wxpython/modules/histogram.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/modules/histogram.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -264,8 +264,9 @@
     """
     def __init__(self, parent = None, id = wx.ID_ANY,
                  title = _("GRASS GIS Histogramming Tool (d.histogram)"),
+                 size = wx.Size(500, 350),
                  style = wx.DEFAULT_FRAME_STYLE, **kwargs):
-        wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
+        wx.Frame.__init__(self, parent, id, title, size = size, style = style, **kwargs)
         self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
         
         self.Map   = Map()         # instance of render.Map to be associated with display

Modified: grass/trunk/gui/wxpython/wxplot/base.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/base.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/wxplot/base.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -46,7 +46,7 @@
 
 class BasePlotFrame(wx.Frame):
     """!Abstract PyPlot display frame class"""
-    def __init__(self, parent = None, id = wx.ID_ANY, size = (700, 300),
+    def __init__(self, parent = None, id = wx.ID_ANY, size = wx.Size(700, 400),
                  style = wx.DEFAULT_FRAME_STYLE, rasterList = [],  **kwargs):
 
         wx.Frame.__init__(self, parent, id, size = size, style = style, **kwargs)

Modified: grass/trunk/gui/wxpython/wxplot/histogram.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/histogram.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/wxplot/histogram.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -28,10 +28,12 @@
 from core.gcmd         import RunCommand, GException, GError
 
 class Histogram2Frame(BasePlotFrame):
-    def __init__(self, parent, id, pos, style, size, rasterList = []):
-        """!Mainframe for displaying histogram of raster map. Uses wx.lib.plot.
-        """
-        BasePlotFrame.__init__(self, parent)
+    """!Mainframe for displaying histogram of raster map. Uses wx.lib.plot.
+    """
+    def __init__(self, parent, id = wx.ID_ANY, style = wx.DEFAULT_FRAME_STYLE, 
+                 size = wx.Size(700, 400),
+                 rasterList = [], **kwargs):
+        BasePlotFrame.__init__(self, parent, size = size, **kwargs)
         
         self.toolbar = Histogram2Toolbar(parent = self)
         self.SetToolBar(self.toolbar)

Modified: grass/trunk/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/profile.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/wxplot/profile.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -43,8 +43,9 @@
     """!Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot.
     """
     def __init__(self, parent, id = wx.ID_ANY, style = wx.DEFAULT_FRAME_STYLE, 
+                 size = wx.Size(700, 400),
                  rasterList = [], **kwargs):
-        BasePlotFrame.__init__(self, parent, **kwargs)
+        BasePlotFrame.__init__(self, parent, size = size, **kwargs)
 
         self.toolbar = ProfileToolbar(parent = self)
         self.SetToolBar(self.toolbar)

Modified: grass/trunk/gui/wxpython/wxplot/scatter.py
===================================================================
--- grass/trunk/gui/wxpython/wxplot/scatter.py	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/wxplot/scatter.py	2012-01-20 17:35:20 UTC (rev 50323)
@@ -30,9 +30,10 @@
 class ScatterFrame(BasePlotFrame):
     """!Mainframe for displaying bivariate scatter plot of two raster maps. Uses wx.lib.plot.
     """
-    def __init__(self, parent, id, pos, style, size, rasterList = []):
-
-        BasePlotFrame.__init__(self, parent)
+    def __init__(self, parent, id = wx.ID_ANY, style = wx.DEFAULT_FRAME_STYLE, 
+                 size = wx.Size(700, 400),
+                 rasterList = [], **kwargs):
+        BasePlotFrame.__init__(self, parent, size = size, **kwargs)
         
         self.toolbar = ScatterToolbar(parent = self)
         self.SetToolBar(self.toolbar)

Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml	2012-01-20 17:26:51 UTC (rev 50322)
+++ grass/trunk/gui/wxpython/xml/menudata.xml	2012-01-20 17:35:20 UTC (rev 50323)
@@ -2626,7 +2626,7 @@
 	<menuitem>
 	  <label>Histogram</label>
 	  <help>Generate histogram of image</help>
-	  <handler>DispHistogram</handler>
+	  <handler>OnHistogram</handler>
 	</menuitem>
 	<menuitem>
 	  <label>Spectral response</label>



More information about the grass-commit mailing list