[GRASS-SVN] r49251 - sandbox/lucadelu
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 14 18:25:50 EST 2011
Author: lucadelu
Date: 2011-11-14 15:25:50 -0800 (Mon, 14 Nov 2011)
New Revision: 49251
Modified:
sandbox/lucadelu/r.li.setup.py
Log:
improvements
Modified: sandbox/lucadelu/r.li.setup.py
===================================================================
--- sandbox/lucadelu/r.li.setup.py 2011-11-14 21:17:51 UTC (rev 49250)
+++ sandbox/lucadelu/r.li.setup.py 2011-11-14 23:25:50 UTC (rev 49251)
@@ -42,6 +42,12 @@
## r.li.windows.tcl:
#exec echo "SAMPLINGFRAME $per_x|$per_y|$per_rl|$per_cl" >> $env(TMP).set
+def checkValue(value):
+ if value == '':
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ else:
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+
class RLiSetupFrame(wx.Frame):
def __init__(self, parent, id = wx.ID_ANY,
style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER,
@@ -158,19 +164,24 @@
self.keyboardpage = KeybordPage(self.wizard, self)
self.samplingareapage = SamplingAreasPage(self.wizard, self)
self.summarypage = SummaryPage(self.wizard, self)
+ self.samplingunitskey = SampleUnitsKeyPage(self.wizard, self)
#order of pages
self.startpage.SetNext(self.samplingareapage)
self.keyboardpage.SetPrev(self.startpage)
self.keyboardpage.SetNext(self.samplingareapage)
self.samplingareapage.SetPrev(self.startpage)
- self.samplingareapage.SetNext(self.summarypage)
+ self.samplingareapage.SetNext(self.samplingunitskey)
+ self.samplingunitskey.SetPrev(self.samplingareapage)
+ self.samplingunitskey.SetNext(self.summarypage)
self.summarypage.SetPrev(self.samplingareapage)
+
#layout
self.startpage.DoLayout()
self.keyboardpage.DoLayout()
self.samplingareapage.DoLayout()
self.summarypage.DoLayout()
+ self.samplingunitskey.DoLayout()
self.wizard.FitToPage(self.startpage)
#run_wizard
@@ -251,9 +262,14 @@
self.SetNext(self.parent.keyboardpage)
elif event.GetInt() == 2:
self.region = 'draw'
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- if self.conf_name != '' and self.rast != '' and not \
- wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
+ #to remove when I know how to connect or create a monitor
+ gcmd.GMessage(parent = self,
+ message = _("Function not supported yet"))
+ #event.Veto()
+ return
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ if self.conf_name != '' and self.rast != '' and not self.region == 'draw' \
+ and not wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnName(self,event):
@@ -275,6 +291,7 @@
self.vect = event.GetString()
def OnExitPage(self, event=None):
+ """!Function during exiting"""
if self.region == '' or self.conf_name == '' or self.rast == '':
wx.FindWindowById(wx.ID_FORWARD).Enable(False)
else:
@@ -363,34 +380,34 @@
def OnColLeft(self,event):
"""!Sets the name of configuration file"""
self.col_up = self.ColUpLefttxt.GetValue()
- if self.col_up == '':
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- else:
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ checkValue(self.col_up)
def OnRowLeft(self,event):
"""!Sets the name of configuration file"""
self.row_up = self.RowUpLefttxt.GetValue()
- if self.row_up == '':
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- else:
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ checkValue(self.row_up)
+ #if self.row_up == '':
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ #else:
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnColLen(self,event):
"""!Sets the name of configuration file"""
self.col_len = self.ColLentxt.GetValue()
- if self.col_len == '':
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- else:
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ checkValue(self.col_len)
+ #if self.col_len == '':
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ #else:
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnRowLeft(self,event):
"""!Sets the name of configuration file"""
self.row_len = self.RowLentxt.GetValue()
- if self.row_len == '':
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- else:
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ checkValue(self.row_len)
+ #if self.row_len == '':
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ #else:
+ #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnEnterPage(self, event):
"""!Sets the default values, for the entire map
@@ -412,7 +429,7 @@
"""
Set name of configuration file, choose raster and optionally vector/sites
"""
-
+
def __init__(self, wizard, parent):
TitledPage.__init__(self, wizard, _("Insert sempling areas"))
self.samplingtype = 'whole'
@@ -454,7 +471,7 @@
self.sizer.Hide(self.radio5)
self.sizer.Remove(self.radio5)
self.sizer.Layout()
- except AttributeError:
+ except AttributeError, TypeError:
pass
if self.parent.startpage.vect != '':
self.radio5 = wx.RadioButton(parent = self, id = wx.ID_ANY,
@@ -482,12 +499,12 @@
self.DrawNothing()
def Region(self):
- #show this only if radio2 it is selected
+ """show this only if radio2 it is selected"""
try:
self.sizer.Hide(self.regionBox)
self.sizer.Remove(self.regionBox)
self.sizer.Layout()
- except AttributeError:
+ except AttributeError, TypeError:
pass
self.regionBox = wx.GridBagSizer(vgap = 1, hgap = 2)
self.regionLabel = wx.StaticText(parent = self, id = wx.ID_ANY,
@@ -499,12 +516,12 @@
self.sizer.Layout()
def KeyDraw(self):
- #show this only if radio3 and radio4 it is selected
+ """Show this only if radio3 and radio4 it is selected"""
try:
self.sizer.Hide(self.regionBox)
self.sizer.Remove(self.regionBox)
self.sizer.Layout()
- except AttributeError:
+ except AttributeError, TypeError:
pass
self.regionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
label= _("Choose a method"),
@@ -516,23 +533,28 @@
wx.FindWindowById(wx.ID_FORWARD).Enable(False)
self.regionBox.Bind(wx.EVT_RADIOBOX, self.OnRegionDraw)
- def OnRegionDraw(self):
+ def OnRegionDraw(self,event):
+ """Function called by KeyDraw to find what method is choosed"""
if event.GetInt() == 0:
- self.region = 'whole'
- self.SetNext(self.parent.samplingareapage)
+ self.regionbox = 'keybord'
+ self.SetNext(self.parent.samplingunitskey)
+
elif event.GetInt() == 1:
- self.region = 'key'
- self.SetNext(self.parent.keyboardpage)
- if self.conf_name != '' and self.rast != '' and not \
- wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ self.regionbox = 'drawmouse'
+ #to remove when I know how to connect or create a monitor
+ gcmd.GMessage(parent = self,
+ message = _("Function not supported yet"))
+ return
+ #self.SetNext(self.parent.draw)
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def DrawNothing(self):
+ """"""
try:
self.sizer.Hide(self.regionBox)
self.sizer.Remove(self.regionBox)
self.sizer.Layout()
- except AttributeError:
+ except AttributeError, TypeError:
pass
wx.FindWindowById(wx.ID_FORWARD).Enable(True)
More information about the grass-commit
mailing list