Ignore:
Timestamp:
Mar 18, 2009, 2:59:21 PM (16 years ago)
Author:
gah
Message:

preliminary HQ output from molvisviewer; unexpand tabs; all jpeg generation at 100%

File:
1 edited

Legend:

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

    r1287 r1342  
    4343itcl::body Rappture::NumberEntry::constructor {owner path args} {
    4444    if {[catch {$owner isa Rappture::ControlOwner} valid] != 0 || !$valid} {
    45         error "bad object \"$owner\": should be Rappture::ControlOwner"
     45        error "bad object \"$owner\": should be Rappture::ControlOwner"
    4646    }
    4747    set _owner $owner
     
    5353    set presets ""
    5454    foreach pre [$_owner xml children -type preset $path] {
    55         lappend presets \
    56             [$_owner xml get $path.$pre.value] \
    57             [$_owner xml get $path.$pre.label]
     55        lappend presets \
     56            [$_owner xml get $path.$pre.value] \
     57            [$_owner xml get $path.$pre.label]
    5858    }
    5959
     
    6161    set units [$_owner xml get $path.units]
    6262    if {$units != ""} {
    63         set desc [Rappture::Units::description $units]
    64         if {[string match temperature* $desc]} {
    65             set class Rappture::TemperatureGauge
    66         }
     63        set desc [Rappture::Units::description $units]
     64        if {[string match temperature* $desc]} {
     65            set class Rappture::TemperatureGauge
     66        }
    6767    }
    6868
     
    7272    #
    7373    itk_component add gauge {
    74         $class $itk_interior.gauge -units $units -presets $presets
     74        $class $itk_interior.gauge -units $units -presets $presets
    7575    }
    7676    pack $itk_component(gauge) -expand yes -fill both
     
    8484
    8585    if {$class == "Rappture::Gauge" && "" != $min && "" != $max} {
    86         set color [$_owner xml get $path.about.color]
    87         if {$color == ""} {
    88             # deprecated.  Color should be in "about"
    89             set color [$_owner xml get $path.color]
    90         }
    91         if {$color != ""}  {
    92             if {$units != ""} {
    93                 set min [Rappture::Units::convert $min -to $units -units off]
    94                 set max [Rappture::Units::convert $max -to $units -units off]
    95             }
    96             # For compatibility. If only one color use white for min
    97             if {[llength $color] == 1} {
    98                 set color [list $min white $max $color]
    99             }
    100             $itk_component(gauge) configure \
    101                 -spectrum [Rappture::Spectrum ::#auto $color -units $units]
    102         }
     86        set color [$_owner xml get $path.about.color]
     87        if {$color == ""} {
     88            # deprecated.  Color should be in "about"
     89            set color [$_owner xml get $path.color]
     90        }
     91        if {$color != ""}  {
     92            if {$units != ""} {
     93                set min [Rappture::Units::convert $min -to $units -units off]
     94                set max [Rappture::Units::convert $max -to $units -units off]
     95            }
     96            # For compatibility. If only one color use white for min
     97            if {[llength $color] == 1} {
     98                set color [list $min white $max $color]
     99            }
     100            $itk_component(gauge) configure \
     101                -spectrum [Rappture::Spectrum ::#auto $color -units $units]
     102        }
    103103    }
    104104
     
    106106    set str [$_owner xml get $path.about.icon]
    107107    if {$str != ""} {
    108         $itk_component(gauge) configure -image [image create photo -data $str]
     108        $itk_component(gauge) configure -image [image create photo -data $str]
    109109    }
    110110
     
    131131    set i [lsearch -exact $args -check]
    132132    if {$i >= 0} {
    133         set onlycheck 1
    134         set args [lreplace $args $i $i]
     133        set onlycheck 1
     134        set args [lreplace $args $i $i]
    135135    }
    136136
    137137    if {[llength $args] == 1} {
    138         if {$onlycheck} {
    139             # someday we may add validation...
    140             return
    141         }
    142         set newval [lindex $args 0]
    143         $itk_component(gauge) value $newval
    144         return $newval
     138        if {$onlycheck} {
     139            # someday we may add validation...
     140            return
     141        }
     142        set newval [lindex $args 0]
     143        $itk_component(gauge) value $newval
     144        return $newval
    145145
    146146    } elseif {[llength $args] != 0} {
    147         error "wrong # args: should be \"value ?-check? ?newval?\""
     147        error "wrong # args: should be \"value ?-check? ?newval?\""
    148148    }
    149149
     
    163163    set label [$_owner xml get $_path.about.label]
    164164    if {"" == $label} {
    165         set label "Number"
     165        set label "Number"
    166166    }
    167167    return $label
     
    184184
    185185    if {$units != "" || $min != "" || $max != ""} {
    186         append str "\n\nEnter a number"
    187 
    188         if {$min != "" && $max != ""} {
    189             append str " between $min and $max"
    190         } elseif {$min != ""} {
    191             append str " greater than $min"
    192         } elseif {$max != ""} {
    193             append str " less than $max"
    194         }
    195 
    196         if {$units != ""} {
    197             set desc [Rappture::Units::description $units]
    198             append str " with units of $desc"
    199         }
     186        append str "\n\nEnter a number"
     187
     188        if {$min != "" && $max != ""} {
     189            append str " between $min and $max"
     190        } elseif {$min != ""} {
     191            append str " greater than $min"
     192        } elseif {$max != ""} {
     193            append str " less than $max"
     194        }
     195
     196        if {$units != ""} {
     197            set desc [Rappture::Units::description $units]
     198            append str " with units of $desc"
     199        }
    200200    }
    201201    return [string trim $str]
     
    218218    set valid {normal disabled}
    219219    if {[lsearch -exact $valid $itk_option(-state)] < 0} {
    220         error "bad value \"$itk_option(-state)\": should be [join $valid {, }]"
     220        error "bad value \"$itk_option(-state)\": should be [join $valid {, }]"
    221221    }
    222222    $itk_component(gauge) configure -state $itk_option(-state)
Note: See TracChangeset for help on using the changeset viewer.