[GRASS-SVN] r50157 - sandbox/lucadelu
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 12 11:31:27 EST 2012
Author: lucadelu
Date: 2012-01-12 08:31:27 -0800 (Thu, 12 Jan 2012)
New Revision: 50157
Modified:
sandbox/lucadelu/r.li.setup.py
Log:
r.li.setup improvement
Modified: sandbox/lucadelu/r.li.setup.py
===================================================================
--- sandbox/lucadelu/r.li.setup.py 2012-01-12 14:48:43 UTC (rev 50156)
+++ sandbox/lucadelu/r.li.setup.py 2012-01-12 16:31:27 UTC (rev 50157)
@@ -21,8 +21,7 @@
import sys
import os
-sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython',
- 'gui_modules'))
+sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
import wx
import wx.lib.mixins.listctrl as listmix
@@ -30,11 +29,11 @@
import wx.lib.scrolledpanel as scrolled
import time
-import globalvar
-import gselect
-import gcmd
-import utils
-from location_wizard import TitledPage as TitledPage
+from core import globalvar
+from core import gcmd
+from core import utils
+from gui_core import gselect
+from location_wizard.wizard import TitledPage as TitledPage
from grass.script import core as grass
from grass.script import raster as grast
@@ -50,9 +49,9 @@
class RLiSetupFrame(wx.Frame):
def __init__(self, parent, id = wx.ID_ANY,
- style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER,
+ style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER,
title = _("r.li.setup"), **kwargs):
- ###VARIABLES
+ ###VARIABLES
self.parent = parent
self.cmd = "r.li.setup"
self.major_version = int(grass.version()['version'].split('.', 1)[0])
@@ -64,37 +63,37 @@
###END VARIABLES
#init of frame
wx.Frame.__init__(self, parent = parent, id = id, title = title, **kwargs)
- self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
- self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
- #box for select configuration file
+ self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
+ self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
+ #box for select configuration file
self.confilesBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
- label= _('Available sampling area configuration files'))
- self.listfileBox = wx.ListBox(parent = self.panel, id = wx.ID_ANY,
- choices = self.listfiles)
- ###BUTTONS
- #definition
+ label= _('Available sampling area configuration files'))
+ self.listfileBox = wx.ListBox(parent = self.panel, id = wx.ID_ANY,
+ choices = self.listfiles)
+ ###BUTTONS
+ #definition
self.btn_close = wx.Button(parent = self.panel, id = wx.ID_CLOSE)
- self.btn_help = wx.Button(parent = self.panel, id = wx.ID_HELP)
- self.btn_remove = wx.Button(parent = self.panel, id = wx.ID_ANY, label = _("Remove"))
- self.btn_remove.SetToolTipString(_('Remove a configuration file'))
- self.btn_new = wx.Button(parent = self.panel, id = wx.ID_ANY, label = _("Create"))
- self.btn_new.SetToolTipString(_('Create a new configuration file'))
- #set action for button
- self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
- self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
- self.btn_remove.Bind(wx.EVT_BUTTON, self.OnRemove)
- self.btn_new.Bind(wx.EVT_BUTTON, self.OnNew)
- self._layout()
- ###END BUTTONS
+ self.btn_help = wx.Button(parent = self.panel, id = wx.ID_HELP)
+ self.btn_remove = wx.Button(parent = self.panel, id = wx.ID_ANY, label = _("Remove"))
+ self.btn_remove.SetToolTipString(_('Remove a configuration file'))
+ self.btn_new = wx.Button(parent = self.panel, id = wx.ID_ANY, label = _("Create"))
+ self.btn_new.SetToolTipString(_('Create a new configuration file'))
+ #set action for button
+ self.btn_close.Bind(wx.EVT_BUTTON, self.OnClose)
+ self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
+ self.btn_remove.Bind(wx.EVT_BUTTON, self.OnRemove)
+ self.btn_new.Bind(wx.EVT_BUTTON, self.OnNew)
+ self._layout()
+ ###END BUTTONS
- ###SIZE FRAME
- self.SetMinSize(self.GetBestSize())
- ##Please check this because without this the size it is not the min
- self.SetClientSize(self.GetBestSize())
- ###END SIZE
+ ###SIZE FRAME
+ self.SetMinSize(self.GetBestSize())
+ ##Please check this because without this the size it is not the min
+ self.SetClientSize(self.GetBestSize())
+ ###END SIZE
def _layout(self):
- """Set the layout"""
+ """Set the layout"""
sizer = wx.BoxSizer(wx.VERTICAL)
###CONFILES
confilesSizer = wx.StaticBoxSizer(self.confilesBox, wx.HORIZONTAL)
@@ -108,7 +107,7 @@
buttonSizer.Add(item = self.btn_help, flag = wx.ALL, border = 5)
buttonSizer.Add(item = self.btn_close, flag = wx.ALL, border = 5)
###END BUTTONS
- #add to sizer
+ #add to sizer
sizer.Add(item = confilesSizer, proportion = 0,
flag = wx.ALIGN_LEFT | wx.EXPAND | wx.ALL, border = 3)
sizer.Add(item = buttonSizer, proportion = 0,
@@ -120,16 +119,16 @@
self.Layout()
def CheckFolder(self):
- """!Check if the folder of r.li it is present in the .grass7 path"""
- if os.path.exists(self.rlipath):
- return
- else:
- os.mkdir(self.rlipath)
- return
+ """!Check if the folder of r.li it is present in the .grass7 path"""
+ if os.path.exists(self.rlipath):
+ return
+ else:
+ os.mkdir(self.rlipath)
+ return
def ListFiles(self):
- """!Check the configuration files inside the path"""
- return os.listdir(self.rlipath)
+ """!Check the configuration files inside the path"""
+ return os.listdir(self.rlipath)
def OnClose(self,event):
"""!Close window"""
@@ -140,15 +139,15 @@
gcmd.RunCommand('g.manual', parent = self, entry = self.cmd)
def OnRemove(self, event):
- """!Remove configuration file from path and update the list"""
- confile = self.listfiles[self.listfileBox.GetSelections()[0]]
- self.listfileBox.Delete(self.listfileBox.GetSelections()[0])
- grass.try_remove(os.path.join(self.rlipath,confile))
- return
-
+ """!Remove configuration file from path and update the list"""
+ confile = self.listfiles[self.listfileBox.GetSelections()[0]]
+ self.listfileBox.Delete(self.listfileBox.GetSelections()[0])
+ grass.try_remove(os.path.join(self.rlipath,confile))
+ return
+
def OnNew(self, event):
- """!Remove configuration file from path and update the list"""
- RLIWizard(self)
+ """!Remove configuration file from path and update the list"""
+ RLIWizard(self)
class RLIWizard(object):
"""
@@ -161,31 +160,31 @@
#pages
self.startpage = FirstPage(self.wizard, self)
- self.keyboardpage = KeybordPage(self.wizard, self)
- self.samplingareapage = SamplingAreasPage(self.wizard, self)
- self.summarypage = SummaryPage(self.wizard, self)
- self.samplingunitskey = SampleUnitsKeyPage(self.wizard, self)
+ 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.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
- self.wizard.RunWizard(self.startpage)
+ #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.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
+ self.wizard.RunWizard(self.startpage)
class FirstPage(TitledPage):
@@ -203,46 +202,45 @@
self.vect = ''
self.sizer.AddGrowableCol(2)
- #name of output configuration file
- self.newconflabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Name for new configuration file to create'))
+ #name of output configuration file
+ self.newconflabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Name for new configuration file to create'))
- self.newconftxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
- wx.CallAfter(self.newconftxt.SetFocus)
-
- self.sizer.Add(item = self.newconflabel, border=5, pos=(1, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.newconftxt, border=5, pos=(1, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- #raster
- self.mapsellabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Raster map to use to select areas'))
+ self.newconftxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.newconftxt.SetFocus)
+
+ self.sizer.Add(item = self.newconflabel, border=5, pos=(1, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.newconftxt, border=5, pos=(1, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ #raster
+ self.mapsellabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Raster map to use to select areas'))
self.mapselect = gselect.Select(parent = self, id = wx.ID_ANY, size = (250, -1),
- type = 'cell', multiple = False)
- self.sizer.Add(item = self.mapsellabel, border=5, pos=(2, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.mapselect, border=5, pos=(2, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- #vector
- self.vectsellabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Raster map to use to select areas'))
+ type = 'cell', multiple = False)
+ self.sizer.Add(item = self.mapsellabel, border=5, pos=(2, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.mapselect, border=5, pos=(2, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ #vector
+ self.vectsellabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Raster map to use to select areas'))
self.vectselect = gselect.Select(parent = self, id = wx.ID_ANY, size = (250, -1),
- type = 'vector', multiple = False)
- self.sizer.Add(item = self.vectsellabel, border=5, pos=(3, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.vectselect, border=5, pos=(3, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-
+ type = 'vector', multiple = False)
+ self.sizer.Add(item = self.vectsellabel, border=5, pos=(3, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.vectselect, border=5, pos=(3, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
#define sempling region
self.sempling_reg = wx.RadioBox(parent=self, id=wx.ID_ANY,
- label= _("Define sempling region (region for analysis)"),
- choices=[_('Whole map layer'),
- _('Keyboard setting'), _('Draw the sempling frame')],
- majorDimension=wx.RA_SPECIFY_COLS)
+ label= _("Define sempling region (region for analysis)"),
+ choices=[_('Whole map layer'),
+ _('Keyboard setting'), _('Draw the sempling frame')],
+ majorDimension=wx.RA_SPECIFY_COLS)
self.sizer.Add(item=self.sempling_reg,
- flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
- pos=(5, 1), span=(5, 2))
- #bindings
+ flag=wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, border=5,
+ pos=(5, 1), span=(5, 2))
+ #bindings
self.sempling_reg.Bind(wx.EVT_RADIOBOX, self.OnSempling)
self.newconftxt.Bind(wx.EVT_KILL_FOCUS, self.OnName)
self.vectselect.Bind(wx.EVT_TEXT, self.OnVector)
@@ -250,7 +248,7 @@
self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
def OnSempling(self,event):
"""!Change map type"""
@@ -265,19 +263,19 @@
#to remove when I know how to connect or create a monitor
gcmd.GMessage(parent = self,
message = _("Function not supported yet"))
- #event.Veto()
- return
+ #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)
+ 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):
- """!Sets the name of configuration file"""
- self.conf_name = self.newconftxt.GetValue()
- if self.region != '' and self.rast != '' and self.conf_name != '' and not \
- wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ """!Sets the name of configuration file"""
+ self.conf_name = self.newconftxt.GetValue()
+ if self.region != '' and self.rast != '' and self.conf_name != '' and not \
+ wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnRast(self, event):
"""!Sets raster map"""
@@ -289,25 +287,25 @@
def OnVector(self, event):
"""!Sets vector map"""
self.vect = event.GetString()
- if self.region != '' and self.conf_name != '' and self.rast != '' and not \
- wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ if self.region != '' and self.conf_name != '' and self.rast != '' and not \
+ wx.FindWindowById(wx.ID_FORWARD).IsEnabled():
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
def OnExitPage(self, event=None):
"""!Function during exiting"""
- if self.region == '' or self.conf_name == '' or self.rast == '':
+ if self.region == '' or self.conf_name == '' or self.rast == '':
wx.FindWindowById(wx.ID_FORWARD).Enable(False)
else:
wx.FindWindowById(wx.ID_FORWARD).Enable(True)
if event.GetDirection():
- if self.region == 'key':
- self.SetNext(self.parent.keyboardpage)
- self.parent.samplingareapage.SetPrev(self.parent.keyboardpage)
- elif self.region == 'whole':
- self.SetNext(self.parent.samplingareapage)
- self.parent.samplingareapage.SetPrev(self)
- elif self.region == 'draw':
- gcmd.GMessage(parent = self,
+ if self.region == 'key':
+ self.SetNext(self.parent.keyboardpage)
+ self.parent.samplingareapage.SetPrev(self.parent.keyboardpage)
+ elif self.region == 'whole':
+ self.SetNext(self.parent.samplingareapage)
+ self.parent.samplingareapage.SetPrev(self)
+ elif self.region == 'draw':
+ gcmd.GMessage(parent = self,
message = _("Function not supported yet"))
event.Veto()
return
@@ -322,111 +320,122 @@
self.parent = parent
self.sizer.AddGrowableCol(2)
- self.col_len = ''
- self.row_len = ''
+ self.col_len = ''
+ self.row_len = ''
- #column up/left
- self.ColUpLeftlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Column of upper left corner'))
+ #column up/left
+ self.ColUpLeftlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Column of upper left corner'))
- self.ColUpLefttxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
- wx.CallAfter(self.ColUpLeftlabel.SetFocus)
-
- self.sizer.Add(item = self.ColUpLeftlabel, border=5, pos=(1, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.ColUpLefttxt, border=5, pos=(1, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-
- #row up/left
- self.RowUpLeftlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Row of upper left corner'))
+ self.ColUpLefttxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.ColUpLeftlabel.SetFocus)
+
+ self.sizer.Add(item = self.ColUpLeftlabel, border=5, pos=(1, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.ColUpLefttxt, border=5, pos=(1, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+
+ #row up/left
+ self.RowUpLeftlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Row of upper left corner'))
- self.RowUpLefttxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
- wx.CallAfter(self.RowUpLeftlabel.SetFocus)
-
- self.sizer.Add(item = self.RowUpLeftlabel, border=5, pos=(2, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.RowUpLefttxt, border=5, pos=(2, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-
- #row lenght
- self.RowLenlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Row lenght of sampling frame'))
+ self.RowUpLefttxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.RowUpLeftlabel.SetFocus)
+
+ self.sizer.Add(item = self.RowUpLeftlabel, border=5, pos=(2, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.RowUpLefttxt, border=5, pos=(2, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+
+ #row lenght
+ self.RowLenlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Row lenght of sampling frame'))
- self.RowLentxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
- wx.CallAfter(self.RowLenlabel.SetFocus)
-
- self.sizer.Add(item = self.RowLenlabel, border=5, pos=(3, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.RowLentxt, border=5, pos=(3, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-
- #column lenght
- self.ColLenlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Row lenght of sampling frame'))
+ self.RowLentxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.RowLenlabel.SetFocus)
+
+ self.sizer.Add(item = self.RowLenlabel, border=5, pos=(3, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.RowLentxt, border=5, pos=(3, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+
+ #column lenght
+ self.ColLenlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Row lenght of sampling frame'))
- self.ColLentxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
- wx.CallAfter(self.ColLenlabel.SetFocus)
-
- self.sizer.Add(item = self.ColLenlabel, border=5, pos=(4, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.ColLentxt, border=5, pos=(4, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.ColLentxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.ColLenlabel.SetFocus)
+
+ self.sizer.Add(item = self.ColLenlabel, border=5, pos=(4, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.ColLentxt, border=5, pos=(4, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.ColUpLefttxt.Bind(wx.EVT_KILL_FOCUS, self.OnColLeft)
- self.RowUpLefttxt.Bind(wx.EVT_KILL_FOCUS, self.OnRowLeft)
- self.ColLentxt.Bind(wx.EVT_KILL_FOCUS, self.OnColLen)
- self.RowLentxt.Bind(wx.EVT_KILL_FOCUS, self.OnRowLeft)
- self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
+ self.ColUpLefttxt.Bind(wx.EVT_KILL_FOCUS, self.OnColLeft)
+ self.RowUpLefttxt.Bind(wx.EVT_KILL_FOCUS, self.OnRowLeft)
+ self.ColLentxt.Bind(wx.EVT_KILL_FOCUS, self.OnColLen)
+ self.RowLentxt.Bind(wx.EVT_KILL_FOCUS, self.OnRowLeft)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
def OnColLeft(self,event):
- """!Sets the name of configuration file"""
- self.col_up = self.ColUpLefttxt.GetValue()
+ """!Sets the name of configuration file"""
+ self.col_up = self.ColUpLefttxt.GetValue()
checkValue(self.col_up)
+ if self.col_up == '':
+ 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_up = self.RowUpLefttxt.GetValue()
- checkValue(self.row_up)
- #if self.row_up == '':
- #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- #else:
- #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
-
+ """!Sets the name of configuration file"""
+ self.row_up = self.RowUpLefttxt.GetValue()
+ 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()
- checkValue(self.col_len)
- #if self.col_len == '':
- #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- #else:
- #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
-
+ """!Sets the name of configuration file"""
+ self.col_len = self.ColLentxt.GetValue()
+ 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()
- checkValue(self.row_len)
- #if self.row_len == '':
- #wx.FindWindowById(wx.ID_FORWARD).Enable(False)
- #else:
- #wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ """!Sets the name of configuration file"""
+ self.row_len = self.RowLentxt.GetValue()
+ 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
"""
- self.col_up = '0'
- self.row_up = '0'
- if self.col_len == '' and self.row_len == '':
- rastinfo = grast.raster_info(self.parent.startpage.rast)
- self.col_len = rastinfo['cols']
- self.row_len = rastinfo['rows']
-
- self.ColUpLefttxt.SetValue(self.col_up)
- self.RowUpLefttxt.SetValue(self.row_up)
- self.ColLentxt.SetValue(self.col_len)
- self.RowLentxt.SetValue(self.row_len)
-
+ self.col_up = '0'
+ self.row_up = '0'
+ if self.col_len == '' and self.row_len == '':
+ rastinfo = grast.raster_info(self.parent.startpage.rast)
+ self.col_len = rastinfo['cols']
+ self.row_len = rastinfo['rows']
+
+ self.ColUpLefttxt.SetValue(self.col_up)
+ self.RowUpLefttxt.SetValue(self.row_up)
+ self.ColLentxt.SetValue(self.col_len)
+ self.RowLentxt.SetValue(self.row_len)
+ def OnExitPage(self, event=None):
+ """!Function during exiting"""
+ if self.row_len == '' or self.col_len == '' or self.row_up == '' or self.col_up == '':
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ else:
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+
class SamplingAreasPage(TitledPage):
"""
Set name of configuration file, choose raster and optionally vector/sites
@@ -434,7 +443,7 @@
def __init__(self, wizard, parent):
TitledPage.__init__(self, wizard, _("Insert sempling areas"))
- self.samplingtype = 'whole'
+ self.samplingtype = 'whole'
self.parent = parent
self.sizer.AddGrowableCol(2)
# toggles
@@ -456,8 +465,8 @@
self.sizer.Add(item = self.radio3, flag = wx.ALIGN_LEFT, pos = (3, 1))
self.sizer.Add(item = self.radio4, flag = wx.ALIGN_LEFT, pos = (4, 1))
- wx.FindWindowById(wx.ID_FORWARD).Enable(False)
-
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+
# bindings
self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio1.GetId())
self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio2.GetId())
@@ -469,18 +478,18 @@
"""!Insert values into text controls for summary of location
creation options
"""
- try:
+ try:
self.sizer.Hide(self.radio5)
- self.sizer.Remove(self.radio5)
- self.sizer.Layout()
- except:
- pass
- if self.parent.startpage.vect != '':
- self.radio5 = wx.RadioButton(parent = self, id = wx.ID_ANY,
- label = _("Select areas from the "
- "overlayed vector map"))
- self.sizer.Add(item = self.radio5, flag = wx.ALIGN_LEFT, pos = (5, 1))
- self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio5.GetId())
+ self.sizer.Remove(self.radio5)
+ self.sizer.Layout()
+ except:
+ pass
+ if self.parent.startpage.vect != '':
+ self.radio5 = wx.RadioButton(parent = self, id = wx.ID_ANY,
+ label = _("Select areas from the "
+ "overlayed vector map"))
+ self.sizer.Add(item = self.radio5, flag = wx.ALIGN_LEFT, pos = (5, 1))
+ self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio5.GetId())
def SetVal(self, event):
"""!Choose method"""
@@ -492,9 +501,11 @@
self.Region()
elif event.GetId() == self.radio3.GetId():
self.samplingtype = 'units'
+ self.SetNext(self.parent.samplingunitskey)
self.KeyDraw()
elif event.GetId() == self.radio4.GetId():
self.samplingtype = 'moving'
+ self.SetNext(self.parent.samplingunitskey)
self.KeyDraw()
elif event.GetId() == self.radio5.GetId():
self.samplingtype = 'vector'
@@ -502,42 +513,42 @@
def Region(self):
"""show this only if radio2 it is selected"""
- try:
+ try:
self.sizer.Hide(self.regionBox)
- self.sizer.Remove(self.regionBox)
- self.sizer.Layout()
- except:
- pass
- #self.regionBox = wx.GridBagSizer(vgap = 1, hgap = 2)
- #self.regionLabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- #label = _('Enter the number of region to draw'))
- #self.regionTxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(50, -1))
- #self.regionBox.Add(self.regionLabel, pos = (1, 1))
- #self.regionBox.Add(self.regionTxt, pos = (1, 2))
- #self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
- #self.sizer.Layout()
- #self.SetNext(self.parent.draw)
- gcmd.GMessage(parent = self, message = _("Function not supported yet"))
+ self.sizer.Remove(self.regionBox)
+ self.sizer.Layout()
+ except:
+ pass
+ #self.regionBox = wx.GridBagSizer(vgap = 1, hgap = 2)
+ #self.regionLabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ #label = _('Enter the number of region to draw'))
+ #self.regionTxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(50, -1))
+ #self.regionBox.Add(self.regionLabel, pos = (1, 1))
+ #self.regionBox.Add(self.regionTxt, pos = (1, 2))
+ #self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
+ #self.sizer.Layout()
+ #self.SetNext(self.parent.draw)
+ gcmd.GMessage(parent = self, message = _("Function not supported yet"))
return
def KeyDraw(self):
- """Show this only if radio3 and radio4 it is selected"""
- try:
+ """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:
- pass
- self.regionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
- label= _("Choose a method"),
- choices=[_('Use keyboard to enter sampling area'),
- _('Use mouse to draw sampling area')],
- majorDimension=wx.RA_SPECIFY_COLS)
- self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
- self.sizer.Layout()
- self.regionbox = 'keybord'
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
- self.regionBox.Bind(wx.EVT_RADIOBOX, self.OnRegionDraw)
+ self.sizer.Remove(self.regionBox)
+ self.sizer.Layout()
+ except:
+ pass
+ self.regionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
+ label= _("Choose a method"),
+ choices=[_('Use keyboard to enter sampling area'),
+ _('Use mouse to draw sampling area')],
+ majorDimension=wx.RA_SPECIFY_COLS)
+ self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
+ self.sizer.Layout()
+ self.regionbox = 'keybord'
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ self.regionBox.Bind(wx.EVT_RADIOBOX, self.OnRegionDraw)
def OnRegionDraw(self,event):
"""Function called by KeyDraw to find what method is choosed"""
@@ -556,14 +567,14 @@
def DrawNothing(self):
""""""
- try:
+ try:
self.sizer.Hide(self.regionBox)
- self.sizer.Remove(self.regionBox)
- self.sizer.Layout()
- except:
- pass
- self.SetNext(self.parent.summarypage)
- wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+ self.sizer.Remove(self.regionBox)
+ self.sizer.Layout()
+ except:
+ pass
+ self.SetNext(self.parent.summarypage)
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
class SampleUnitsKeyPage(TitledPage):
"""!Set values from keyboard for sample units"""
@@ -572,91 +583,176 @@
TitledPage.__init__(self, wizard, _("Units"))
self.parent = parent
- self.sizer.AddGrowableCol(2)
- self.typeBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
+ self.sizer.AddGrowableCol(2)
+ self.sizew = ''
+ self.sizeh = ''
+ # type of shape
+ self.typeBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
label= _("Select type of shape"),
choices=[_('Rectangle'), _('Circle')],
- majorDimension=wx.RA_SPECIFY_COLS)
- self.distributionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
- label= _("Select method of sampling unit distribution"),
- choices=[_('Random non overlapping'),
- _('Systematic contiguos'), _('Stratified random'),
- _('Systematic non contiguos'), _('Centered over sites')],
- majorDimension=wx.RA_SPECIFY_COLS)
- self.sizer.Add(self.typeBox, flag = wx.ALIGN_LEFT, pos = (1, 1))
- self.sizer.Add(self.distributionBox, flag = wx.ALIGN_LEFT, pos = (2, 1))
+ style=wx.VERTICAL)
+ 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')]
+ self.distributionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
+ label= _("Select method of sampling unit distribution"),
+ choices = choicess, style=wx.VERTICAL)
+ self.sizer.Add(self.distributionBox, pos = (1, 2),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ # size width
+ self.sizewidth = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('What wide size (in cells)'))
+ self.sizewidthtxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ self.sizer.Add(self.sizewidth, pos = (2, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(self.sizewidthtxt, border=5, pos=(2, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ # size width
+ wx.CallAfter(self.sizewidthtxt.SetFocus)
+ self.sizehight = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('What high size (in cells)'))
+ self.sizehighttxt = wx.TextCtrl(parent = self, id = wx.ID_ANY, size=(250, -1))
+ wx.CallAfter(self.sizewidthtxt.SetFocus)
+ self.sizer.Add(self.sizehight, pos = (3, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(self.sizehighttxt, border=5, pos=(3, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.typeBox.Bind(wx.EVT_RADIOBOX, self.OnType)
- self.distributionBox.Bind(wx.EVT_RADIOBOX, self.OnMethod)
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ self.typeBox.Bind(wx.EVT_RADIOBOX, self.OnType)
+ self.distributionBox.Bind(wx.EVT_RADIOBOX, self.OnMethod)
+ self.sizewidthtxt.Bind(wx.EVT_KILL_FOCUS, self.OnNameW)
+ self.sizehighttxt.Bind(wx.EVT_KILL_FOCUS, self.OnNameH)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnExitPage)
- def OnType(self):
- if event.GetInt() == 0:
- print "activate the textctrl for rectangle"
- elif event.GetInt() == 1:
- print "activate the textctrl for circle"
+ def OnEnterPage(self, event):
+ """!Check if sites vector it is present"""
+ # method of distribution
+ if self.parent.startpage.vect != '':
+ self.distributionBox.SetItemLabel(5, _('Centered over sites'))
+ self.sizer.Layout()
+
+ def OnExitPage(self, event=None):
+ """!Function during exiting"""
+ if self.sizew == '' or self.sizeh == '':
+ wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+ else:
+ wx.FindWindowById(wx.ID_FORWARD).Enable(True)
+
+ def OnNameW(self,event):
+ """!Sets the name of configuration file"""
+ self.sizew = self.sizewidthtxt.GetValue()
+
+ def OnNameH(self,event):
+ """!Sets the name of configuration file"""
+ self.sizeh = self.sizehighttxt.GetValue()
+
+ def OnType(self,event):
+ if event.GetInt() == 0:
+ try:
+ self.sizer.Hide(self.sizewidth)
+ self.sizer.Remove(self.sizewidth)
+ self.sizer.Hide(self.sizehight)
+ self.sizer.Remove(self.sizehight)
+ self.sizer.Layout()
+ except:
+ pass
+ self.sizewidth = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('What wide size (in cells)'))
+ self.sizehight = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('What high size (in cells)'))
+ self.sizer.Add(self.sizewidth, pos = (2, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(self.sizehight, pos = (3, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Layout()
+ elif event.GetInt() == 1:
+ try:
+ self.sizer.Hide(self.sizewidth)
+ self.sizer.Remove(self.sizewidth)
+ self.sizer.Hide(self.sizehight)
+ self.sizer.Remove(self.sizehight)
+ self.sizer.Layout()
+ except:
+ pass
+ self.sizewidth = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('What radius size (in meters)'))
+ self.sizehight = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Name for the circle mask'))
+ self.sizer.Add(self.sizewidth, pos = (2, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(self.sizehight, pos = (3, 1),
+ flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Layout()
- def OnMethod(self):
- if event.GetInt() == 0:
- print "Random non overlapping"
- elif event.GetInt() == 1:
- print "Systematic contiguos"
- elif event.GetInt() == 2:
- print "Stratified random"
- elif event.GetInt() == 3:
- print "Systematic non contiguos"
- elif event.GetInt() == 4:
- print "Centered over sites"
+ def OnMethod(self,event):
+ if event.GetInt() == 0:
+ # exit a window asking "What number of sampling units to use"
+ print "Random non overlapping"
+ elif event.GetInt() == 1:
+ # no window more
+ print "Systematic contiguos"
+ elif event.GetInt() == 2:
+ # exit a window asking "Insert distance between units"
+ print "Stratified random"
+ elif event.GetInt() == 3:
+ # exit a window asking "Insert number of row strates" and "Insert number of column strates"
+ print "Systematic non contiguos"
+ elif event.GetInt() == 4:
+ print "Centered over sites"
class SummaryPage(TitledPage):
"""!Shows summary result of choosing data"""
def __init__(self, wizard, parent):
TitledPage.__init__(self, wizard, _("Summary"))
- global rlisettings
+ global rlisettings
self.parent = parent
self.sizer.AddGrowableCol(2)
- #configuration file name
- self.conflabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Configuration file name:'))
- self.conftxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.conflabel, border=5, pos=(1, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.conftxt, border=5, pos=(1, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ #configuration file name
+ self.conflabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Configuration file name:'))
+ self.conftxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.conflabel, border=5, pos=(1, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.conftxt, border=5, pos=(1, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- #raster name
- self.rastlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Raster name:'))
- self.rasttxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.rastlabel, border=5, pos=(2, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.rasttxt, border=5, pos=(2, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
-
- #region type name
- self.regionlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Region type:'))
- self.regiontxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.regionlabel, border=5, pos=(4, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.regiontxt, border=5, pos=(4, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ #raster name
+ self.rastlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Raster name:'))
+ self.rasttxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.rastlabel, border=5, pos=(2, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.rasttxt, border=5, pos=(2, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+
+ #region type name
+ self.regionlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Region type:'))
+ self.regiontxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.regionlabel, border=5, pos=(4, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.regiontxt, border=5, pos=(4, 2),
+ 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:'))
- self.samplingtxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.samplinglabel, border=5, pos=(6, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.samplingtxt, border=5, pos=(6, 2),
+ 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:'))
+ self.samplingtxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.samplinglabel, border=5, pos=(6, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.samplingtxt, border=5, pos=(6, 2),
flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
def OnEnterPage(self, event):
@@ -667,48 +763,48 @@
self.rasttxt.SetLabel(self.parent.startpage.rast)
self.samplingtxt.SetLabel(self.parent.samplingareapage.samplingtype)
self.regiontxt.SetLabel(self.parent.startpage.region)
- try:
- #try to remove label and text of vector and region key
- self.sizer.Hide(self.vectlabel)
- self.sizer.Hide(self.vecttxt)
- self.sizer.Remove(self.vectlabel)
- self.sizer.Remove(self.vecttxt)
-
- self.sizer.Hide(self.regionkeylabel)
- self.sizer.Hide(self.regionkeytxt)
- self.sizer.Remove(self.regionkeylabel)
- self.sizer.Remove(self.regionkeytxt)
- self.sizer.Layout()
- except:
- pass
+ try:
+ #try to remove label and text of vector and region key
+ self.sizer.Hide(self.vectlabel)
+ self.sizer.Hide(self.vecttxt)
+ self.sizer.Remove(self.vectlabel)
+ self.sizer.Remove(self.vecttxt)
+
+ self.sizer.Hide(self.regionkeylabel)
+ self.sizer.Hide(self.regionkeytxt)
+ self.sizer.Remove(self.regionkeylabel)
+ self.sizer.Remove(self.regionkeytxt)
+ self.sizer.Layout()
+ except:
+ pass
if self.parent.startpage.vect != '':
- #vector name
- self.vectlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Vector name:'))
- self.vecttxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.vectlabel, border=5, pos=(3, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.vecttxt, border=5, pos=(3, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.vecttxt.SetLabel(self.parent.startpage.vect)
+ #vector name
+ self.vectlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Vector name:'))
+ self.vecttxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.vectlabel, border=5, pos=(3, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.vecttxt, border=5, pos=(3, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.vecttxt.SetLabel(self.parent.startpage.vect)
if self.parent.startpage.region == 'key':
- #region keybord values
- self.regionkeylabel = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = _('Region keybord values:'))
+ #region keybord values
+ self.regionkeylabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = _('Region keybord values:'))
- self.regionkeytxt = wx.StaticText(parent = self, id = wx.ID_ANY,
- label = "")
- self.sizer.Add(item = self.regionkeylabel, border=5, pos=(5, 1),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- self.sizer.Add(item = self.regionkeytxt, border=5, pos=(5, 2),
- flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
- regKeyVals = "Column left up: %s - Row left up: %s\nColumn length: %s - Row length: %s\n" \
- % (self.parent.keyboardpage.col_up, self.parent.keyboardpage.row_up,
- self.parent.keyboardpage.col_len, self.parent.keyboardpage.row_len)
- self.regionkeytxt.SetLabel(regKeyVals)
+ self.regionkeytxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+ label = "")
+ self.sizer.Add(item = self.regionkeylabel, border=5, pos=(5, 1),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ self.sizer.Add(item = self.regionkeytxt, border=5, pos=(5, 2),
+ flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+ regKeyVals = "Column left up: %s - Row left up: %s\nColumn length: %s - Row length: %s\n" \
+ % (self.parent.keyboardpage.col_up, self.parent.keyboardpage.row_up,
+ self.parent.keyboardpage.col_len, self.parent.keyboardpage.row_len)
+ self.regionkeytxt.SetLabel(regKeyVals)
if __name__ == "__main__":
More information about the grass-commit
mailing list