Changeset 550 for trunk/gui/scripts


Ignore:
Timestamp:
Dec 7, 2006 3:46:45 AM (17 years ago)
Author:
dkearney
Message:

fix for rappture ticket 157 where error messages about units min and max values are converted to the same units the user specified, not the units the developer specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/gauge.tcl

    r442 r550  
    213213        # the value is bound by any min/max value constraints.
    214214        #
     215        # Keep track of the inputted units so we can give a
     216        # response about min and max values in familiar units.
     217        #
    215218        set newval [set nv [lindex $args 0]]
    216219        set units $itk_option(-units)
    217220        if {$units != ""} {
     221            set nvUnits [Rappture::Units::Search::for $nv]
    218222            set newval [Rappture::Units::convert $newval \
    219223                -context $units]
     
    223227
    224228        if {"" != $itk_option(-minvalue)} {
    225             set minv $itk_option(-minvalue)
     229            set convMinVal [set minv $itk_option(-minvalue)]
    226230            if {$units != ""} {
    227231                set minv [Rappture::Units::convert $minv \
    228232                    -context $units -to $units -units off]
     233                set convMinVal [Rappture::Units::convert \
     234                    $itk_option(-minvalue) -to $nvUnits]
    229235            }
    230236            if {$nv < $minv} {
    231                 error "minimum value allowed here is $itk_option(-minvalue)"
     237                error "minimum value allowed here is $convMinVal"
    232238            }
    233239        }
    234240
    235241        if {"" != $itk_option(-maxvalue)} {
    236             set maxv $itk_option(-maxvalue)
     242            set convMaxVal [set maxv $itk_option(-maxvalue)]
    237243            if {$units != ""} {
    238244                set maxv [Rappture::Units::convert $maxv \
    239245                    -context $units -to $units -units off]
     246                set convMaxVal [Rappture::Units::convert \
     247                    $itk_option(-maxvalue) -to $nvUnits]
    240248            }
    241249            if {$nv > $maxv} {
    242                 error "maximum value allowed here is $itk_option(-maxvalue)"
     250                error "maximum value allowed here is $convMaxVal"
    243251            }
    244252        }
Note: See TracChangeset for help on using the changeset viewer.