[GRASS-SVN] r41906 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 17 05:28:45 EDT 2010
Author: martinl
Date: 2010-04-17 05:28:45 -0400 (Sat, 17 Apr 2010)
New Revision: 41906
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI/modeler: data color configurable
(merge r41905 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-04-17 09:26:53 UTC (rev 41905)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-04-17 09:28:45 UTC (rev 41906)
@@ -237,6 +237,9 @@
"""!Update model"""
for action in self.actions:
action.Update()
+
+ for data in self.data:
+ data.Update()
class ModelFrame(wx.Frame):
def __init__(self, parent, id = wx.ID_ANY, title = _("Graphical modeler (under development)"), **kwargs):
@@ -1149,13 +1152,8 @@
self.SetX(x)
self.SetY(y)
self.SetPen(wx.BLACK_PEN)
- if self.prompt == 'raster':
- self.SetBrush(wx.Brush(wx.Colour(215, 215, 248)))
- elif self.prompt == 'vector':
- self.SetBrush(wx.Brush(wx.Colour(248, 215, 215)))
- else:
- self.SetBrush(wx.LIGHT_GREY_BRUSH)
-
+ self._setBrush()
+
if name:
self.AddText(name)
else:
@@ -1243,6 +1241,27 @@
"""!Get properties dialog"""
self.propWin = win
+ def _setBrush(self):
+ """!Set brush"""
+ if self.prompt == 'raster':
+ color = UserSettings.Get(group='modeler', key='data',
+ subkey=('color', 'raster'))
+ elif self.prompt == 'raster3d':
+ color = UserSettings.Get(group='modeler', key='data',
+ subkey=('color', 'raster3d'))
+ elif self.prompt == 'vector':
+ color = UserSettings.Get(group='modeler', key='data',
+ subkey=('color', 'vector'))
+ else:
+ color = UserSettings.Get(group='modeler', key='action',
+ subkey=('color', 'invalid'))
+ wxColor = wx.Color(color[0], color[1], color[2])
+ self.SetBrush(wx.Brush(wxColor))
+
+ def Update(self):
+ """!Update action"""
+ self._setBrush()
+
class ModelDataDialog(ElementDialog):
"""!Data item properties dialog"""
def __init__(self, parent, shape, id = wx.ID_ANY, title = _("Data properties"),
@@ -1932,9 +1951,71 @@
panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
notebook.AddPage(page = panel, text = _("Data"))
- # size
+ # colors
border = wx.BoxSizer(wx.VERTICAL)
box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
+ label = " %s " % _("Color settings"))
+ sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+
+ gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
+ gridSizer.AddGrowableCol(0)
+
+ row = 0
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Raster:")),
+ flag = wx.ALIGN_LEFT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 0))
+ rColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+ colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster')),
+ size = globalvar.DIALOG_COLOR_SIZE)
+ rColor.SetName('GetColour')
+ self.winId['modeler:data:color:raster'] = rColor.GetId()
+
+ gridSizer.Add(item = rColor,
+ flag = wx.ALIGN_RIGHT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 1))
+
+ row += 1
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("3D raster:")),
+ flag = wx.ALIGN_LEFT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 0))
+ r3Color = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+ colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'raster3d')),
+ size = globalvar.DIALOG_COLOR_SIZE)
+ r3Color.SetName('GetColour')
+ self.winId['modeler:data:color:raster3d'] = r3Color.GetId()
+
+ gridSizer.Add(item = r3Color,
+ flag = wx.ALIGN_RIGHT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 1))
+
+ row += 1
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Vector:")),
+ flag = wx.ALIGN_LEFT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 0))
+ vColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+ colour = self.settings.Get(group='modeler', key='data', subkey=('color', 'vector')),
+ size = globalvar.DIALOG_COLOR_SIZE)
+ vColor.SetName('GetColour')
+ self.winId['modeler:data:color:vector'] = vColor.GetId()
+
+ gridSizer.Add(item = vColor,
+ flag = wx.ALIGN_RIGHT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 1))
+
+ sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
+ border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
+
+ # size
+ box = wx.StaticBox (parent = panel, id = wx.ID_ANY,
label = " %s " % _("Size settings"))
sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
@@ -1990,7 +2071,14 @@
self.parent.GetModel().Update()
self.parent.GetCanvas().Refresh()
+
+ def OnSave(self, event):
+ """!Button 'Save' pressed"""
+ PreferencesBaseDialog.OnSave(self, event)
+ self.parent.GetModel().Update()
+ self.parent.GetCanvas().Refresh()
+
def main():
app = wx.PySimpleApp()
wx.InitAllImageHandlers()
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2010-04-17 09:26:53 UTC (rev 41905)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2010-04-17 09:28:45 UTC (rev 41906)
@@ -532,6 +532,11 @@
},
},
'data' : {
+ 'color': {
+ 'raster' : (215, 215, 248), # light blue
+ 'raster3d' : (215, 248, 215), # light green
+ 'vector' : (248, 215, 215), # light red
+ },
'size' : {
'width' : 175,
'height' : 50,
More information about the grass-commit
mailing list