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

Moritz Lennert mlennert at club.worldonline.be
Wed Apr 18 02:13:53 PDT 2018


On 18/04/18 10:50, Nikos Alexandris wrote:
> 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?

IIUC, what you would like to be able to do is to prefill the text box 
that you have, for example, in in the r.reclass GUI under "or enter 
values directly" (see attached screenshot) ?

Moritz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2018-04-18-111235_636x382_scrot.png
Type: image/png
Size: 32483 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180418/39b70e38/attachment-0001.png>


More information about the grass-dev mailing list