Opened 16 years ago

Last modified 6 years ago

#278 assigned enhancement

wxGUI: don't allow for negative column number

Reported by: msieczka Owned by: martinl
Priority: minor Milestone: 8.0.0
Component: wxGUI Version: svn-trunk
Keywords: parser Cc: grass-dev@…
CPU: All Platform: All

Description

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.

Attachments (1)

range-undef.diff (944 bytes ) - added by martinl 16 years ago.
parse undef;min/max ranges

Download all attachments as: .zip

Change History (14)

comment:1 by martinl, 16 years ago

Component: wxGUIdefault
Keywords: parser added

The attached patch allows to define ranges:

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

by martinl, 16 years ago

Attachment: range-undef.diff added

parse undef;min/max ranges

comment:2 by marisn, 16 years ago

Component: defaultwxGUI

comment:3 by martinl, 16 years ago

Cc: grass-dev@… added
Owner: changed from grass-dev@… to martinl
Status: newassigned

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

comment:4 by hamish, 16 years ago

Milestone: 6.4.07.0.0
Priority: majorminor
Version: svn-develbranch6svn-trunk

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

comment:5 by wenzeslaus, 10 years ago

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.

comment:6 by martinl, 9 years ago

Milestone: 7.0.07.0.5

comment:7 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:8 by neteler, 7 years ago

Milestone: 7.0.67.0.7

comment:9 by martinl, 6 years ago

Milestone: 7.0.77.4.2

comment:10 by neteler, 6 years ago

Milestone: 7.4.27.4.3

Ticket retargeted after milestone closed

comment:11 by martinl, 6 years ago

Milestone: 7.4.37.4.4

Bump milestone to 7.4.4

comment:12 by neteler, 6 years ago

Milestone: 7.4.47.4.5

Ticket retargeted after milestone closed

comment:13 by martinl, 6 years ago

Milestone: 7.4.58.0.0
Type: defectenhancement
Note: See TracTickets for help on using tickets.