[GRASS-SVN] r47090 - grass-addons/grass7/gui/wxpython/wx.stream/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 10 15:49:47 EDT 2011


Author: madi
Date: 2011-07-10 12:49:47 -0700 (Sun, 10 Jul 2011)
New Revision: 47090

Modified:
   grass-addons/grass7/gui/wxpython/wx.stream/gui_modules/rstream.py
Log:
split code intwo modules and minor changes

Modified: grass-addons/grass7/gui/wxpython/wx.stream/gui_modules/rstream.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.stream/gui_modules/rstream.py	2011-07-10 11:06:30 UTC (rev 47089)
+++ grass-addons/grass7/gui/wxpython/wx.stream/gui_modules/rstream.py	2011-07-10 19:49:47 UTC (rev 47090)
@@ -34,185 +34,13 @@
 import utils
 import menuform
 
+from rstream_panelOne import *
 
+
 ## #-------------Panels-------------
 
-# First panel # Network extraction
 
-class TabPanelOne(wx.Panel):
-    def __init__(self, parent):
 
-        wx.Panel.__init__(self, parent, id = wx.ID_ANY)
-       
-        self.parent = parent
-        
-        # define the panel for select maps
-	self.panel = wx.Panel(self)                                  
-
-	# create the layout
-        self._layout()
-
-    def _layout(self): 
-
-	# create the grid for gselect
-        select = wx.GridBagSizer(20, 5)
-
-        #----------------------------
-        #---------Input maps---------
-
-        # Ask user for digital elevation model
-        text1 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "INPUT : Elevation map (required)") 
-        select.Add(item = text1, flag = wx.LEFT, pos = (1,0), span = (1,2))
-
-        # Add the box for choosing the map
-        select1 = gselect.Select(parent = self.panel, id = wx.ID_ANY, size = (250, -1),
-                               type = 'rast', multiple = False)
-        select.Add(item = select1, pos = (2,0), span = (1,2))
-
-        # binder
-        select1.Bind(wx.EVT_TEXT, self.OnSelect)
-
-        #----------------------------
-
-        # Ask user for Flow accumulation
-        text2 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "INPUT/OUTPUT : Flow accumulation (required)") 
-        select.Add(item = text2, flag = wx.LEFT, pos = (3,0), span = (1,2))
-
-        # Flow accum can be either existent or to be calculated
-        # Check box
-        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
-
-        cb1 = wx.CheckBox(parent = self.panel, label='Create by MFD algorithm')
-        hbox1.Add(item = cb1, flag = wx.LEFT, border=10)
-        cb2 = wx.CheckBox(parent = self.panel, label='Create by SFD algorithm')
-        hbox1.Add(item = cb2, flag = wx.LEFT, border=10)
-        cb3 = wx.CheckBox(parent = self.panel, label='Custom (select existing map)')
-        hbox1.Add(item = cb3, flag = wx.LEFT, border=10)
-
-        select.Add(item = hbox1, pos = (4,0))
-        
-        # Check box binder
-
-        # Box to insert name of new acc map (to be created)
-        txtOne = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY, style = wx.TE_LEFT)
-        select.Add(item = txtOne, flag = wx.LEFT | wx.EXPAND , pos = (5,0), span = (1,2))
-
-        # Add the box for choosing the map
-        select2 = gselect.Select(parent = self.panel, id = wx.ID_ANY, size = (250, -1),
-                               type = 'rast', multiple = False)
-        select.Add(item = select2, pos = (6,0), span = (1,2))
-
-        # binder
-        select2.Bind(wx.EVT_TEXT, self.OnSelect)
-
-        #----------------------------
-
-        # Ask user for Mask
-        text3 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "INPUT : Mask (optional)") 
-        select.Add(item = text3, flag = wx.LEFT, pos = (7,0), span = (1,2))
-
-        # Add the box for choosing the map
-        select3 = gselect.Select(parent = self.panel, id = wx.ID_ANY, size = (250, -1),
-                               type = 'rast', multiple = False)
-        select.Add(item = select3, pos = (8,0), span = (1,2))
-
-        # binder
-        select3.Bind(wx.EVT_TEXT, self.OnSelect)
-
-        #----------------------------
-
-        # Ask user for threshold
-        text4 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "INPUT : Threshold (required)") 
-        select.Add(item = text4, flag = wx.LEFT, pos = (9,0), span = (1,2))
-
-        # Box to insert threshold
-        txtTwo = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY, style = wx.TE_LEFT)
-        select.Add(item = txtTwo, flag = wx.LEFT, pos = (10,0), span = (1,2))
-
-
-        #----------------------------
-        #---------Output maps---------
-
-
-        # Flow direction map
-        text5 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "OUTPUT : Flow direction map (required)") 
-        select.Add(item = text5, flag = wx.LEFT | wx.EXPAND, pos = (11,0), span = (1,2))
-
-        # Box to insert name of new flow dir map (to be created)
-        txtThr = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY, style = wx.TE_LEFT)
-        select.Add(item = txtThr, flag = wx.LEFT | wx.EXPAND , pos = (12,0), span = (1,2))
-
-        #----------------------------
-
-        # Streams map
-        text6 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "OUTPUT : Streams (required)") 
-        select.Add(item = text6, flag = wx.LEFT | wx.EXPAND, pos = (13,0), span = (1,2))
-
-        # Box to insert name of new streams map (to be created)
-        txtFou = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY, style = wx.TE_LEFT)
-        select.Add(item = txtFou, flag = wx.LEFT | wx.EXPAND , pos = (14,0), span = (1,2))
-
-        #----------------------------
-
-        # Network map
-        text7 = wx.StaticText(parent = self.panel, id = wx.ID_ANY, label = "OUTPUT : Network (required)") 
-        select.Add(item = text7, flag = wx.LEFT | wx.EXPAND, pos = (15,0), span = (1,2))
-
-        # Box to insert name of new streams map (to be created)
-        txtFiv = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY, style = wx.TE_LEFT)
-        select.Add(item = txtFiv, flag = wx.LEFT | wx.EXPAND , pos = (16,0), span = (1,2))
-
-
-
-        #----------------------------
- 
-        self.panel.SetSizer(select)
-
-        btnPanel = wx.Panel(self)
-
-        #-------------Buttons-------------
-
-        self.createButtonBar(btnPanel)
-        
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        
-        sizer.Add(self.panel, 1, wx.EXPAND)
-        sizer.Add(btnPanel, 0, wx.EXPAND)
-        self.SetSizer(sizer)
-
-        
-    def OnSelect(self, event):
-            """!Gets raster map or function selection and send it to
-            insertion method
-            """
-            item = event.GetString()
-            self._addSomething(item)        
-
-    def buttonData(self):
-        return (("Update Preview", self.OnPreview),        
-                ("Run Analysis", self.OnRun))
-
-    def createButtonBar(self, panel, yPos = 0):
-        xPos = 0
-        for eachLabel, eachHandler in self.buttonData():
-            pos = (xPos, yPos)
-            button = self.buildOneButton(panel, eachLabel, eachHandler, pos)
-            xPos += button.GetSize().width
-    
-    def buildOneButton(self, parent, label, handler, pos = (0,0)):
-        button = wx.Button(parent, wx.ID_ANY, label, pos)
-        self.Bind(wx.EVT_BUTTON, handler, button)
-        return button
-    
-    def OnPreview(self, event):
-        pass
-    
-    def OnRun(self, event):
-        pass
-
-
-
-
 # Child panel class before customization 
 
 class TabPanel(wx.Panel):
@@ -232,8 +60,10 @@
 
 
 ## #-------------Main Frame-------------
+
 class RStreamFrame(wx.Frame):
-    def __init__(self, parent = None, id = wx.ID_ANY,
+
+    def __init__(self, parent = None, id = wx.ID_ANY, style = wx.DEFAULT_FRAME_STYLE | wx.RESIZE_BORDER,
                  title = _("GRASS GIS Hydrological Modelling Utility"), **kwargs):
         """!Main window of r.stream's GUI
         
@@ -245,15 +75,17 @@
         """
         self.parent = parent
         
-        wx.Frame.__init__(self, parent = parent, id = id, title = title, name = "RStream", **kwargs)
+        wx.Frame.__init__(self, parent = parent, id = id, title = title, name = "RStream", size = (700, 900), **kwargs)
         self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
         
         # create the AuiNotebook instance
         nb = wx.aui.AuiNotebook(self)
 
+       
+
         # add some pages to the notebook
         pages = [(TabPanelOne(nb), "Network extraction"),
-                 (TabPanel(nb), "Tab 2"),
+                 (TabPanel(nb), "Network ordering"),
                  (TabPanel(nb), "Tab 3")]
 
         for page, label in pages:



More information about the grass-commit mailing list