[GRASS-dev] wxGUI programmer's manual ?

Hi all,

Trying to understand how some of the code in the wxGUI works, I'm confronted with the absence of documentation of the wxGUI code. Yes, there are docstrings in the code, but what is lacking is a programmer's manual that describes the general logic and gives a more precise overview of what is done in the different files and classes.

Is there anything like this out there ?

Otherwise this might be a worthwhile goal for a code sprint...

I know that some would like to move the whole GUI to qt, but even so, documenting the wxgui code might help in constructing a new GUI as well.

Moritz

Hi Moritz,

On Thu, May 12, 2016 at 3:26 AM, Moritz Lennert <
mlennert@club.worldonline.be> wrote:

Trying to understand how some of the code in the wxGUI works, I'm
confronted with the absence of documentation of the wxGUI code.

Please, feel free to ask on mailing list if something is unclear.

Yes, there are docstrings in the code, but what is lacking is a
programmer's manual that describes the general logic and gives a more
precise overview of what is done in the different files and classes.

Is there anything like this out there ?

Yes:

cd grass/source/code
make sphinxdoc

I'm not sure if it is compiled to the online docs. But there is a good
reason it should not. It is not guaranteed API (unfortunately!), so only
people who know it and are prepared to make changes as need should use it
(perhaps we should discuss and officially state the policy). For
programming of GUI itself, you can compile it yourself, although it is less
convenient.

There is also:

https://grasswiki.osgeo.org/wiki/WxGUI_Programming_Howto

which should be probably moved to Trac or the documentation itself.

Otherwise this might be a worthwhile goal for a code sprint...

Great! It definitively needs improvement.

I know that some would like to move the whole GUI to qt, but even so,

Let's not have this discussion in this thread but the replacement is not
happening just yet, so there is no reason to stop working on the current
GUI. Please see the log for gui/wxpython:

https://trac.osgeo.org/grass/log/grass/trunk/gui/wxpython?&rev=68424&limit=100

documenting the wxgui code might help in constructing a new GUI as well.

Sure.

Best,
Vaclav

On 13/05/16 01:55, Vaclav Petras wrote:

Hi Moritz,

On Thu, May 12, 2016 at 3:26 AM, Moritz Lennert
<mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>> wrote:

    Trying to understand how some of the code in the wxGUI works, I'm
    confronted with the absence of documentation of the wxGUI code.

Please, feel free to ask on mailing list if something is unclear.

    Yes, there are docstrings in the code, but what is lacking is a
    programmer's manual that describes the general logic and gives a
    more precise overview of what is done in the different files and
    classes.

    Is there anything like this out there ?

Yes:

cd grass/source/code
make sphinxdoc

I'm getting:

Encoding error:
'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in range(128)
The full traceback has been saved in /tmp/sphinx-err-Ioryqi.log, if you want to report the issue to the developers.
Makefile:85: recipe for target 'wxguihtml' failed
make[1]: *** [wxguihtml] Error 1
make[1]: Leaving directory '/data/home/mlennert/SRC/GRASS/grass_trunk/gui/wxpython/docs/wxgui_sphinx'
include/Make/Sphinx.make:32: recipe for target 'sphinxdoc' failed
make: *** [sphinxdoc] Error 2

And in the log file there is this:

# Sphinx version: 1.3.6
# Python version: 2.7.11+ (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.8
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/sphinx/cmdline.py", line 243, in main
     opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
   File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 128, in __init__
     confoverrides or {}, self.tags)
   File "/usr/lib/python2.7/dist-packages/sphinx/config.py", line 277, in __init__
     execfile_(filename, config)
   File "/usr/lib/python2.7/dist-packages/sphinx/util/pycompat.py", line 128, in execfile_
     exec_(code, _globals)
   File "/usr/lib/python2.7/dist-packages/six.py", line 699, in exec_
     exec("""exec _code_ in _globs_, _locs_""")
   File "<string>", line 1, in <module>
   File "conf.py", line 45, in <module>
     grass_version = core.version()['version']
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 1519, in version
     data = parse_command('g.version', flags='rge', errors='ignore')
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 503, in parse_command
     return parse(res, **parse_args)
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py", line 215, in parse_key_val
     v = decode(kv[1].strip())
   File "/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py", line 160, in decode
     return bytes.decode(enc) if enc else bytes.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in range(128)

There is also:

https://grasswiki.osgeo.org/wiki/WxGUI_Programming_Howto

which should be probably moved to Trac or the documentation itself.

Right, didn't know about this. Thanks !

Moritz

On Fri, May 13, 2016 at 7:09 AM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 13/05/16 01:55, Vaclav Petras wrote:

Hi Moritz,

On Thu, May 12, 2016 at 3:26 AM, Moritz Lennert
<mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>>
wrote:

    Trying to understand how some of the code in the wxGUI works, I'm
    confronted with the absence of documentation of the wxGUI code.

Please, feel free to ask on mailing list if something is unclear.

    Yes, there are docstrings in the code, but what is lacking is a
    programmer's manual that describes the general logic and gives a
    more precise overview of what is done in the different files and
    classes.

    Is there anything like this out there ?

Yes:

cd grass/source/code
make sphinxdoc

I'm getting:

Encoding error:
'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in
range(128)
The full traceback has been saved in /tmp/sphinx-err-Ioryqi.log, if you want
to report the issue to the developers.
Makefile:85: recipe for target 'wxguihtml' failed
make[1]: *** [wxguihtml] Error 1
make[1]: Leaving directory
'/data/home/mlennert/SRC/GRASS/grass_trunk/gui/wxpython/docs/wxgui_sphinx'
include/Make/Sphinx.make:32: recipe for target 'sphinxdoc' failed
make: *** [sphinxdoc] Error 2

