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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Nov 5 09:43:30 EDT 2011


Author: martinl
Date: 2011-11-05 06:43:29 -0700 (Sat, 05 Nov 2011)
New Revision: 49109

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
wxgui: fix splitter window problem in command output page of module dialogs (cmbarton)
       (merge r49104, r49108 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2011-11-05 13:37:08 UTC (rev 49108)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2011-11-05 13:43:29 UTC (rev 49109)
@@ -248,22 +248,22 @@
         # thread
         self.cmdThread = CmdThread(self, self.requestQ, self.resultQ)
         
-        self.outputBox = wx.StaticBox(parent = self.panelPrompt, id = wx.ID_ANY,
+        self.outputBox = wx.StaticBox(parent = self.panelOutput, id = wx.ID_ANY,
                                       label = " %s " % _("Output window"))
-        self.cmdBox = wx.StaticBox(parent = self.panelPrompt, id = wx.ID_ANY,
+        self.cmdBox = wx.StaticBox(parent = self.panelOutput, id = wx.ID_ANY,
                                    label = " %s " % _("Command prompt"))
         
         # buttons
-        self.btnOutputClear = wx.Button(parent = self.panelPrompt, id = wx.ID_CLEAR)
+        self.btnOutputClear = wx.Button(parent = self.panelOutput, id = wx.ID_CLEAR)
         self.btnOutputClear.SetToolTipString(_("Clear output window content"))
-        self.btnCmdClear = wx.Button(parent = self.panelPrompt, id = wx.ID_CLEAR)
+        self.btnCmdClear = wx.Button(parent = self.panelOutput, id = wx.ID_CLEAR)
         self.btnCmdClear.SetToolTipString(_("Clear command prompt content"))
         if self.parent.GetName() != 'LayerManager':
             self.btnCmdClear.Hide()
-        self.btnOutputSave  = wx.Button(parent = self.panelPrompt, id = wx.ID_SAVE)
+        self.btnOutputSave  = wx.Button(parent = self.panelOutput, id = wx.ID_SAVE)
         self.btnOutputSave.SetToolTipString(_("Save output window content to the file"))
         # abort
-        self.btnCmdAbort = wx.Button(parent = self.panelPrompt, id = wx.ID_STOP)
+        self.btnCmdAbort = wx.Button(parent = self.panelOutput, id = wx.ID_STOP)
         self.btnCmdAbort.SetToolTipString(_("Abort running command"))
         self.btnCmdAbort.Enable(False)
         
@@ -278,11 +278,15 @@
     def _layout(self):
         """!Do layout"""
         outputSizer = wx.BoxSizer(wx.VERTICAL)
-        promptSizer = wx.BoxSizer(wx.VERTICAL)
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         outBtnSizer = wx.StaticBoxSizer(self.outputBox, wx.HORIZONTAL)
         cmdBtnSizer = wx.StaticBoxSizer(self.cmdBox, wx.HORIZONTAL)
         
+        if self.cmdPrompt.IsShown():
+            promptSizer = wx.BoxSizer(wx.VERTICAL)
+            promptSizer.Add(item = self.cmdPrompt, proportion = 1,
+                        flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border = 3)
+        
         if self.search and self.search.IsShown():
             outputSizer.Add(item = self.searchPane, proportion = 0,
                             flag = wx.EXPAND | wx.ALL, border = 3)
@@ -290,14 +294,11 @@
                         flag = wx.EXPAND | wx.ALL, border = 3)
         outputSizer.Add(item = self.progressbar, proportion = 0,
                         flag = wx.EXPAND | wx.LEFT | wx.RIGHT, border = 3)
-        
-        promptSizer.Add(item = self.cmdPrompt, proportion = 1,
-                        flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border = 3)
-        
         outBtnSizer.Add(item = self.btnOutputClear, proportion = 1,
                         flag = wx.ALIGN_LEFT | wx.LEFT | wx.RIGHT, border = 5)
         outBtnSizer.Add(item = self.btnOutputSave, proportion = 1,
                         flag = wx.ALIGN_RIGHT | wx.RIGHT, border = 5)
+        
         cmdBtnSizer.Add(item = self.btnCmdClear, proportion = 1,
                         flag = wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT, border = 5)
         cmdBtnSizer.Add(item = self.btnCmdAbort, proportion = 1,
@@ -307,25 +308,25 @@
                      flag = wx.ALL | wx.ALIGN_CENTER, border = 5)
         btnSizer.Add(item = cmdBtnSizer, proportion = 1,
                      flag = wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM | wx.RIGHT, border = 5)
-        promptSizer.Add(item = btnSizer, proportion = 1,
+        outputSizer.Add(item = btnSizer, proportion = 0,
                         flag = wx.EXPAND)
         
         outputSizer.Fit(self)
         outputSizer.SetSizeHints(self)
+        self.panelOutput.SetSizer(outputSizer)
         
-        promptSizer.Fit(self)
-        promptSizer.SetSizeHints(self)
+        if self.cmdPrompt.IsShown():
+            promptSizer.Fit(self)
+            promptSizer.SetSizeHints(self)
+            self.panelPrompt.SetSizer(promptSizer)
         
-        self.panelOutput.SetSizer(outputSizer)
-        self.panelPrompt.SetSizer(promptSizer)
-        
         # split window
-        if self.parent.GetName() == 'LayerManager':
+        if self.cmdPrompt.IsShown():
             self.SplitHorizontally(self.panelOutput, self.panelPrompt, -50)
-            self.SetMinimumPaneSize(self.btnCmdClear.GetSize()[1] + 85)
         else:
             self.SplitHorizontally(self.panelOutput, self.panelPrompt, -45)
-            self.SetMinimumPaneSize(self.btnCmdClear.GetSize()[1] + 25)
+            self.Unsplit()
+        self.SetMinimumPaneSize(self.btnCmdClear.GetSize()[1] + 25)
         
         self.SetSashGravity(1.0)
         

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-11-05 13:37:08 UTC (rev 49108)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-11-05 13:43:29 UTC (rev 49109)
@@ -439,11 +439,12 @@
         self.btn_cancel.SetToolTipString(_("Close this window without executing the command (Ctrl+Q)"))
         btnsizer.Add(item = self.btn_cancel, proportion = 0, flag = wx.ALL | wx.ALIGN_CENTER, border = 10)
         self.btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+
         if self.get_dcmd is not None: # A callback has been set up
             btn_apply = wx.Button(parent = self.panel, id = wx.ID_APPLY)
             btn_ok = wx.Button(parent = self.panel, id = wx.ID_OK)
             btn_ok.SetDefault()
-            
+
             btnsizer.Add(item = btn_apply, proportion = 0,
                          flag = wx.ALL | wx.ALIGN_CENTER,
                          border = 10)

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2011-11-05 13:37:08 UTC (rev 49108)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2011-11-05 13:43:29 UTC (rev 49109)
@@ -212,8 +212,12 @@
         # redirect stderr to log area    
         self.goutput.Redirect()
         
-        # fix goutput's pane size (required for Mac OSX)
-        self.goutput.SetSashPosition(int(self.GetSize()[1] * .54))
+        # fix goutput's pane size (required for Mac OSX)`
+        if sys.platform == 'darwin':
+            coef = .80
+        else:
+            coef = .54
+        self.goutput.SetSashPosition(int(self.GetSize()[1] * coef))
         
         self.workspaceChanged = False
         



More information about the grass-commit mailing list