[GRASS-SVN] r42102 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules xml

svn_grass at osgeo.org svn_grass at osgeo.org
Tue May 4 04:56:17 EDT 2010


Author: martinl
Date: 2010-05-04 04:56:16 -0400 (Tue, 04 May 2010)
New Revision: 42102

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
   grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
wxGUI: search module moved as notebook page in Layer Manager
(merge r42101 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-05-04 08:42:01 UTC (rev 42101)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-05-04 08:56:16 UTC (rev 42102)
@@ -900,8 +900,8 @@
                         data.SetValue(p.get('value', ''))
                         continue
                     
-                    data = self.FindData(p.get('value', ''),
-                                         p.get('prompt', ''))
+                    data = self.model.FindData(p.get('value', ''),
+                                              p.get('prompt', ''))
                     if data:
                         if p.get('age', 'old') == 'old':
                             self._addLine(data, layer)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-05-04 08:42:01 UTC (rev 42101)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-05-04 08:56:16 UTC (rev 42102)
@@ -141,7 +141,7 @@
                  **kwargs):
         wx.SplitterWindow.__init__(self, parent, id, style = style, *kwargs)
         self.SetName("GMConsole")
-
+        
         self.panelOutput = wx.Panel(parent = self, id = wx.ID_ANY)
         self.panelPrompt = wx.Panel(parent = self, id = wx.ID_ANY)
         
@@ -182,7 +182,7 @@
         self.cmd_output.Bind(wx.EVT_TIMER, self.OnProcessPendingOutputWindowEvents)
         self.Bind(EVT_CMD_RUN, self.OnCmdRun)
         self.Bind(EVT_CMD_DONE, self.OnCmdDone)
-
+        
         #
         # search & command prompt
         #
@@ -204,12 +204,12 @@
         #
         self.cmd_stdout = GMStdout(self)
         self.cmd_stderr = GMStderr(self)
-
+        
         #
         # thread
         #
         self.cmdThread = CmdThread(self, self.requestQ, self.resultQ)
-
+        
         #
         # buttons
         #
@@ -236,7 +236,7 @@
         self.search.Bind(wx.EVT_TEXT,              self.OnSearchModule)
         
         self.__layout()
-
+        
     def __layout(self):
         """!Do layout"""
         OutputSizer = wx.BoxSizer(wx.VERTICAL)
@@ -276,10 +276,10 @@
         
         OutputSizer.Fit(self)
         OutputSizer.SetSizeHints(self)
-
+        
         PromptSizer.Fit(self)
         PromptSizer.SetSizeHints(self)
-
+        
         self.panelOutput.SetSizer(OutputSizer)
         self.panelPrompt.SetSizer(PromptSizer)
         

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py	2010-05-04 08:42:01 UTC (rev 42101)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/help.py	2010-05-04 08:56:16 UTC (rev 42102)
@@ -56,20 +56,17 @@
         #        sizer.SetSizeHints(self)
         self.Layout()
 
-class MenuTreeWindow(wx.Frame):
+class MenuTreeWindow(wx.Panel):
     """!Show menu tree"""
-    def __init__(self, parent, id = wx.ID_ANY, title = _("Menu tree window"), **kwargs):
+    def __init__(self, parent, id = wx.ID_ANY, **kwargs):
         self.parent = parent # LayerManager
         
-        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))
+        wx.Panel.__init__(self, parent = parent, id = id, **kwargs)
         
