[GRASS-dev] [GRASS GIS] #278: wxGUI: don't allow for negative column number

#278: wxGUI: don't allow for negative column number
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-develbranch6
Keywords: | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------
A command that requires a data table column number input, should not allow
to enter a negative value. For example, in v.in.ascii one shouldn't be
able to enter or select with the spin box e.g. z=-32 cat=-8.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278&gt;
GRASS GIS <http://grass.osgeo.org>

#278: wxGUI: don't allow for negative column number
-----------------------+----------------------------------------------------
  Reporter: msieczka | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-develbranch6
Resolution: | Keywords: parser
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by martinl):

  * keywords: => parser
  * component: wxGUI => default

Comment:

The attached patch allows to define ranges:

{{{
1- -> <1; undef)
-1- -> <-1; undef)
-1 -> (undef, 1>
--1 -> (undef, -1>
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#278: wxGUI: don't allow for negative column number
-----------------------+----------------------------------------------------
  Reporter: msieczka | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-develbranch6
Resolution: | Keywords: parser
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by marisn):

  * component: default => wxGUI

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#278: wxGUI: don't allow for negative column number
-----------------------+----------------------------------------------------
  Reporter: msieczka | Owner: martinl
      Type: defect | Status: assigned
  Priority: major | Milestone: 6.4.0
Component: wxGUI | Version: svn-develbranch6
Resolution: | Keywords: parser
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by martinl):

  * status: new => assigned
  * owner: grass-dev@lists.osgeo.org => martinl
* cc: grass-dev@lists.osgeo.org (added)

Comment:

...any comments or objections to committing the patch?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#278: wxGUI: don't allow for negative column number
-----------------------+----------------------------------------------------
  Reporter: msieczka | Owner: martinl
      Type: defect | Status: assigned
  Priority: minor | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: parser
  Platform: All | Cpu: All
-----------------------+----------------------------------------------------
Changes (by hamish):

  * priority: major => minor
  * version: svn-develbranch6 => svn-trunk
  * milestone: 6.4.0 => 7.0.0

Comment:

the syntax is still a bit complicated / vague / tricky to me, e.g. how to
set int_opt=-1 when you want to set just -1.0?

is the patch to help the programmer set opt_xcol->options = ">=1"; ?
if so, why not add some magic code to parse <>= instead of a new &
unintuitive "--1" "-1-" syntax? (ie not to say it is broken, just that it
fails the transferable knowledge test badly)

for v.in.ascii, column >=0 checks added in r34608, r34609.

At this stage, we should not make new non-critical changes to
lib/gis/parser.c in devbr6 IMHO. As the specific reported issue of
v.in.ascii is fixed, changing bug's target to g7.

I leave GUI spinbox controls to others, but guess that it is dependent on
parser support for ->options as above.

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#278: wxGUI: don't allow for negative column number
----------------------+-----------------------------------------------------
Reporter: msieczka | Owner: martinl
     Type: defect | Status: assigned
Priority: minor | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: parser | Platform: All
      Cpu: All |
----------------------+-----------------------------------------------------

Comment(by wenzeslaus):

In GRASS, values `> 0` should be now specified in C as:
{{{
...
opt->options = "1-";
}}}
and in Python as:
{{{
...
#% options: 1-
}}}

So, v.in.ascii needs this fix, so that standard Parser mechanism is used
instead of custom error handling.

GUI now allows to input negative numbers but label contains "valid range
1-" and Run gives an standard error message generated by module (parser):

{{{
ERROR: Value <-4> out of range for parameter <x>
         Legal range: 1-
}}}

GUI would not allow to input values out of range if both limits would be
specified. GUI needs to be improved, so it can handle also range with min
or max only.

Modules using custom range handling, such as `v.in.ascii`, should be
chanaged to use parser.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/278#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>