[GRASSLIST:7652] Interactive GUI input/output

Using a GUI dialogue for instance r.in.gdal I sometimes find that the output expects an interactive input.
That is, if you ran the same perameters from the comand line you would be able to enter 'list' and recive a list of options to follow on. this happens sometime if it asks you from a reprojection option.

Is it possible to develop a means for interactive GUI output so a user does not need to drop to a comannd line to complete the task?

the output box already allows you to enter arbatrary text in it, but that text is never sent to the modukle (terminal).

Cheers

--
+---------------------------------------------------------------+
|Dave Sampson: Geographic Information System (GIS) Technician |
| |
|Centre for Sustainable Watersheds |
|Cooperative Approaches to Protect Canada's Water Resources |
| |
|14 Water St, P.O Box 280. Portland Ontario, Canada. K0G 1V0 |
|Lat: 44.700 Long: -76.19 |
|www.watersheds.ca gis@watersheds.ca |
+---------------------------------------------------------------+

Dave Sampson wrote:

Using a GUI dialogue for instance r.in.gdal I sometimes find that the
output expects an interactive input.
That is, if you ran the same perameters from the comand line you would
be able to enter 'list' and recive a list of options to follow on. this
happens sometime if it asks you from a reprojection option.

Is it possible to develop a means for interactive GUI output so a user
does not need to drop to a comannd line to complete the task?

Modules which usually require user input are run in an xterm. The
problem is with modules which sometimes require a terminal but usually
don't. The GUI would either need to be able to determine when a
terminal is required, or it would need to always use a terminal.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn,

Is it possible for the output area to be a small terminal-like area that can choose to accept input. That way also you can use the GUI to HELP contruct your command line but if needed an extra switch or option can be thrown in (or even a pipe).

Dave Sampson wrote:

Using a GUI dialogue for instance r.in.gdal I sometimes find that the output expects an interactive input.
That is, if you ran the same perameters from the comand line you would be able to enter 'list' and recive a list of options to follow on. this happens sometime if it asks you from a reprojection option.

Is it possible to develop a means for interactive GUI output so a user does not need to drop to a comannd line to complete the task?
   
Modules which usually require user input are run in an xterm. The
problem is with modules which sometimes require a terminal but usually
don't. The GUI would either need to be able to determine when a
terminal is required, or it would need to always use a terminal.

--
+---------------------------------------------------------------+
|Dave Sampson: Geographic Information System (GIS) Technician |
| |
|Centre for Sustainable Watersheds |
|Cooperative Approaches to Protect Canada's Water Resources |
| |
|14 Water St, P.O Box 280. Portland Ontario, Canada. K0G 1V0 |
|Lat: 44.700 Long: -76.19 |
|www.watersheds.ca gis@watersheds.ca |
+---------------------------------------------------------------+

Dave Sampson wrote:

Is it possible for the output area to be a small terminal-like area that
can choose to accept input. That way also you can use the GUI to HELP
contruct your command line but if needed an extra switch or option can
be thrown in (or even a pipe).

Not easily.

