|
@@ -20,6 +20,8 @@ This program is free software under the GNU General Public License
|
|
|
|
|
|
from __future__ import print_function
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
+import io
|
|
|
|
+from contextlib import redirect_stdout
|
|
import sys
|
|
import sys
|
|
|
|
|
|
import wx
|
|
import wx
|
|
@@ -49,7 +51,8 @@ class PyShellWindow(wx.Panel):
|
|
+ "\n\n"
|
|
+ "\n\n"
|
|
+ _("Type %s for more GRASS scripting related information.") % '"help(gs)"'
|
|
+ _("Type %s for more GRASS scripting related information.") % '"help(gs)"'
|
|
+ "\n"
|
|
+ "\n"
|
|
- + _("Type %s to add raster or vector to the layer tree.") % '"AddLayer()"'
|
|
|
|
|
|
+ + _("Type %s to add raster or vector to the layer tree.")
|
|
|
|
+ % "\"AddLayer('map_name')\""
|
|
+ "\n\n"
|
|
+ "\n\n"
|
|
)
|
|
)
|
|
|
|
|
|
@@ -57,7 +60,7 @@ class PyShellWindow(wx.Panel):
|
|
parent=self,
|
|
parent=self,
|
|
id=wx.ID_ANY,
|
|
id=wx.ID_ANY,
|
|
introText=self.intro,
|
|
introText=self.intro,
|
|
- locals={"gs": grass, "AddLayer": self.AddLayer},
|
|
|
|
|
|
+ locals={"gs": grass, "AddLayer": self.AddLayer, "help": self.Help},
|
|
)
|
|
)
|
|
# useStockId (available since wxPython 4.0.2) should be False on macOS
|
|
# useStockId (available since wxPython 4.0.2) should be False on macOS
|
|
if sys.platform == "darwin" and CheckWxVersion([4, 0, 2]):
|
|
if sys.platform == "darwin" and CheckWxVersion([4, 0, 2]):
|
|
@@ -141,6 +144,17 @@ class PyShellWindow(wx.Panel):
|
|
|
|
|
|
return _("Vector map <%s> added") % fname
|
|
return _("Vector map <%s> added") % fname
|
|
|
|
|
|
|
|
+ def Help(self, obj):
|
|
|
|
+ """Override help() function
|
|
|
|
+
|
|
|
|
+ :param obj object/str: generate the help of the given object
|
|
|
|
+
|
|
|
|
+ return str: help str of the given object
|
|
|
|
+ """
|
|
|
|
+ with redirect_stdout(io.StringIO()) as f:
|
|
|
|
+ help(obj)
|
|
|
|
+ return f.getvalue()
|
|
|
|
+
|
|
def OnClear(self, event):
|
|
def OnClear(self, event):
|
|
"""Delete all text from the shell"""
|
|
"""Delete all text from the shell"""
|
|
self.shell.clear()
|
|
self.shell.clear()
|