[GRASS-SVN] r42501 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 7 19:10:13 EDT 2010
Author: martinl
Date: 2010-06-07 19:10:13 -0400 (Mon, 07 Jun 2010)
New Revision: 42501
Modified:
grass/trunk/gui/wxpython/gui_modules/gmodeler.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
grass/trunk/gui/wxpython/gui_modules/preferences.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
Log:
wxGUI/modeler: first steps towards variables
Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-06-07 23:07:54 UTC (rev 42500)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-06-07 23:10:13 UTC (rev 42501)
@@ -170,7 +170,8 @@
parameterized = True
break
for p in task.get_options()['params']:
- if p.get('value', '') == '' and \
+ if p.get('required', 'no') != 'no' and \
+ p.get('value', '') == '' and \
p.get('default', '') == '':
valid = False
if p.get('parameterized', False):
@@ -473,6 +474,10 @@
dlg.Destroy()
+ def OnModelVariables(self, event):
+ """!Manage (define) model variables"""
+ pass
+
def OnDeleteData(self, event):
"""!Delete intermediate data"""
rast, vect, rast3d, msg = self.model.GetIntermediateData()
@@ -1087,7 +1092,8 @@
# valid ?
valid = True
for p in params['params']:
- if p.get('value', '') == '' and \
+ if p.get('required', 'no') != 'no' and \
+ p.get('value', '') == '' and \
p.get('default', '') == '':
valid = False
break
@@ -1399,6 +1405,10 @@
"""!Set action parameterized"""
self.isParameterized = isparameterized
self._setPen()
+
+ def IsParameterized(self):
+ """!Check if action is parameterized"""
+ return self.isParameterized
def AddData(self, item):
"""!Register new data item"""
@@ -1482,9 +1492,11 @@
def GetLog(self, string = True):
"""!Get logging info"""
- if self.rels['from']:
- name = self.rels['from'].GetName()
- return name + '=' + self.value + ' (' + self.prompt + ')'
+ name = list()
+ for rel in self.rels['from'] + self.rels['to']:
+ name.append(rel.GetName())
+ if name:
+ return '/'.join(name) + '=' + self.value + ' (' + self.prompt + ')'
else:
return _('unknown')
@@ -1569,8 +1581,25 @@
def _setPen(self):
"""!Set pen"""
- pen = wx.Pen("black")
- pen.SetWidth(1)
+ isParameterized = False
+ for rel in self.rels['from']:
+ if rel.GetTo().IsParameterized():
+ isParameterized = True
+ break
+ if not isParameterized:
+ for rel in self.rels['to']:
+ if rel.GetFrom().IsParameterized():
+ isParameterized = True
+ break
+
+ if isParameterized:
+ width = int(UserSettings.Get(group='modeler', key='action',
+ subkey=('width', 'parameterized')))
+ else:
+ width = int(UserSettings.Get(group='modeler', key='action',
+ subkey=('width', 'default')))
+ pen = self.GetPen()
+ pen.SetWidth(width)
self.SetPen(pen)
def _setText(self):
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-06-07 23:07:54 UTC (rev 42500)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-06-07 23:10:13 UTC (rev 42501)
@@ -1545,6 +1545,11 @@
ifbb = wx.TextCtrl(parent = which_panel, id = wx.ID_ANY,
style = wx.TE_MULTILINE,
size = (-1, 75))
+ if p.get('value', '') and os.path.isfile(p['value']):
+ f = open(p['value'])
+ ifbb.SetValue(''.join(f.readlines()))
+ f.close()
+
ifbb.Bind(wx.EVT_TEXT, self.OnFileText)
which_sizer.Add(item = wx.StaticText(parent = which_panel, id = wx.ID_ANY,
label = _('or enter values interactively')),
Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py 2010-06-07 23:07:54 UTC (rev 42500)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py 2010-06-07 23:10:13 UTC (rev 42501)
@@ -514,6 +514,13 @@
'lighting' : {
'color' : (255, 255, 255, 255), # white
},
+ 'lighting' : {
+ 'pos' : {
+ 'x' : 0.68,
+ 'y' : 0.68,
+ 'z' : 0.80,
+ },
+ },
},
'modeler' : {
'action' : {
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2010-06-07 23:07:54 UTC (rev 42500)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2010-06-07 23:10:13 UTC (rev 42501)
@@ -307,6 +307,7 @@
self.zoomout,
self.zoomback,
self.zoommenu,
+ self.zoomextent,
self.analyze,
self.dec,
self.printmap):
@@ -1403,7 +1404,8 @@
self.run = wx.NewId()
self.validate = wx.NewId()
self.settings = wx.NewId()
- self.properties = wx.NewId()
+ # self.properties = wx.NewId()
+ self.variables = wx.NewId()
self.quit = wx.NewId()
# tool, label, bitmap, kind, shortHelp, longHelp, handler
@@ -1433,9 +1435,12 @@
(self.relation, 'relation', Icons['modelRelation'].GetBitmap(),
wx.ITEM_NORMAL, Icons['modelRelation'].GetLabel(), Icons['modelRelation'].GetDesc(),
self.parent.OnDefineRelation),
- (self.properties, "properties", Icons["modelProperties"].GetBitmap(),
- wx.ITEM_NORMAL, Icons["modelProperties"].GetLabel(), Icons["modelProperties"].GetDesc(),
- self.parent.OnModelProperties),
+ # (self.properties, "properties", Icons["modelProperties"].GetBitmap(),
+ # wx.ITEM_NORMAL, Icons["modelProperties"].GetLabel(), Icons["modelProperties"].GetDesc(),
+ # self.parent.OnModelProperties),
+ (self.variables, "variables", Icons["modelVariables"].GetBitmap(),
+ wx.ITEM_NORMAL, Icons["modelVariables"].GetLabel(), Icons["modelVariables"].GetDesc(),
+ self.parent.OnModelVariables),
('', '', '', '', '', '', ''),
(self.run, 'run', Icons['modelRun'].GetBitmap(),
wx.ITEM_NORMAL, Icons['modelRun'].GetLabel(), Icons['modelRun'].GetDesc(),
More information about the grass-commit
mailing list