README 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Motivation
  2. ----------
  3. Example Tool should help new GRASS GUI programmers who are interested in
  4. adding or improving GRASS GIS functionality or writing GRASS GIS GUI-based
  5. application for their own purposes.
  6. How to use Example Tool
  7. -----------------------
  8. Example Tool is a simple template for applications which are
  9. supposed to display maps and make computations using GRASS modules.
  10. It covers several often occurring tasks. It can be helpful for all
  11. new developers who are interested in wxGUI programming.
  12. Run Example Tool, have a look at wxGUI.Example.html and than
  13. look at the source code to see how it works.
  14. Run Example Tool
  15. ----------------
  16. To run Example Tool can run as a standalone application (in GRASS environment)
  17. or it can be launched from the console.
  18. 1. Go to GRASS root directory
  19. 2. Copy directory ./doc/gui/wxpython/example to ./gui/wxpython/example
  20. 3. Edit ./gui/wxpython/Makefile:
  21. SRCFILES := $(wildcard icons/*.* scripts/* xml/*) \
  22. - $(wildcard core/* dbmgr/* gcp/* gmodeler/* ... \
  23. + $(wildcard core/* dbmgr/* example/* gcp/* gmodeler/* ... \
  24. -PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr gcp gmodeler ... \
  25. +PYDSTDIRS := $(patsubst %,$(ETCDIR)/%,core dbmgr example gcp gmodeler ... \
  26. 4. Run make (in ./gui/wxpython)
  27. Now you can start the application by running
  28. $ g.gui.example
  29. from terminal or wxGUI command console. Try also g.gui.example --help.
  30. If you want to access Example Tool from Layer Manager menu, there are
  31. a few more things to be done.
  32. 5. Edit ./gui/wxpython/xml/menudata.xml. Add following code to appropriate place:
  33. <menuitem>
  34. <label>Example</label>
  35. <help>Example help (for statusbar)</help>
  36. <keywords>raster</keywords>
  37. <handler>OnExample</handler>
  38. </menuitem>
  39. 6. Add folowing event handler to class GMFrame in ./gui/wxpython/lmgr/frame.py:
  40. def OnExample(self, event):
  41. """!Launch ExampleTool"""
  42. from example.frame import ExampleMapFrame
  43. win = ExampleMapFrame(parent=self, giface=self._giface)
  44. win.CentreOnScreen()
  45. win.Show()
  46. 7. Run make again.
  47. Note
  48. ----
  49. Feel free to improve Example Tool or suggest possible improvements.