[GRASS-SVN] r49158 - sandbox/lucadelu

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 9 12:32:54 EST 2011


Author: lucadelu
Date: 2011-11-09 09:32:54 -0800 (Wed, 09 Nov 2011)
New Revision: 49158

Modified:
   sandbox/lucadelu/r.li.setup.py
Log:
little improve

Modified: sandbox/lucadelu/r.li.setup.py
===================================================================
--- sandbox/lucadelu/r.li.setup.py	2011-11-09 17:13:57 UTC (rev 49157)
+++ sandbox/lucadelu/r.li.setup.py	2011-11-09 17:32:54 UTC (rev 49158)
@@ -21,11 +21,10 @@
 import sys
 import os
 
-global rlisettings
+#global rlisettings
+#rlisettings = {'region' : 'whole', 'rast' : '', 'vect' : '', 
+	      #'conf_name' : '', 'vectorarea' : True, }   
 
-rlisettings = {'region' : 'whole', 'rast' : '', 'vect' : '', 
-	      'conf_name' : '', 'vectorarea' : True, }   
-
 sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython',
                                  'gui_modules'))
 
@@ -464,12 +463,13 @@
         self.sizer.Add(item = self.radio2, flag = wx.ALIGN_LEFT, pos = (2, 1))
         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))
+        
         if self.parent.startpage.vectorarea:
         #if rlisetting['vectorarea']:
 	    self.sizer.Add(item = self.radio5, flag = wx.ALIGN_LEFT, pos = (5, 1))
+	    
 	wx.FindWindowById(wx.ID_FORWARD).Enable(False)
-        self.regionBox = wx.StaticText(parent = self, id = wx.ID_ANY,label = _(''))
-	self.sizer.Add(item = self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
+	
         # bindings
         self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio1.GetId())
         self.Bind(wx.EVT_RADIOBUTTON, self.SetVal, id = self.radio2.GetId())
@@ -495,21 +495,27 @@
 
     def Region(self):
 	#show this only if radio2 it is selected
-	self.sizer.Remove(self.regionBox)
-	self.sizer.Layout()
+	try:
+	    self.sizer.Remove(self.regionBox)
+	    self.sizer.Layout()
+	except AttributeError:
+	    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.regionLabel, pos = (1, 2))
+	self.regionBox.Add(self.regionTxt, pos = (1, 2))
 	self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
 	self.sizer.Layout()
 
     def KeyDraw(self):
 	#show this only if radio3 and radio4 it is selected
-	self.sizer.Remove(self.regionBox)
-	self.sizer.Layout()	
+	try:
+	    self.sizer.Remove(self.regionBox)
+	    self.sizer.Layout()
+	except AttributeError:
+	    pass
 	self.regionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
 				      label= _("Choose a method"),
 				      choices=[_('Use keyboard to enter sampling area'), 
@@ -519,8 +525,11 @@
 	self.sizer.Layout()
 
     def DrawNothing(self):
- 	self.sizer.Remove(self.regionBox)
-	self.sizer.Layout()     
+	try:
+	    self.sizer.Remove(self.regionBox)
+	    self.sizer.Layout()
+	except AttributeError:
+	    pass    
 	self.regionBox = wx.StaticText(parent = self, id = wx.ID_ANY,label = _(''))
 	self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
 	self.sizer.Layout()
@@ -592,11 +601,58 @@
     
     def __init__(self, wizard, parent):
         TitledPage.__init__(self, wizard, _("Summary"))
-
+	global rlisettings
+	
         self.parent = parent
-        self.sizer.AddGrowableCol(1)    
+        self.sizer.AddGrowableCol(2)  
+        
+	#column up/left
+	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=(1, 1),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+	self.sizer.Add(item = self.rasttxt, border=5, pos=(1, 2),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+                       
+ 	#row up/left
+	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=(2, 1),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+	self.sizer.Add(item = self.conftxt, border=5, pos=(2, 2),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+                       
+ 	#row up/left
+	self.regionlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
+					  label = _('Region name:'))
+
+	self.regiontxt = wx.StaticText(parent = self, id = wx.ID_ANY,
+					  label = "")
+	
+	self.sizer.Add(item = self.regionlabel, border=5, pos=(3, 1),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)
+	self.sizer.Add(item = self.regiontxt, border=5, pos=(3, 2),
+                       flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL)  
+
+	self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage)
+
+    def OnEnterPage(self, event):
+        """!Insert values into text controls for summary of location
+        creation options
+        """
+        
+        self.conftxt.SetLabel(self.parent.startpage.conf_name)
+        self.rasttxt.SetLabel(self.parent.startpage.rast)
+        self.regiontxt.SetLabel(self.parent.startpage.region)
+        
 if __name__ == "__main__":
     import gettext
     gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)



More information about the grass-commit mailing list