forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSUBMITTING_WXGUI
156 lines (93 loc) · 4.52 KB
/
SUBMITTING_WXGUI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
NOTE: Please improve this list!
Dear (new) GRASS developer,
when submitting Python code to GRASS SVN repository, please take
care of following rules:
[ see SUBMITTING for C hints ]
[ see SUBMITTING_PYTHON for Python code hints ]
[ see SUBMITTING_DOCS for documentation ]
0. Introduction
For general GRASS, svn and Python issues and module related issues see
SUBMITTING_PYTHON and SUBMITTING.
GUI is divided into components. One component is usually placed in one
directory.
1. GRASS documentation
GRASS Programming manual for API and existing classes
http://grass.osgeo.org/programming7/wxpythonlib.html
GRASS wiki has pages about how to develop wxGUI
http://grasswiki.osgeo.org
GRASS Trac wiki has pages about the state of wxGUI development
http://trac.osgeo.org/grass/wiki/wxGUIDevelopment
2. External documentation
Style Guide for Python Code
http://www.python.org/dev/peps/pep-0008/
Python Style Guide by Guido van Rossum
http://www.python.org/doc/essays/styleguide.html
wxPython Style Guide
http://wiki.wxpython.org/wxPython_Style_Guide
Additional info on Python docstrings
http://epydoc.sourceforge.net/docstrings.html
3. Remember that functionality such as generating plots should be primarily
provided by modules not GUI.
4. Try to create create also g.gui.* module for the new GUI component. It helps
advanced users to access functionality and developers to test it. Moreover,
it helps to keep components separated and thus, supports re-usability.
5. Add a header section to each file you submit and make sure you
include the copyright. The purpose section is meant to contain a
general over view of the code in the file to assist other
programmers that will need to make changes to your code. For this
purpose use Python docstring.
The copyright protects your rights according to GNU General Public
License (www.gnu.org).
Please use the following docstring template:
"""!
@package dir.example
@brief Short example package description
Classes:
- example::ExampleClass
(C) 2012 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
@author First Author <first somewhere.com>
@author Second Author <second somewhere.com>
@author Some Other <third somewhere.com> (some particular change)
"""
6. Comment your classes and functions with docstrings. Use Doxygen syntax,
particularly, use commands which begins with @
(www.doxygen.org/manual/commands.html).
Comment also the code itself such as the meaning of variables,
conditions etc.
7. Make sure a new line is at the end of each file. Non empty line breaks the
build process.
8. Basic rules
Do not use print command unless you know what are you doing.
Use named parameters in functions (without space around '='), e.g.
dlg = wx.FileDialog(parent=self, message=_("Choose file to save current workspace"),
wildcard=_("GRASS Workspace File (*.gxw)|*.gxw"), style=wx.FD_SAVE)
instead of
dlg = wx.FileDialog(self, _("Choose file to save current workspace"),
_("GRASS Workspace File (*.gxw)|*.gxw"), wx.FD_SAVE)
Use wx.ID_ANY instead of `-1`.
Use GError, GWarning and GMessage instead of wx.MessageBox()
Do not use grass.run_command() or grass.read_command(). Use functions and
classes which uses threads such as RunCommand.
Use full strings, e.g.
if ...:
win.SetLabel(_('Name for new 3D raster map to create'))
else:
win.SetLabel(_('Name for new raster map to create'))
instead of
_('Name for new %s to create') % maplabel
where `maplabel` can be 'raster map' or '3D raster map'
9. Use tools such as pylint and pep8 to check your code (both style and
correctness). Just note that default settings of these tools is not fully
compatible with wxGUI/wxPython style and that some of the reported errors
may not apply to your code.
14. Tell the other developers about the new code using the following e-mail:
To subscribe to this mailing list, see
http://lists.osgeo.org/mailman/listinfo/grass-dev
15. In case of questions feel free to contact the other developers at the above
mailing list.
http://grass.osgeo.org/devel/index.php#submission
[please add further hints if required]
"Your attention to detail is appreciated."