[GRASS-SVN] r53860 - in grass/trunk/gui/wxpython: gui_core lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 17 11:14:19 PST 2012
Author: wenzeslaus
Date: 2012-11-17 11:14:18 -0800 (Sat, 17 Nov 2012)
New Revision: 53860
Modified:
grass/trunk/gui/wxpython/gui_core/goutput.py
grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI/goutput: GConsole styles (co-author: annakrat)
Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py 2012-11-17 17:17:23 UTC (rev 53859)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py 2012-11-17 19:14:18 UTC (rev 53860)
@@ -52,6 +52,12 @@
wxCmdAbort, EVT_CMD_ABORT = NewEvent()
wxCmdPrepare, EVT_CMD_PREPARE = NewEvent()
+
+GC_EMPTY = 0
+GC_SEARCH = 1
+GC_PROMPT = 2
+
+
def GrassCmd(cmd, env = None, stdout = None, stderr = None):
"""!Return GRASS command thread"""
return CommandThread(cmd, env = env,
@@ -199,6 +205,7 @@
def __init__(self, parent, id = wx.ID_ANY, margin = False,
frame = None, notebook = None,
style = wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE,
+ gcstyle = GC_EMPTY,
**kwargs):
wx.SplitterWindow.__init__(self, parent, id, style = style, *kwargs)
self.SetName("GConsole")
@@ -217,6 +224,8 @@
self._notebook = notebook
else:
self._notebook = self.parent.notebook
+
+ self._gcstyle = gcstyle
self.lineWidth = 80
# remember position of line begining (used for '\r')
@@ -241,14 +250,16 @@
self.Bind(EVT_CMD_RUN, self.OnCmdRun)
self.Bind(EVT_CMD_DONE, self.OnCmdDone)
self.Bind(EVT_CMD_PREPARE, self.OnCmdPrepare)
-
+
# search & command prompt
+ # move to the if below
+ # search depends on cmd prompt
self.cmdPrompt = GPromptSTC(parent = self)
-
- if self.parent.GetName() != 'LayerManager':
- self.search = None
+ if not self._gcstyle & GC_PROMPT:
self.cmdPrompt.Hide()
- else:
+
+
+ if self._gcstyle & GC_SEARCH:
self.infoCollapseLabelExp = _("Click here to show search module engine")
self.infoCollapseLabelCol = _("Click here to hide search module engine")
self.searchPane = wx.CollapsiblePane(parent = self.panelOutput,
@@ -259,7 +270,9 @@
self.searchPane.Collapse(True)
self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnSearchPaneChanged, self.searchPane)
self.search.Bind(wx.EVT_TEXT, self.OnUpdateStatusBar)
-
+ else:
+ self.search = None
+
# stream redirection
self.cmdStdOut = GStdout(self)
self.cmdStdErr = GStderr(self)
@@ -269,9 +282,14 @@
self.outputBox = wx.StaticBox(parent = self.panelOutput, id = wx.ID_ANY,
label = " %s " % _("Output window"))
+
+ if self._gcstyle & GC_PROMPT:
+ cmdLabel = _("Command prompt")
+ else:
+ cmdLabel = _("Command")
self.cmdBox = wx.StaticBox(parent = self.panelOutput, id = wx.ID_ANY,
- label = " %s " % _("Command prompt"))
-
+ label = " %s " % cmdLabel)
+
# buttons
self.btnOutputClear = wx.Button(parent = self.panelOutput, id = wx.ID_CLEAR)
self.btnOutputClear.SetToolTipString(_("Clear output window content"))
@@ -288,7 +306,7 @@
self.btnCmdProtocol.SetToolTipString(_("Toggle to save list of executed commands into file; "
"content saved when switching off."))
- if self.frame.GetName() != 'LayerManager':
+ if not self._gcstyle & GC_PROMPT:
self.btnCmdClear.Hide()
self.btnCmdProtocol.Hide()
@@ -308,12 +326,12 @@
outBtnSizer = wx.StaticBoxSizer(self.outputBox, wx.HORIZONTAL)
cmdBtnSizer = wx.StaticBoxSizer(self.cmdBox, wx.HORIZONTAL)
- if self.cmdPrompt.IsShown():
+ if self._gcstyle & GC_PROMPT:
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():
+ if self._gcstyle & GC_SEARCH:
outputSizer.Add(item = self.searchPane, proportion = 0,
flag = wx.EXPAND | wx.ALL, border = 3)
outputSizer.Add(item = self.cmdOutput, proportion = 1,
@@ -332,10 +350,10 @@
cmdBtnSizer.Add(item = self.btnCmdAbort, proportion = 1,
flag = wx.ALIGN_CENTER | wx.RIGHT, border = 5)
- if self.frame.GetName() != 'LayerManager':
+ if self._gcstyle & GC_PROMPT:
+ proportion = (2, 3)
+ else:
proportion = (1, 1)
- else:
- proportion = (2, 3)
btnSizer.Add(item = outBtnSizer, proportion = proportion[0],
flag = wx.ALL | wx.ALIGN_CENTER, border = 5)
@@ -350,13 +368,13 @@
# eliminate gtk_widget_size_allocate() warnings
outputSizer.SetVirtualSizeHints(self.panelOutput)
- if self.cmdPrompt.IsShown():
+ if self._gcstyle & GC_PROMPT:
promptSizer.Fit(self)
promptSizer.SetSizeHints(self)
self.panelPrompt.SetSizer(promptSizer)
# split window
- if self.cmdPrompt.IsShown():
+ if self._gcstyle & GC_PROMPT:
self.SplitHorizontally(self.panelOutput, self.panelPrompt, -50)
else:
self.SplitHorizontally(self.panelOutput, self.panelPrompt, -45)
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2012-11-17 17:17:23 UTC (rev 53859)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2012-11-17 19:14:18 UTC (rev 53860)
@@ -49,7 +49,7 @@
from modules.mcalc_builder import MapCalcFrame
from dbmgr.manager import AttributeManager
from core.workspace import ProcessWorkspaceFile, ProcessGrcFile, WriteWorkspaceFile
-from gui_core.goutput import GConsole
+from gui_core.goutput import GConsole, GC_SEARCH, GC_PROMPT
from gui_core.dialogs import GdalOutputDialog, DxfImportDialog, GdalImportDialog, MapLayersDialog
from gui_core.dialogs import EVT_APPLY_MAP_LAYERS
from gui_core.dialogs import LocationDialog, MapsetDialog, CreateNewVector, GroupDialog
@@ -255,7 +255,8 @@
self.notebook.AddPage(page = self.notebookLayers, text = _("Map layers"), name = 'layers')
# create 'command output' text area
- self.goutput = GConsole(self, frame = self)
+ self.goutput = GConsole(self, frame = self,
+ gcstyle = GC_SEARCH | GC_PROMPT)
self.notebook.AddPage(page = self.goutput, text = _("Command console"), name = 'output')
self._setCopyingOfSelectedText()
More information about the grass-commit
mailing list