-        self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
-        self.dataBox = wx.StaticBox(parent = self.panel, id = wx.ID_ANY,
+        self.dataBox = wx.StaticBox(parent = self, id = wx.ID_ANY,
                                     label=" %s " % _("Menu tree (double-click to run command)"))        
         # tree
-        self.tree = MenuTree(parent = self.panel, data = menudata.ManagerData())
+        self.tree = MenuTree(parent = self, data = menudata.ManagerData())
         self.tree.Load()
         
         self.searchDict = { _('label')    : 'label', # i18n workaround
@@ -77,45 +74,34 @@
                             _('command')  : 'command',
                             _('keywords') : 'keywords' }
         # search
-        self.searchBy = wx.Choice(parent = self.panel, id = wx.ID_ANY,
+        self.searchBy = wx.Choice(parent = self, id = wx.ID_ANY,
                                   choices = [_('label'),
                                              _('help'),
                                              _('command'),
                                              _('keywords')])
         self.searchBy.SetSelection(3)
         
-        self.search = wx.TextCtrl(parent = self.panel, id = wx.ID_ANY,
+        self.search = wx.TextCtrl(parent = self, id = wx.ID_ANY,
                                   value = "", size = (-1, 25),
                                   style = wx.TE_PROCESS_ENTER)
         
-        # statusbar
-        self.statusbar = self.CreateStatusBar(number=1)
-
-        # close on run
-        self.closeOnRun = wx.CheckBox(parent = self.panel, id = wx.ID_ANY,
-                                      label = _("Close dialog on run"))
-        self.closeOnRun.SetValue(True)
-        
         # buttons
-        self.btnRun   = wx.Button(self.panel, id = wx.ID_OK, label = _("Run"))
+        self.btnRun   = wx.Button(self, id = wx.ID_OK, label = _("Run"))
         self.btnRun.SetToolTipString(_("Run selected command"))
         self.btnRun.Enable(False)
-        self.btnClose = wx.Button(self.panel, id = wx.ID_CLOSE)
-        self.btnClose.SetToolTipString(_("Close dialog"))
-
+        
         # bindings
-        self.btnClose.Bind(wx.EVT_BUTTON,          self.OnCloseWindow)
         self.btnRun.Bind(wx.EVT_BUTTON,            self.OnRun)
         self.search.Bind(wx.EVT_TEXT_ENTER,        self.OnShowItem)
         self.search.Bind(wx.EVT_TEXT,              self.OnUpdateStatusBar)
         self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
         self.tree.Bind(wx.EVT_TREE_SEL_CHANGED,    self.OnItemSelected)
-
-        self.__Layout()
-
+        
+        self._layout()
+        
         self.search.SetFocus()
         
-    def __Layout(self):
+    def _layout(self):
         """!Do dialog layout"""
         sizer = wx.BoxSizer(wx.VERTICAL)
         
@@ -126,7 +112,7 @@
         
         # search
         searchSizer = wx.BoxSizer(wx.HORIZONTAL)
-        searchSizer.Add(item = wx.StaticText(parent = self.panel, id = wx.ID_ANY,
+        searchSizer.Add(item = wx.StaticText(parent = self, id = wx.ID_ANY,
                                              label = _("Search:")),
                         proportion = 0,
                         flag = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALL,
@@ -142,8 +128,6 @@
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         btnSizer.Add(item = self.btnRun, proportion = 0,
                      flag = wx.LEFT | wx.RIGHT, border = 5)
-        btnSizer.Add(item = self.btnClose, proportion = 0,
-                     flag = wx.LEFT | wx.RIGHT, border = 5)
         
         sizer.Add(item = dataSizer, proportion = 1,
                   flag = wx.EXPAND | wx.ALL, border = 5)
@@ -154,15 +138,14 @@
         sizer.Add(item = btnSizer, proportion=0,
                   flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
         
-        sizer.Add(item = self.closeOnRun, proportion=0,
-                  flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border = 5)
+        sizer.Fit(self)
+        sizer.SetSizeHints(self)
         
-        self.panel.SetAutoLayout(True)
-        self.panel.SetSizer(sizer)
-        sizer.Fit(self.panel)
+        self.SetSizer(sizer)
         
+        self.Fit()
+        self.SetAutoLayout(True)        
         self.Layout()
-        self.SetSize((530, 370))
         
     def OnCloseWindow(self, event):
         """!Close window"""
@@ -188,9 +171,6 @@
         else:
             eval(handler)(None)
         
-        if self.closeOnRun.IsChecked():
-            self.OnCloseWindow(None)
-        
     def OnItemActivated(self, event):
         """!Item activated (double-click)"""
         item = event.GetItem()
@@ -220,7 +200,7 @@
         else:
             label = data['help']
         
-        self.statusbar.SetStatusText(label, 0)
+        self.parent.SetStatusText(label, 0)
         
     def OnShowItem(self, event):
         """!Highlight first found item in menu tree"""
@@ -260,9 +240,9 @@
         
         nItems = len(self.tree.itemsMarked)
         if event.GetString():
-            self.statusbar.SetStatusText(_("%d items match") % nItems, 0)
+            self.parent.SetStatusText(_("%d items match") % nItems, 0)
         else:
-            self.statusbar.SetStatusText("", 0)
+            self.parent.SetStatusText("", 0)
         
         event.Skip()
         

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-05-04 08:42:01 UTC (rev 42101)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2010-05-04 08:56:16 UTC (rev 42102)
@@ -131,7 +131,6 @@
         self.dialogs['atm'] = list()
         
         # creating widgets
-        # -> self.notebook, self.goutput, self.outpage
         self.menubar = menu.Menu(parent = self, data = menudata.ManagerData())
         self.SetMenuBar(self.menubar)
         self.menucmd = self.menubar.GetCmd()
@@ -165,9 +164,11 @@
                self.SetSize((w, h))
             except:
                 pass
-
+        
+        self.Layout()
+        self.Centre()
         self.Show()
-
+        
         # load workspace file if requested
         if self.workspaceFile:
             # load given workspace file
@@ -197,41 +198,32 @@
 
     def __createNoteBook(self):
         """!Creates notebook widgets"""
-
-        #create main notebook widget
         nbStyle = FN.FNB_FANCY_TABS | \
             FN.FNB_BOTTOM | \
             FN.FNB_NO_NAV_BUTTONS | \
             FN.FNB_NO_X_BUTTON
         
         self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY, style=nbStyle)
-
-        #self.notebook = wx.aui.AuiNotebook(parent=self, id=wx.ID_ANY, style=wx.aui.AUI_NB_BOTTOM)
-        #self.notebook.SetFont(wx.Font(pointSize=11, family=wx.FONTFAMILY_DEFAULT, style=wx.NORMAL, weight=0))
-
+        
         # create displays notebook widget and add it to main notebook page
         cbStyle = globalvar.FNPageStyle
         self.gm_cb = FN.FlatNotebook(self, id=wx.ID_ANY, style=cbStyle)
         self.gm_cb.SetTabAreaColour(globalvar.FNPageColor)
         self.notebook.AddPage(self.gm_cb, text=_("Map layers for each display"))
-
+        
         # create command output text area and add it to main notebook page
         self.goutput = goutput.GMConsole(self, pageid=1)
         self.outpage = self.notebook.AddPage(self.goutput, text=_("Command console"))
-
+        
+        # create 'search module' notebook page
+        self.search = MenuTreeWindow(parent = self)
+        self.notebook.AddPage(self.search, text = _("Search module"))
+        
         # bindings
         self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
         self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
         self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosed)
-
-        sizer = wx.BoxSizer(wx.VERTICAL)
-        sizer.Add(item=self.goutput, proportion=1,
-                  flag=wx.EXPAND | wx.ALL, border=1)
-        self.SetSizer(sizer)
-#        self.out_sizer.Fit(self.outpage)
-        self.Layout()
-
-        self.Centre()
+        
         return self.notebook
 
     def __createToolBar(self):
@@ -348,7 +340,8 @@
             # remove '(...)'
             self.notebook.SetPageText(page, _("Command console"))
             self.goutput.cmd_prompt.SetSTCFocus(True)
-            
+        self.SetStatusText('', 0)
+        
         event.Skip()
 
     def OnCBPageClosed(self, event):
@@ -517,13 +510,7 @@
                                             lchecked=True,
                                             lopacity=1.0,
                                             lcmd=['d.vect', 'map=%s' % name])
-           
-    def OnMenuTree(self, event):
-        """!Show dialog with menu tree"""
-        dlg = MenuTreeWindow(self)
-        dlg.CentreOnScreen()
-        dlg.Show()
-    
+        
     def OnAboutGRASS(self, event):
         """!Display 'About GRASS' dialog"""
         win = AboutWindow(self)

Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2010-05-04 08:42:01 UTC (rev 42101)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2010-05-04 08:56:16 UTC (rev 42102)
@@ -2934,12 +2934,6 @@
 	</menuitem>
 	<separator />
 	<menuitem>
-	  <label>Show menu tree</label>
-	  <help>Show menu tree in new window</help>
-          <handler>OnMenuTree</handler>
-	</menuitem>
-	<separator />
-	<menuitem>
 	  <label>About GRASS GIS</label>
 	  <help>About GRASS GIS</help>
 	  <handler>OnAboutGRASS</handler>



More information about the grass-commit mailing list