Tcl doesn't provide any means to create a pty, which means that you
could only provide a crude approximation of a terminal (in particular,
if the program checks whether stdin is a terminal with isatty(), it
will conclude that stdin isn't a terminal).

Using a pipe might be adequate for simple cases, although someone
would still need to write the code to allow the user to provide input
(a separate text field would be easier than allowing input in the
output text area) and pass it to the process.

Personally, I'd rather modules which are supposed to be
non-interactive (e.g. r.in.gdal) were fixed so that they really were
non-interactive. The pervasive assumption that a module can fall back
to communicating with the user via a terminal is the biggest issue
standing in the way of a decent GUI for GRASS.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn Clements wrote:

Personally, I'd rather modules which are supposed to be
non-interactive (e.g. r.in.gdal) were fixed so that they really were
non-interactive. The pervasive assumption that a module can fall back
to communicating with the user via a terminal is the biggest issue
standing in the way of a decent GUI for GRASS.

r.in.gdal requires user input if it is creating a new location based on the co-ordinate system associated with an external dataset *and* the datum specified in that co-ordinate system has more than one possible set of transformation parameters. There is no way to automatically determine which set is most appropriate; it depends on several factors, most notably what part of the country the dataset is situated in.

To make a non-interactive guess or assumption would be lulling the user into a false sense of security and might result in loss of accuracy later if the most appropriate set of datum parameters had not been chosen. IMHO the best way around this is to provide the user with all the information available about the various sets of transformation parameters and let him or her choose the most appropriate set for the area. As there is still no GRASS library for user interaction like this the most foolproof way of doing it remains the traditional interactive terminal approach.

Hence the problem as outlined previously.

Perhaps the best thing to do for now (although controversial I'm sure) might be to remove the capability to automatically create a new location from r.in.gdal and v.in.ogr, leaving g.proj as the only module with the capability? There could be multiple Tcl/Tk GUI entries for g.proj: one of them could be specifically for creating a new location based on the co-ordinate system associated with an existing external dataset and this could be forced to always spawn a terminal (although it still sometimes wouldn't be needed, e.g. when creating a WGS84 location where there is only one possible set of datum transformation parameters). This functionality should probably also be added to the start-up screen. But I know virtually nothing of the GRASS GUI especially the recent improvements.

Paul

Paul Kelly wrote:

> Personally, I'd rather modules which are supposed to be
> non-interactive (e.g. r.in.gdal) were fixed so that they really were
> non-interactive. The pervasive assumption that a module can fall back
> to communicating with the user via a terminal is the biggest issue
> standing in the way of a decent GUI for GRASS.

r.in.gdal requires user input if it is creating a new location based on
the co-ordinate system associated with an external dataset *and* the
datum specified in that co-ordinate system has more than one possible
set of transformation parameters. There is no way to automatically
determine which set is most appropriate; it depends on several factors,
most notably what part of the country the dataset is situated in.

So allow the user to specify it as a command-line parameter, and fail
if it is required but not provided. Ideally, the error message should
enumerate the valid options.

To make a non-interactive guess or assumption would be lulling the user
into a false sense of security and might result in loss of accuracy
later if the most appropriate set of datum parameters had not been
chosen. IMHO the best way around this is to provide the user with all
the information available about the various sets of transformation
parameters and let him or her choose the most appropriate set for the
area. As there is still no GRASS library for user interaction like this
the most foolproof way of doing it remains the traditional interactive
terminal approach.

Hence the problem as outlined previously.

Perhaps the best thing to do for now (although controversial I'm sure)
might be to remove the capability to automatically create a new location
from r.in.gdal and v.in.ogr, leaving g.proj as the only module with the
capability?

IMHO, creating a new location and importing a raster map are such
fundamentally different operations that they don't belong in the same
binary.

The task of creating a new location should probably be moved to e.g.
g.newlocation.gdal.

[More generally, there should be g.* commands for managing locations
and mapsets, i.e. creation, deletion, copying, renaming.]

There could be multiple Tcl/Tk GUI entries for g.proj: one
of them could be specifically for creating a new location based on the
co-ordinate system associated with an existing external dataset and this
could be forced to always spawn a terminal (although it still sometimes
wouldn't be needed, e.g. when creating a WGS84 location where there is
only one possible set of datum transformation parameters). This
functionality should probably also be added to the start-up screen. But
I know virtually nothing of the GRASS GUI especially the recent
improvements.

One of the main limitations is that it doesn't cope well with programs
which have different "modes", i.e. substantially separate functions
bundled into a single program (although arguably such situations
suggest a design flaw in the program itself).

In particular, if a program has an interactive mode, the only way that
the GUI can handle this is to always launch the program in a terminal.
There's no way that a program can inform the GUI that it is
interactive only for certain combinations of arguments.

This isn't just an issue for the GUI. It applies equally to scripts,
web interfaces etc. Falling back to prompting the user makes life easy
for the programmer, but it can substantially reduce the usefulness of
the program.

--
Glynn Clements <glynn@gclements.plus.com>