| 1 | [[TOC]] |
| 2 | |
| 3 | = Submitting wxGUI = |
| 4 | |
| 5 | GUI is divided into components. One component is usually placed in one |
| 6 | directory. |
| 7 | |
| 8 | 3. Remember that functionality such as generating plots should be primarily |
| 9 | provided by library or modules not GUI. |
| 10 | |
| 11 | |
| 12 | 4. Try to create create also g.gui.* module for the new GUI component. It helps |
| 13 | advanced users to access functionality and developers to test it. Moreover, |
| 14 | it helps to keep components separated and thus, it supports re-usability. |
| 15 | |
| 16 | == File structure == |
| 17 | |
| 18 | 5. Add a header section to each file you submit and make sure you |
| 19 | include the copyright. The purpose section is meant to contain a |
| 20 | general over view of the code in the file to assist other |
| 21 | programmers that will need to make changes to your code. For this |
| 22 | purpose use Python docstring. |
| 23 | |
| 24 | The copyright protects your rights according to GNU General Public License (www.gnu.org). |
| 25 | |
| 26 | Please use the following docstring template: |
| 27 | |
| 28 | {{{ |
| 29 | #!python |
| 30 | """! |
| 31 | @package dir.example |
| 32 | |
| 33 | @brief Short example package description |
| 34 | |
| 35 | Classes: |
| 36 | - example::ExampleClass |
| 37 | |
| 38 | (C) 2012 by the GRASS Development Team |
| 39 | |
| 40 | This program is free software under the GNU General Public License |
| 41 | (>=v2). Read the file COPYING that comes with GRASS for details. |
| 42 | |
| 43 | @author First Author <first somewhere.com> |
| 44 | @author Second Author <second somewhere.com> |
| 45 | @author Some Other <third somewhere.com> (some particular change) |
| 46 | """ |
| 47 | }}} |
| 48 | |
| 49 | == Documentation and comments == |
| 50 | |
| 51 | |
| 52 | == Writing the code == |
| 53 | |
| 54 | Do not use print command unless you know what are you doing. |
| 55 | |
| 56 | Use wx.ID_ANY instead of `-1`. |
| 57 | |
| 58 | Use GError, GWarning and GMessage instead of wx.MessageBox() |
| 59 | |
| 60 | Do not use grass.run_command() or grass.read_command(). |
| 61 | Use functions and classes which use threads such as RunCommand. |
| 62 | |
| 63 | When using AddGrowableCol/AddGrowableRow with sizers, put it after |
| 64 | adding widgets into the sizer, not just after creating of the sizer |
| 65 | (needed for wxPython >= 2.9). |
| 66 | |
| 67 | == Testing == |
| 68 | |
| 69 | == See also == |
| 70 | |
| 71 | === Related submitting rules == |
| 72 | |
| 73 | * wiki:Submitting/General general GRASS and svn instructions |
| 74 | * wiki:Submitting/Python Python library and scripts related instructions which applies to wxGUI too if not stated otherwise |
| 75 | * wiki:Submitting/Docs user documentation of modules and GUI |
| 76 | |
| 77 | === GRASS documentation === |
| 78 | |
| 79 | * GRASS Programming manual for API and existing classes: http://grass.osgeo.org/programming7/wxpythonlib.html |
| 80 | * GRASS wiki has pages about how to develop wxGUI: http://grasswiki.osgeo.org |
| 81 | * GRASS Trac wiki has pages about the state of wxGUI development: http://trac.osgeo.org/grass/wiki/wxGUIDevelopment |
| 82 | |
| 83 | === External documentation === |
| 84 | |
| 85 | * wxPython Style Guide: http://wiki.wxpython.org/wxPython_Style_Guide |