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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 18 05:51:42 EDT 2008


Author: martinl
Date: 2008-05-18 05:51:42 -0400 (Sun, 18 May 2008)
New Revision: 31410

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: histogram component fixed

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2008-05-18 09:00:43 UTC (rev 31409)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2008-05-18 09:51:42 UTC (rev 31410)
@@ -81,6 +81,7 @@
 DIALOG_TEXTCTRL_SIZE = (400, -1)
 
 MAP_WINDOW_SIZE = (680, 520)
+HIST_WINDOW_SIZE = (500, 350)
 
 """File name extension binaries/scripts"""
 if subprocess.mswindows:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py	2008-05-18 09:00:43 UTC (rev 31409)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/histogram.py	2008-05-18 09:51:42 UTC (rev 31410)
@@ -35,6 +35,7 @@
 import render
 import menuform
 import disp_print
+import utils
 from gui_modules.preferences import SetDefaultFont as SetDefaultFont
 from debug import Debug as Debug
 from icon import Icons as Icons
@@ -92,8 +93,11 @@
 
         self.pdc = wx.PseudoDC()
         self._Buffer = '' # will store an off screen empty bitmap for saving to file
-        self.Map.SetRegion() # make sure that extents are updated at init
 
+        # make sure that extents are updated at init
+        self.Map.region = self.Map.GetRegion()
+        self.Map.SetRegion() 
+
         self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x:None)
 
     def Draw(self, pdc, img=None, drawid=None, pdctype='image', coords=[0,0,0,0]):
@@ -294,7 +298,7 @@
         self.iconsize = (16, 16)
 
         # Init variables
-        self.params = {} # previously set histogram parameters
+        self.params = {}  # previously set histogram parameters
         self.propwin = '' # ID of properties dialog
 
         self.font = ""
@@ -371,24 +375,23 @@
         self.Map.geom = self.width, self.height
 
     def OnOptions(self, event):
-        global gmpath
-        completed = ''
+        """Change histogram settings"""
 
-        menuform.GUI().ParseCommand(['d.histogram'], gmpath,
-                                    completed=(self.GetOptData, "hist", self.params),
-                                    parentframe=None)
+        cmd = ['d.histogram']
+        if self.mapname != '':
+            cmd.append('map=%s' % self.mapname)
 
+        menuform.GUI().ParseCommand(cmd,
+                                    completed=(self.GetOptData, None, self.params),
+                                    parentframe=self)
 
     def GetOptData(self, dcmd, layer, params, propwin):
         """
         Callback method for histogram command generated by
         dialog created in menuform.py
         """
-
-        # Reset comand and rendering options in render.Map. Always render decoration.
-        # Showing/hiding handled by PseudoDC
-
-        self.SetHistLayer(dcmd)
+        if dcmd:
+            self.SetHistLayer(dcmd)
         self.params = params
         self.propwin = propwin
 
@@ -398,11 +401,8 @@
         """
         Set histogram layer
         """
+        self.mapname = utils.GetLayerNameFromCmd(cmd)
 
-        for item in cmd:
-            if 'map=' in item:
-                self.mapname = item.split('=')[1]
-
         self.layer = self.Map.ChangeLayer(layer=self.layer, type="command", name='histogram',
                                           command=cmd,
                                           l_active=True, l_hidden=False, l_opacity=1.0)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-05-18 09:00:43 UTC (rev 31409)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2008-05-18 09:51:42 UTC (rev 31410)
@@ -3267,7 +3267,7 @@
         Init histogram display canvas and tools
         """
         self.histogram = histogram.HistFrame(self,
-                                             id=wx.ID_ANY, pos=wx.DefaultPosition, size=(400,300),
+                                             id=wx.ID_ANY, size=globalvar.HIST_WINDOW_SIZE,
                                              style=wx.DEFAULT_FRAME_STYLE)
 
         #show new display

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2008-05-18 09:00:43 UTC (rev 31409)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2008-05-18 09:51:42 UTC (rev 31410)
@@ -370,7 +370,7 @@
         if not self.histogramFrame:
             self.histogramFrame = histogram.HistFrame(self,
                                                       id=wx.ID_ANY,
-                                                      pos=wx.DefaultPosition, size=(400, 300),
+                                                      pos=wx.DefaultPosition, size=globalvar.HIST_WINDOW_SIZE,
                                                       style=wx.DEFAULT_FRAME_STYLE)
             # show new display
             self.histogramFrame.Show()



More information about the grass-commit mailing list