[GRASS-SVN] r70015 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 6 10:49:22 PST 2016
Author: annakrat
Date: 2016-12-06 10:49:22 -0800 (Tue, 06 Dec 2016)
New Revision: 70015
Modified:
grass/trunk/gui/wxpython/lmgr/frame.py
grass/trunk/gui/wxpython/lmgr/pyshell.py
grass/trunk/gui/wxpython/lmgr/toolbars.py
Log:
wxGUI: fix gui when Python tab is hidden by moving SimpleEditor out of Python shell widget
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2016-12-06 17:25:09 UTC (rev 70014)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2016-12-06 18:49:22 UTC (rev 70015)
@@ -382,7 +382,7 @@
if not UserSettings.Get(
group='manager', key='hideTabs', subkey='pyshell'):
self.pyshell = PyShellWindow(
- parent=self.notebook, giface=self._giface)
+ parent=self.notebook, giface=self._giface, simpleEditorHandler=self.OnSimpleEditor)
self.notebook.AddPage(
page=self.pyshell,
text=_("Python"),
@@ -1930,6 +1930,17 @@
dlg.SetPosition((x, y - 200))
dlg.Show()
+ 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.GetSize())
+ simpleEditor.CenterOnScreen()
+ simpleEditor.Show()
+
def OnShowAttributeTable(self, event, selection=None):
"""Show attribute table of the given vector map layer
"""
Modified: grass/trunk/gui/wxpython/lmgr/pyshell.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/pyshell.py 2016-12-06 17:25:09 UTC (rev 70014)
+++ grass/trunk/gui/wxpython/lmgr/pyshell.py 2016-12-06 18:49:22 UTC (rev 70015)
@@ -33,7 +33,7 @@
class PyShellWindow(wx.Panel):
"""Python Shell Window"""
- def __init__(self, parent, giface, id=wx.ID_ANY, **kwargs):
+ def __init__(self, parent, giface, id=wx.ID_ANY, simpleEditorHandler=None, **kwargs):
self.parent = parent
self.giface = giface
@@ -53,11 +53,13 @@
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.simpleEditorHandler = simpleEditorHandler
+ if simpleEditorHandler:
+ self.btnSimpleEditor = wx.Button(
+ self, id=wx.ID_ANY, label=_("Simple &editor"))
+ self.btnSimpleEditor.Bind(wx.EVT_BUTTON, simpleEditorHandler)
+ self.btnSimpleEditor.SetToolTipString(
+ _("Open a simple Python code editor"))
self._layout()
@@ -71,8 +73,9 @@
flag=wx.EXPAND)
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
- btnSizer.Add(item=self.btnSimpleEditor, proportion=0,
- flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5)
+ if self.simpleEditorHandler:
+ 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.ALIGN_RIGHT, border=5)
@@ -127,14 +130,3 @@
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.CenterOnScreen()
- simpleEditor.Show()
Modified: grass/trunk/gui/wxpython/lmgr/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/toolbars.py 2016-12-06 17:25:09 UTC (rev 70014)
+++ grass/trunk/gui/wxpython/lmgr/toolbars.py 2016-12-06 18:49:22 UTC (rev 70015)
@@ -180,7 +180,7 @@
('script-load', icons['script-load'],
self.parent.OnRunScript),
('python', icons['python'],
- self.parent.pyshell.OnSimpleEditor),
+ self.parent.OnSimpleEditor),
))
More information about the grass-commit
mailing list