浏览代码

wxGUI: more code for testing individual components

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@69359 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 8 年之前
父节点
当前提交
e04501b164

+ 19 - 0
gui/wxpython/gui_core/ghelp.py

@@ -33,6 +33,11 @@ except ImportError:
 
 import grass.script as grass
 
+# needed just for testing
+if __name__ == '__main__':
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+
 from core import globalvar
 from core.utils import _
 from core.gcmd import GError, DecodeString
@@ -922,3 +927,17 @@ def _grassDevTeam(start):
 
     return '%(c)s %(start)s-%(end)s by the GRASS Development Team' % {
         'c': unichr(169), 'start': start, 'end': end}
+
+
+def main():
+    """Test application (potentially useful as g.gui.gmanual)"""
+    app = wx.App()
+    frame = HelpFrame(parent=None, id=wx.ID_ANY,
+                      title="Test help application",
+                      size=(600, 800), file=sys.argv[1])
+    frame.Show()
+    app.MainLoop()
+
+
+if __name__ == '__main__':
+    main()

+ 5 - 0
gui/wxpython/gui_core/goutput.py

@@ -27,6 +27,11 @@ from wx import stc
 
 from grass.pydispatch.signal import Signal
 
+# needed just for testing
+if __name__ == '__main__':
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+
 from core.gcmd import GError, EncodeString
 from core.gconsole   import GConsole, \
     EVT_CMD_OUTPUT, EVT_CMD_PROGRESS, EVT_CMD_RUN, EVT_CMD_DONE, \

+ 2 - 1
gui/wxpython/gui_core/pyedit.py

@@ -28,7 +28,6 @@ if __name__ == '__main__':
 
 from core.utils import _
 from core.gcmd import EncodeString, GError
-from core.giface import StandaloneGrassInterface
 from gui_core.pystc import PyStc
 from core import globalvar
 from core.menutree import MenuTreeModelBuilder
@@ -683,6 +682,8 @@ class PyEditFrame(wx.Frame):
 
 def main():
     """Test application (potentially useful as g.gui.pyedit)"""
+    from core.giface import StandaloneGrassInterface
+
     app = wx.App()
     giface = StandaloneGrassInterface()
     simple_editor = PyEditFrame(parent=None, giface=giface)

+ 7 - 1
gui/wxpython/gui_core/simplelmgr.py

@@ -22,6 +22,11 @@ import wx.aui
 
 from grass.pydispatch.signal import Signal
 
+# needed just for testing
+if __name__ == '__main__':
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from icons.icon import MetaIcon
 from gui_core.forms import GUI
@@ -479,7 +484,8 @@ icons = {
 class TestFrame(wx.Frame):
 
     def __init__(self, parent):
-        wx.Frame.__init__(self, parent=parent)
+        wx.Frame.__init__(self, parent=parent,
+                          title="Simple layer manager test")
         SimpleLayerManager(parent=self, layerList=LayerList())
 
 

+ 5 - 0
gui/wxpython/gui_core/treeview.py

@@ -24,6 +24,11 @@ except ImportError:
     import wx.lib.customtreectrl as CT
 import wx.gizmos as gizmos
 
+# needed just for testing
+if __name__ == '__main__':
+    from grass.script.setup import set_gui_path
+    set_gui_path()
+
 from core.globalvar import hasAgw
 from core.treemodel import TreeModel, DictNode
 from core.utils import _