|
@@ -35,6 +35,7 @@ sys.path.append(gmpath)
|
|
|
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,7 +93,10 @@ class BufferedWindow(wx.Window):
|
|
|
|
|
|
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)
|
|
|
|
|
@@ -294,7 +298,7 @@ class HistFrame(wx.Frame):
|
|
|
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 @@ class HistFrame(wx.Frame):
|
|
|
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,10 +401,7 @@ class HistFrame(wx.Frame):
|
|
|
"""
|
|
|
Set histogram layer
|
|
|
"""
|
|
|
-
|
|
|
- for item in cmd:
|
|
|
- if 'map=' in item:
|
|
|
- self.mapname = item.split('=')[1]
|
|
|
+ self.mapname = utils.GetLayerNameFromCmd(cmd)
|
|
|
|
|
|
self.layer = self.Map.ChangeLayer(layer=self.layer, type="command", name='histogram',
|
|
|
command=cmd,
|