Changeset 3510


Ignore:
Timestamp:
Mar 16, 2013 8:33:10 AM (11 years ago)
Author:
gah
Message:

start of string trim fixes for gauge and switch (boolean)

Location:
trunk/gui/scripts
Files:
2 edited

Legend:

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

    r3330 r3510  
    226226            if { "" == $nvUnits} {
    227227                set msg [Rappture::Units::description $units]
    228                 error "Unrecognized units: $newval\nEnter value with units of $msg"
     228                error "unrecognized units in value \"$newval\": should be value with units of $msg"
    229229            }
    230230            set nv [Rappture::Units::convert $nv \
  • trunk/gui/scripts/switch.tcl

    r3330 r3510  
    7070    if {[llength $args] == 1} {
    7171        set newval [lindex $args 0]
    72         if {![string is boolean -strict $newval]} {
    73             error "Should be a boolean value"
     72        # I don't like the "string is" commands. They have too many quirks.
     73        # If we're calling "expr" anyways, just put a catch on it.
     74        if { [catch {expr {($newval) ? 1 : 0}} newval] != 0 } {
     75            error "$newval: should be a yes, no, on, off, true, false, 0, or 1."
    7476        }
    75         set newval [expr {($newval) ? 1 : 0}]
    7677        if {$onlycheck} {
    7778            return
Note: See TracChangeset for help on using the changeset viewer.