[GRASS-SVN] r67975 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Feb 28 20:39:53 PST 2016
Author: wenzeslaus
Date: 2016-02-28 20:39:53 -0800 (Sun, 28 Feb 2016)
New Revision: 67975
Modified:
grass/trunk/gui/wxpython/lmgr/pyshell.py
Log:
wxGUI/lmgr: open simple Python editor from Python tab
Modified: grass/trunk/gui/wxpython/lmgr/pyshell.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/pyshell.py 2016-02-29 04:36:50 UTC (rev 67974)
+++ grass/trunk/gui/wxpython/lmgr/pyshell.py 2016-02-29 04:39:53 UTC (rev 67975)
@@ -25,6 +25,8 @@
from wx.py.version import VERSION
import grass.script as grass
+from grass.script.utils import try_remove
+
from core.utils import _
class PyShellWindow(wx.Panel):
@@ -48,7 +50,11 @@
self.btnClear = wx.Button(self, wx.ID_CLEAR)
self.btnClear.Bind(wx.EVT_BUTTON, self.OnClear)
self.btnClear.SetToolTipString(_("Delete all text from the shell"))
-
+
+ self.btnSimpleEditor = wx.Button(self, id=wx.ID_ANY, label=_("Simple &editor"))
+ self.btnSimpleEditor.Bind(wx.EVT_BUTTON, self.OnSimpleEditor)
+ self.btnSimpleEditor.SetToolTipString(_("Open a simple Python code editor"))
+
self._layout()
def _displayhook(self, value):
@@ -61,10 +67,13 @@
flag = wx.EXPAND)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
+ btnSizer.Add(item=self.btnSimpleEditor, proportion=0,
+ flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
+ btnSizer.AddStretchSpacer()
btnSizer.Add(item = self.btnClear, proportion = 0,
- flag = wx.EXPAND | wx.RIGHT, border = 5)
+ flag = wx.EXPAND | wx.ALIGN_RIGHT, border = 5)
sizer.Add(item = btnSizer, proportion = 0,
- flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+ flag = wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, border = 5)
sizer.Fit(self)
sizer.SetSizeHints(self)
@@ -114,3 +123,14 @@
self.shell.clear()
self.shell.showIntro(self.intro)
self.shell.prompt()
+
+ def OnSimpleEditor(self, event):
+ # import on demand
+ from gui_core.pyedit import PyEditFrame
+
+ # we don't keep track of them and we don't care about open files
+ # there when closing the main GUI
+ simpleEditor = PyEditFrame(parent=self, giface=self.giface)
+ simpleEditor.SetSize(self.parent.GetSize())
+ simpleEditor.CenterOnParent()
+ simpleEditor.Show()
More information about the grass-commit
mailing list