And in the log file there is this:

# Sphinx version: 1.3.6
# Python version: 2.7.11+ (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.8
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/sphinx/cmdline.py", line 243, in
main
    opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
  File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 128,
in __init__
    confoverrides or {}, self.tags)
  File "/usr/lib/python2.7/dist-packages/sphinx/config.py", line 277, in
__init__
    execfile_(filename, config)
  File "/usr/lib/python2.7/dist-packages/sphinx/util/pycompat.py", line 128,
in execfile_
    exec_(code, _globals)
  File "/usr/lib/python2.7/dist-packages/six.py", line 699, in exec_
    exec("""exec _code_ in _globs_, _locs_""")
  File "<string>", line 1, in <module>
  File "conf.py", line 45, in <module>
    grass_version = core.version()['version']
  File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 1519, in version
    data = parse_command('g.version', flags='rge', errors='ignore')
  File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 503, in parse_command
    return parse(res, **parse_args)
  File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py",
line 215, in parse_key_val
    v = decode(kv[1].strip())
  File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py",
line 160, in decode
    return bytes.decode(enc) if enc else bytes.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 36:
ordinal not in range(128)

could you please try running

g.version -rge

and in Python

parse_command('g.version', flags='rge')

There is also:

https://grasswiki.osgeo.org/wiki/WxGUI_Programming_Howto

which should be probably moved to Trac or the documentation itself.

Right, didn't know about this. Thanks !

Moritz
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On 13/05/16 15:00, Anna Petrášová wrote:

On Fri, May 13, 2016 at 7:09 AM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 13/05/16 01:55, Vaclav Petras wrote:

Hi Moritz,

On Thu, May 12, 2016 at 3:26 AM, Moritz Lennert
<mlennert@club.worldonline.be <mailto:mlennert@club.worldonline.be>>
wrote:

     Trying to understand how some of the code in the wxGUI works, I'm
     confronted with the absence of documentation of the wxGUI code.

Please, feel free to ask on mailing list if something is unclear.

     Yes, there are docstrings in the code, but what is lacking is a
     programmer's manual that describes the general logic and gives a
     more precise overview of what is done in the different files and
     classes.

     Is there anything like this out there ?

Yes:

cd grass/source/code
make sphinxdoc

I'm getting:

Encoding error:
'ascii' codec can't decode byte 0xc3 in position 36: ordinal not in
range(128)
The full traceback has been saved in /tmp/sphinx-err-Ioryqi.log, if you want
to report the issue to the developers.
Makefile:85: recipe for target 'wxguihtml' failed
make[1]: *** [wxguihtml] Error 1
make[1]: Leaving directory
'/data/home/mlennert/SRC/GRASS/grass_trunk/gui/wxpython/docs/wxgui_sphinx'
include/Make/Sphinx.make:32: recipe for target 'sphinxdoc' failed
make: *** [sphinxdoc] Error 2

And in the log file there is this:

# Sphinx version: 1.3.6
# Python version: 2.7.11+ (CPython)
# Docutils version: 0.12 release
# Jinja2 version: 2.8
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
   File "/usr/lib/python2.7/dist-packages/sphinx/cmdline.py", line 243, in
main
     opts.warningiserror, opts.tags, opts.verbosity, opts.jobs)
   File "/usr/lib/python2.7/dist-packages/sphinx/application.py", line 128,
in __init__
     confoverrides or {}, self.tags)
   File "/usr/lib/python2.7/dist-packages/sphinx/config.py", line 277, in
__init__
     execfile_(filename, config)
   File "/usr/lib/python2.7/dist-packages/sphinx/util/pycompat.py", line 128,
in execfile_
     exec_(code, _globals)
   File "/usr/lib/python2.7/dist-packages/six.py", line 699, in exec_
     exec("""exec _code_ in _globs_, _locs_""")
   File "<string>", line 1, in <module>
   File "conf.py", line 45, in <module>
     grass_version = core.version()['version']
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 1519, in version
     data = parse_command('g.version', flags='rge', errors='ignore')
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py",
line 503, in parse_command
     return parse(res, **parse_args)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py",
line 215, in parse_key_val
     v = decode(kv[1].strip())
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64-pc-linux-gnu/etc/python/grass/script/utils.py",
line 160, in decode
     return bytes.decode(enc) if enc else bytes.decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 36:
ordinal not in range(128)

could you please try running

g.version -rge

and in Python

parse_command('g.version', flags='rge')

GRASS 7.1.svn (LL_WGS84):/data/home/mlennert > g.version -rge
version=7.1.svn
date=2016
revision=r68425
build_date=2016-05-13
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=67275
libgis_date="2015-12-20 13:50:48 +0100 (dim 20 déc 2015) "
proj4=4.9.2
gdal=2.0.2
geos=3.5.0
sqlite=3.12.1

g.parse_command('g.version', flags='rge')
{u'build_platform': u'x86_64-pc-linux-gnu', u'build_date': u'2016-05-13', u'proj4': u'4.9.2', u'geos': u'3.5.0', u'sqlite': u'3.12.1', u'libgis_revision': u'67275', u'libgis_date': u'"2015-12-20 13:50:48 +0100 (dim 20 d\xe9c 2015) "', u'version': u'7.1.svn', u'date': u'2016', u'build_off_t_size': u'8', u'gdal': u'2.0.2', u'revision': u'r68425'}

Looks like it is the accent in 'déc' in the date...

Moritz