[GRASS-SVN] r48916 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 23 16:04:33 EDT 2011


Author: martinl
Date: 2011-10-23 13:04:33 -0700 (Sun, 23 Oct 2011)
New Revision: 48916

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
Log:
wxGUI: allow to open multiple histogram windows


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2011-10-23 07:20:26 UTC (rev 48915)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py	2011-10-23 20:04:33 UTC (rev 48916)
@@ -47,11 +47,11 @@
 import histogram
 import utils
 import profile
-from debug import Debug as Debug
-from icon import Icons as Icons
+from debug       import Debug as Debug
+from icon        import Icons as Icons
 from preferences import globalSettings as UserSettings
-from vdigit import haveVDigit
-from gcmd import GWarning
+from vdigit      import haveVDigit
+from gcmd        import GWarning, GError
 
 TREE_ITEM_HEIGHT = 25
 
@@ -520,38 +520,25 @@
                                                                           '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
-
-        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 = histogram.HistFrame(self,
-                                                      id = wx.ID_ANY,
-                                                      pos = wx.DefaultPosition, size = globalvar.HIST_WINDOW_SIZE,
-                                                      style = wx.DEFAULT_FRAME_STYLE)
-            # show new display
-            self.histogramFrame.Show()
-
-        self.histogramFrame.SetHistLayer(mapLayer.GetName())
-        self.histogramFrame.HistWindow.UpdateHist()
-        self.histogramFrame.Refresh()
-        self.histogramFrame.Update()
-
-        return True
-
+            GError(parent = self,
+                   message = _("Unable to display histogram of "
+                               "raster map. No map name defined."))
+            return
+        
+        histogramFrame = histogram.HistFrame(parent = self,
+                                             id = wx.ID_ANY,
+                                             pos = wx.DefaultPosition, size = globalvar.HIST_WINDOW_SIZE,
+                                             style = wx.DEFAULT_FRAME_STYLE)
+        histogramFrame.Show()
+        histogramFrame.SetHistLayer(mapLayer.GetName())
+        histogramFrame.HistWindow.UpdateHist()
+        histogramFrame.Refresh()
+        histogramFrame.Update()
+        
     def OnUnivariateStats(self, event):
         """!Univariate raster statistics"""
         name = self.GetPyData(self.layer_selected)[0]['maplayer'].GetName()



More information about the grass-commit mailing list