[GRASS-SVN] r50322 - in grass/branches/develbranch_6/gui/wxpython: lmgr mapdisp modules wxplot xml

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


Author: martinl
Date: 2012-01-20 09:26:51 -0800 (Fri, 20 Jan 2012)
New Revision: 50322

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


Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/frame.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -1214,29 +1214,26 @@
         """
         self.goutput.RunCmd(['g.manual','-i'])
         
-    def DispHistogram(self, event):
+    def OnHistogram(self, event):
+        """!Init histogram display canvas and tools
         """
-        Init histogram display canvas and tools
-        """
-        self.histogram = HistogramFrame(self, size = (400,300),
-                                        style = wx.DEFAULT_FRAME_STYLE)
+        win = HistogramFrame(self)
         
-        #show new display
-        self.histogram.Show()
-        self.histogram.Refresh()
-        self.histogram.Update()
-
-    def DispProfile(self, event):
+        win.CentreOnParent()
+        win.Show()
+        win.Refresh()
+        win.Update()
+        
+    def OnProfile(self, event):
+        """!Launch profile tool
         """
-        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/branches/develbranch_6/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/frame.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -977,21 +977,21 @@
         
         return dist
 
-    def Profile(self, event):
-        """!Init profile canvas and tools
+    def OnProfile(self, event):
+        """!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,
-                                    id = wx.ID_ANY, pos = wx.DefaultPosition, size = (700,300),
-                                    style = wx.DEFAULT_FRAME_STYLE, 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,
@@ -1043,18 +1043,16 @@
         
         return (outdist, outunits)
     
-    def Histogram(self, event):
+    def OnHistogram(self, event):
         """!Init histogram display canvas and tools
         """
-        self.histogram = HistogramFrame(self, size = globalvar.HIST_WINDOW_SIZE,
-                                        style = wx.DEFAULT_FRAME_STYLE)
-
-        #show new display
-        self.histogram.Show()
-        self.histogram.Refresh()
-        self.histogram.Update()
-
-
+        win = HistogramFrame(self)
+        
+        win.CentreOnParent()
+        win.Show()
+        win.Refresh()
+        win.Update()
+        
     def OnAddBarscale(self, event):
         """!Handler for scale/arrow map decoration menu selection.
         """

Modified: grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/toolbars.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -239,8 +239,7 @@
         """
         self._onMenu(((MapIcons["measure"],    self.parent.OnMeasure),
                       (MapIcons["profile"],    self.parent.OnProfile),
-                      (MapIcons["scatter"],    self.parent.OnScatterplot),
-                      (BaseIcons["histogram"], self.parent.OnHistogram)))
+                      (MapIcons["histogram"], self.parent.OnHistogram)))
         
     def OnDecoration(self, event):
         """!Decorations overlay menu

Modified: grass/branches/develbranch_6/gui/wxpython/modules/histogram.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/histogram.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/modules/histogram.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -263,9 +263,10 @@
     rendered onto canvas
     """
     def __init__(self, parent = None, id = wx.ID_ANY,
-                 title = _("GRASS GIS Histogram of raster map"),
+                 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/branches/develbranch_6/gui/wxpython/wxplot/base.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/base.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/base.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -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/branches/develbranch_6/gui/wxpython/wxplot/profile.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/wxplot/profile.py	2012-01-20 17:26:51 UTC (rev 50322)
@@ -42,13 +42,14 @@
 class ProfileFrame(BasePlotFrame):
     """!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, 
+    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)
-        self.SetLabel(_("GRASS Profile Analysis Tool"))
+        self.SetTitle(_("GRASS Profile Analysis Tool"))
         
         #
         # Init variables

Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2012-01-20 16:33:56 UTC (rev 50321)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2012-01-20 17:26:51 UTC (rev 50322)
@@ -2553,7 +2553,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