[GRASS-dev] Default content for the "answer" to G_OPT_F_INPUT

Nikos Alexandris nik at nikosalexandris.net
Wed Apr 18 01:50:47 PDT 2018


Vaclav:

>Hi Nikos,
>
>I'm sorry if my comment is out of topic as I'm not following the whole
>discussion, but can you just hardcode the values in the code and allow them
>to be overridden by the user-specified file? That is much simpler (for both
>user and GRASS) than handling paths and if the file is short, it does not
>raise major code cleanness concern. If people need to edit the file, then
>documentation is the appropriate place.

Hi Vaclav,

I can do what you suggest. It is not, however, what I want to do.

By referring to "a string as the content of a default answer for
G_OPT_F_INPUT" I mean exactly this: the content of the answer. The answer is a
file name. It's content is a string.

Example: one want to use a GRASS GIS module, say through QGIS. If one
sees an example set of rules in the corresponding box, right away when
launching the GUI (or r.SomeModule --ui), it is easier to grasp the syntax and
successively the logic of whatever is shown.

I can't figure out a way in Python on how to set this content without
using an external file.

Would you devs think it makes sense to request, via a
ticket, an option for the parser to fill in, in addition to the existing
"answer" to G_OPT_F_INPUT (which will fill in a file name, and if the
file exists, its content will be printed in the larger box below it), an
in-script hardcoded string as the content that will be "loaded" in this
larger box?

Maybe name it "content" or "rules" or "filecontent" or something
similar?

Nikos

[rest deleted]

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180418/b63d7265/attachment.sig>


More information about the grass-dev mailing list