[GRASS-SVN] r50326 - in grass/trunk/gui/wxpython: core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 20 13:41:31 EST 2012


Author: martinl
Date: 2012-01-20 10:41:31 -0800 (Fri, 20 Jan 2012)
New Revision: 50326

Modified:
   grass/trunk/gui/wxpython/core/globalvar.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: remove globalvar.HIST_WINDOW_SIZE


Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py	2012-01-20 18:39:31 UTC (rev 50325)
+++ grass/trunk/gui/wxpython/core/globalvar.py	2012-01-20 18:41:31 UTC (rev 50326)
@@ -100,7 +100,6 @@
 DIALOG_COLOR_SIZE = (30, 30)
 
 MAP_WINDOW_SIZE = (800, 600)
-HIST_WINDOW_SIZE = (500, 350)
 GM_WINDOW_SIZE = (500, 600)
 
 

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2012-01-20 18:39:31 UTC (rev 50325)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2012-01-20 18:41:31 UTC (rev 50326)
@@ -572,37 +572,24 @@
                                                                  'map=%s' % name])
         
     def OnHistogram(self, event):
+        """!Plot histogram for given raster map layer
         """
-        Plot histogram for given raster map layer
-        """
         mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
         if not mapLayer.GetName():
-            wx.MessageBox(parent = self,
-                          message = _("Unable to display histogram of "
-                                    "raster map."),
-                          caption = _("Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
-            return False
+            GError(parent = self,
+                   message = _("Unable to display histogram of "
+                               "raster map. No map name defined."))
+            return
+        
+        win = HistogramFrame(parent = self)
+        
+        win.CentreOnScreen()
+        win.Show()
+        win.SetHistLayer(mapLayer.GetName())
+        win.HistWindow.UpdateHist()
+        win.Refresh()
+        win.Update()
 
-        if not hasattr (self, "histogramFrame"):
-            self.histogramFrame = None
-
-        if hasattr (self.mapdisplay, "histogram") and self.mapdisplay.histogram:
-            self.histogramFrame = self.mapdisplay.histogram
-
-        if not self.histogramFrame:
-            self.histogramFrame = HistogramFrame(self, size = globalvar.HIST_WINDOW_SIZE,
-                                                 style = wx.DEFAULT_FRAME_STYLE)
-            self.histogramFrame.CentreOnScreen()
-            # show new display
-            self.histogramFrame.Show()
-
-        self.histogramFrame.SetHistLayer(mapLayer.GetName())
-        self.histogramFrame.HistWindow.UpdateHist()
-        self.histogramFrame.Refresh()
-        self.histogramFrame.Update()
-
-        return True
-
     def OnUnivariateStats(self, event):
         """!Univariate raster statistics"""
         name = self.GetPyData(self.layer_selected)[0]['maplayer'].GetName()



More information about the grass-commit mailing list