Tomas Zigo 7d79d826dd wxGUI/toolbars: fix toolbar tools labels when toolbar width is shrinked and toolbar menu is created (#1147) 3 år sedan
..
Makefile ede6c946be wxGUI example application update to work with current gui 11 år sedan
README 2f94d78a66 wxGUI: refactoring: Map Display inheriting from wx.Panel (#1675) 3 år sedan
dialogs.py 60ed929e1e Flake8 fixes for docs and others (#1511) 4 år sedan
frame.py af20745947 wxGUI: Use Map Display settings in other Map Display applications (#2155) 3 år sedan
g.gui.example.html 547ff44e6a manual pages: remove unneeded SVN Date entry and selected cleanup (#2143) 3 år sedan
g.gui.example.py 2f94d78a66 wxGUI: refactoring: Map Display inheriting from wx.Panel (#1675) 3 år sedan
toolbars.py 7d79d826dd wxGUI/toolbars: fix toolbar tools labels when toolbar width is shrinked and toolbar menu is created (#1147) 3 år sedan

README

Motivation
----------
Example Tool should help new GRASS GUI programmers who are interested in
adding or improving GRASS GIS functionality or writing GRASS GIS GUI-based
application for their own purposes.

How to use Example Tool
-----------------------
Example Tool is a simple template for applications which are
supposed to display maps and make computations using GRASS modules.
It covers several often occurring tasks. It can be helpful for all
new developers who are interested in wxGUI programming.
Run Example Tool, have a look at wxGUI.Example.html and than
look at the source code to see how it works.

Run Example Tool
----------------
To run Example Tool can run as a standalone application (in GRASS environment)
or it can be launched from the console.

1. Go to GRASS root directory

2. Copy directory ./doc/gui/wxpython/example to ./gui/wxpython/example

3. Edit ./gui/wxpython/Makefile:

SRCFILES := $(wildcard icons/*.* scripts/* xml/*) \
- $(wildcard core/* dbmgr/* gcp/* gmodeler/* ... \
+ $(wildcard core/* dbmgr/* example/* gcp/* gmodeler/* ... \

-PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr gcp gmodeler ... \
+PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr example gcp gmodeler ... \

4. Run make (in ./gui/wxpython)

Now you can start the application by running

$ g.gui.example

from terminal or wxGUI command console. Try also g.gui.example --help.

If you want to access Example Tool from Layer Manager menu, there are
a few more things to be done.

5. Edit ./gui/wxpython/xml/menudata.xml. Add following code to appropriate place:


Example
Example help (for statusbar)
raster
OnExample


6. Add following event handler to class GMFrame in ./gui/wxpython/lmgr/frame.py:

def OnExample(self, event):
"""!Launch ExampleTool"""
from example.frame import ExampleMapDisplay

frame = wx.Frame(
parent=None, size=globalvar.MAP_WINDOW_SIZE, title=_("Example Tool")
)
win = ExampleMapDisplay(parent=frame, giface=self._giface)
win.CentreOnScreen()

win.Show()

7. Run make again.


Note
----
Feel free to improve Example Tool or suggest possible improvements.