[GRASS-SVN] r32486 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 3 07:00:37 EDT 2008
Author: martinl
Date: 2008-08-03 07:00:36 -0400 (Sun, 03 Aug 2008)
New Revision: 32486
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/render.py
grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: SetOpacityDialog cosmetics (missing title)
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2008-08-03 10:23:26 UTC (rev 32485)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2008-08-03 11:00:36 UTC (rev 32486)
@@ -11,7 +11,8 @@
- LoadMapLayersDialog
- ImportDxfDialog
- LayerList (used by ImportDxfMulti)
-
+ - SetOpacityDialog
+
(C) 2008 by the GRASS Development Team
This program is free software under the GNU General Public
@@ -945,53 +946,65 @@
class SetOpacityDialog(wx.Dialog):
"""Set opacity of map layers"""
- def __init__(self, parent, id=wx.ID_ANY, title=_("Set Opacity (100=opaque, 0=transparent"),
+ def __init__(self, parent, id=wx.ID_ANY, title=_("Set Map Layer Opacity"),
size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE, opacity=100):
self.parent = parent # GMFrame
- super(SetOpacityDialog, self).__init__(parent, id=id, pos=pos, size=size, style=style)
+ super(SetOpacityDialog, self).__init__(parent, id=id, pos=pos,
+ size=size, style=style, title=title)
self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
- self.opacity = opacity # current opacity
+ self.opacity = opacity # current opacity
self.parent = parent # MapFrame
sizer = wx.BoxSizer(wx.VERTICAL)
box = wx.BoxSizer(wx.HORIZONTAL)
- self.spin = wx.SpinCtrl(self, id=wx.ID_ANY, value="",
+ self.spin = wx.SpinCtrl(self.panel, id=wx.ID_ANY, value="",
style=wx.SP_ARROW_KEYS, initial=100, min=0, max=100,
name='spinCtrl')
#self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, self.spin)
self.spin.SetValue(self.opacity)
- box.Add(item=self.spin, proportion=0,
- flag=wx.ALIGN_CENTRE|wx.ALL, border=5)
+
+ box.Add(item=wx.StaticText(parent=self.panel, id=wx.ID_ANY,
+ label=_("Set opacity (100=opaque, 0=transparent):")),
+ proportion=0,
+ flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=5)
+ box.Add(item=self.spin, proportion=1,
+ flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL, border=5)
+
sizer.Add(item=box, proportion=0,
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
+ flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
- line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20,-1), style=wx.LI_HORIZONTAL)
+ line = wx.StaticLine(parent=self.panel, id=wx.ID_ANY,
+ size=(20,-1), style=wx.LI_HORIZONTAL)
sizer.Add(item=line, proportion=0,
- flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5)
+ flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
# buttons
btnsizer = wx.StdDialogButtonSizer()
- self.btnOK = wx.Button(parent=self, id=wx.ID_OK)
+ self.btnOK = wx.Button(parent=self.panel, id=wx.ID_OK)
self.btnOK.SetDefault()
btnsizer.AddButton(self.btnOK)
- btnCancel = wx.Button(parent=self, id=wx.ID_CANCEL)
+ btnCancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
btnsizer.AddButton(btnCancel)
btnsizer.Realize()
sizer.Add(item=btnsizer, proportion=0,
flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5)
- self.SetSizer(sizer)
- sizer.Fit(self)
+ self.panel.SetSizer(sizer)
+ sizer.Fit(self.panel)
+ self.SetSize(self.GetBestSize())
+
+ self.Layout()
+
def GetOpacity(self):
"""Button 'OK' pressed"""
# return opacity value
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2008-08-03 10:23:26 UTC (rev 32485)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2008-08-03 11:00:36 UTC (rev 32486)
@@ -189,6 +189,10 @@
return int (self.opacity * 100)
+ def GetName(self):
+ """Get map layer name"""
+ return self.name
+
def IsActive(self):
"""Check if layer is activated for rendering"""
return self.active
Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2008-08-03 10:23:26 UTC (rev 32485)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py 2008-08-03 11:00:36 UTC (rev 32486)
@@ -461,7 +461,8 @@
maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
current_opacity = maplayer.GetOpacity()
- dlg = gdialogs.SetOpacityDialog(self, opacity=current_opacity)
+ dlg = gdialogs.SetOpacityDialog(self, opacity=current_opacity,
+ title=_("Set opacity <%s>") % maplayer.GetName())
if dlg.ShowModal() == wx.ID_OK:
new_opacity = dlg.GetOpacity() # string
More information about the grass-commit
mailing list