[GRASS-SVN] r50617 - sandbox/lucadelu
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 1 12:21:49 EST 2012
Author: lucadelu
Date: 2012-02-01 09:21:49 -0800 (Wed, 01 Feb 2012)
New Revision: 50617
Modified:
sandbox/lucadelu/r.li.setup.py
Log:
improvement
Modified: sandbox/lucadelu/r.li.setup.py
===================================================================
--- sandbox/lucadelu/r.li.setup.py 2012-02-01 16:03:42 UTC (rev 50616)
+++ sandbox/lucadelu/r.li.setup.py 2012-02-01 17:21:49 UTC (rev 50617)
@@ -184,9 +184,40 @@
self.wizard.FitToPage(self.startpage)
#run_wizard
- self.wizard.RunWizard(self.startpage)
+ if self.wizard.RunWizard(self.startpage):
+ dlg = wx.MessageDialog(parent = self.parent,
+ message = _("Do you want to create r.li configuration file <%s>?") % self.startpage.conf_name,
+ caption = _("Create new r.li configuration file?"),
+ style = wx.YES_NO | wx.YES_DEFAULT | wx.ICON_QUESTION)
+
+ if dlg.ShowModal() == wx.ID_NO:
+ dlg.Destroy()
+ print "no"
+ self._cleanup()
+ else:
+ dlg.Destroy()
+ print "yes"
+ self._cleanup()
+ else:
+ self.wizard.Destroy()
+ gcmd.GMessage(parent = self.parent,
+ message = _("r.li.setup wizard canceled. "
+ "Configuration file not created."))
+ self._cleanup()
+ def _cleanup(self):
+ self.startpage.conf_name = ''
+ self.startpage.rast = ''
+ self.startpage.vect = ''
+ self.startpage.region = 'whole'
+ self.keyboardpage.col_len = ''
+ self.keyboardpage.row_len = ''
+ self.samplingareapage.samplingtype = 'whole'
+ self.samplingunitskey.sizew = ''
+ self.samplingunitskey.sizeh = ''
+
+
class FirstPage(TitledPage):
"""
Set name of configuration file, choose raster and optionally vector/sites
@@ -196,10 +227,6 @@
TitledPage.__init__(self, wizard, _("Select maps and define name"))
self.parent = parent
- self.region = 'whole'
- self.rast = ''
- self.conf_name = ''
- self.vect = ''
self.sizer.AddGrowableCol(2)
#name of output configuration file
@@ -246,6 +273,7 @@
self.vectselect.Bind(wx.EVT_TEXT, self.OnVector)
self.mapselect.Bind(wx.EVT_TEXT, self.OnRast)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
wx.FindWindowById(wx.ID_FORWARD).Enable(False)
@@ -310,6 +338,14 @@
event.Veto()
return
+ def OnEnterPage(self, event=None):
+ """!Function during entry"""
+ self.region = 'whole'
+ self.rast = ''
+ self.conf_name = ''
+ self.vect = ''
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+
class KeybordPage(TitledPage):
"""
Set name of configuration file, choose raster and optionally vector/sites
@@ -594,10 +630,12 @@
self.sizer.Add(self.typeBox, pos = (1, 1),
flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
choicess = [_('Random non overlapping'), _('Systematic contiguos'),
- _('Stratified random'), _('Systematic non contiguos')]
+ _('Stratified random'), _('Systematic non contiguos'),
+ _('Centered over sites')]
self.distributionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
label= _("Select method of sampling unit distribution"),
choices = choicess, style=wx.VERTICAL)
+ self.distributionBox.EnableItem(4,False)
self.sizer.Add(self.distributionBox, pos = (1, 2),
flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
# size width
@@ -631,7 +669,7 @@
"""!Check if sites vector it is present"""
# method of distribution
if self.parent.startpage.vect != '':
- self.distributionBox.SetItemLabel(5, _('Centered over sites'))
+ self.distributionBox.EnableItem(5, True)
self.sizer.Layout()
def OnExitPage(self, event=None):
@@ -744,7 +782,6 @@
flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
-
#sampling area
self.samplinglabel = wx.StaticText(parent = self, id = wx.ID_ANY,
label = _('Sempling area type:'))
More information about the grass-commit
mailing list