[GRASS-SVN] r49330 - sandbox/lucadelu

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 23 04:59:55 EST 2011


Author: lucadelu
Date: 2011-11-23 01:59:55 -0800 (Wed, 23 Nov 2011)
New Revision: 49330

Modified:
   sandbox/lucadelu/r.li.setup.py
Log:
improvement

Modified: sandbox/lucadelu/r.li.setup.py
===================================================================
--- sandbox/lucadelu/r.li.setup.py	2011-11-23 06:28:17 UTC (rev 49329)
+++ sandbox/lucadelu/r.li.setup.py	2011-11-23 09:59:55 UTC (rev 49330)
@@ -171,7 +171,7 @@
 	self.keyboardpage.SetPrev(self.startpage)
 	self.keyboardpage.SetNext(self.samplingareapage)
 	self.samplingareapage.SetPrev(self.startpage)
-	self.samplingareapage.SetNext(self.samplingunitskey)
+	self.samplingareapage.SetNext(self.summarypage)
 	self.samplingunitskey.SetPrev(self.samplingareapage)
 	self.samplingunitskey.SetNext(self.summarypage)
 	self.summarypage.SetPrev(self.samplingareapage)
@@ -275,20 +275,23 @@
     def OnName(self,event):
 	"""!Sets the name of configuration file"""
 	self.conf_name = self.newconftxt.GetValue()
-	if self.region != '' and self.rast != '' and not \
+	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"""
         self.rast = event.GetString()
-	if self.region != '' and self.conf_name != '' and not \
+	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 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)
 
     def OnExitPage(self, event=None):
         """!Function during exiting"""
@@ -309,7 +312,6 @@
                 event.Veto()
                 return
 
-
 class KeybordPage(TitledPage):
     """
     Set name of configuration file, choose raster and optionally vector/sites
@@ -471,7 +473,7 @@
             self.sizer.Hide(self.radio5)
 	    self.sizer.Remove(self.radio5)
 	    self.sizer.Layout()
-	except AttributeError, TypeError:
+	except:
 	    pass        
         if self.parent.startpage.vect != '':
             self.radio5 = wx.RadioButton(parent = self, id = wx.ID_ANY,
@@ -504,16 +506,19 @@
             self.sizer.Hide(self.regionBox)
 	    self.sizer.Remove(self.regionBox)
 	    self.sizer.Layout()
-	except AttributeError, TypeError:
+	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.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"""
@@ -521,7 +526,7 @@
             self.sizer.Hide(self.regionBox)
 	    self.sizer.Remove(self.regionBox)
 	    self.sizer.Layout()
-	except AttributeError, TypeError:
+	except:
 	    pass
 	self.regionBox = wx.RadioBox(parent=self, id=wx.ID_ANY,
 				      label= _("Choose a method"),
@@ -530,7 +535,8 @@
 				      majorDimension=wx.RA_SPECIFY_COLS)
 	self.sizer.Add(self.regionBox, flag = wx.ALIGN_CENTER, pos = (6, 1))
 	self.sizer.Layout()
-	wx.FindWindowById(wx.ID_FORWARD).Enable(False)
+	self.regionbox = 'keybord'
+	wx.FindWindowById(wx.ID_FORWARD).Enable(True)
 	self.regionBox.Bind(wx.EVT_RADIOBOX, self.OnRegionDraw)
 
     def OnRegionDraw(self,event):
@@ -554,8 +560,9 @@
             self.sizer.Hide(self.regionBox)
 	    self.sizer.Remove(self.regionBox)
 	    self.sizer.Layout()
-	except AttributeError, TypeError:
+	except:
 	    pass    
+	self.SetNext(self.parent.summarypage)
 	wx.FindWindowById(wx.ID_FORWARD).Enable(True)
 
 class SampleUnitsKeyPage(TitledPage):
@@ -629,16 +636,6 @@
                        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)
-
-	#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)
                        
  	#region type name
 	self.regionlabel = wx.StaticText(parent = self, id = wx.ID_ANY,
@@ -668,9 +665,36 @@
         """
         self.conftxt.SetLabel(self.parent.startpage.conf_name)
         self.rasttxt.SetLabel(self.parent.startpage.rast)
-        self.vecttxt.SetLabel(self.parent.startpage.vect)     
+        self.samplingtxt.SetLabel(self.parent.samplingareapage.samplingtype)  
         self.regiontxt.SetLabel(self.parent.startpage.region)
-        if self.parent.startpage.region == 'key':
+	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)
+        
+        if self.parent.startpage.region == 'key': 
 	    #region keybord values
 	    self.regionkeylabel = wx.StaticText(parent = self, id = wx.ID_ANY,
 					      label = _('Region keybord values:'))
@@ -685,8 +709,8 @@
 			  % (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.samplingtxt.SetLabel(self.parent.samplingareapage.samplingtype)
 
+
 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