Changeset 3646 for branches/1.2


Ignore:
Timestamp:
May 14, 2013 2:33:22 PM (8 years ago)
Author:
gah
Message:

add string trim to inputs

Location:
branches/1.2/gui/scripts
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/gui/scripts/analyzer.tcl

    r3523 r3646  
    5050    itk_option define -notebookpage notebookPage NotebookPage ""
    5151
    52     constructor {tool args} { # defined below }
    53     destructor { # defined below }
     52    constructor {tool args} {
     53        # defined below
     54    }
     55    destructor {
     56        # defined below
     57    }
    5458
    5559    public method simulate {args}
     
    101105
    102106    # use this to store all simulation results
    103     set _resultset [Rappture::ResultSet ::#auto]
     107    set _resultset [Rappture::ResultSet ::\#auto]
    104108    $_resultset notify add $this [itcl::code $this _fixResultSet]
    105109
     
    119123    pack $itk_component(simbg) -expand yes -fill both
    120124
    121     set simtxt [$tool xml get tool.action.label]
     125    set simtxt [string trim [$tool xml get tool.action.label]]
    122126    if {"" == $simtxt} {
    123127        set simtxt "Simulate"
     
    341345        -font $itk_option(-boldtextfont)
    342346
    343     set mesg [$tool xml get tool.title]
     347    set mesg [string trim [$tool xml get tool.title]]
    344348    if {"" != $mesg} {
    345349        $itk_component(toolinfo) insert end $mesg title
     
    347351    }
    348352
    349     set mesg [$tool xml get tool.about]
     353    set mesg [string trim [$tool xml get tool.about]]
    350354    if {"" != $mesg} {
    351355        $itk_component(toolinfo) insert end $mesg
     
    506510        clear
    507511    }
    508 
    509512    $_resultset add $xmlobj
    510513
     
    9991002                set details ""
    10001003                foreach {path val} $settings {
    1001                     set str [$_tool xml get $path.about.label]
     1004                    set str [string trim [$_tool xml get $path.about.label]]
    10021005                    if {"" == $str} {
    10031006                        set str [$_tool xml element -as id $path]
  • branches/1.2/gui/scripts/booleanentry.tcl

    r3513 r3646  
    123123            return
    124124        }
    125         set newval [lindex $args 0]
     125        set newval [string trim [lindex $args 0]]
    126126        $itk_component(switch) value $newval
    127127        event generate $itk_component(hull) <<Value>>
     
    145145# ----------------------------------------------------------------------
    146146itcl::body Rappture::BooleanEntry::label {} {
    147     set label [$_owner xml get $_path.about.label]
     147    set label [string trim [$_owner xml get $_path.about.label]]
    148148    if {"" == $label} {
    149149        set label "Boolean"
     
    161161# ----------------------------------------------------------------------
    162162itcl::body Rappture::BooleanEntry::tooltip {} {
    163     set str [$_owner xml get $_path.about.description]
     163    set str [string trim [$_owner xml get $_path.about.description]]
    164164    append str "\n\nClick to turn on/off"
    165     return [string trim $str]
     165    return $str
    166166}
    167167
  • branches/1.2/gui/scripts/choiceentry.tcl

    r3513 r3646  
    136136# ----------------------------------------------------------------------
    137137itcl::body Rappture::ChoiceEntry::label {} {
    138     set label [$_owner xml get $_path.about.label]
     138    set label [string trim [$_owner xml get $_path.about.label]]
    139139    if {"" == $label} {
    140140        set label "Choice"
     
    193193                $_owner notify add $this $cntl [itcl::code $this _rebuild]
    194194
    195                 set label [$_owner xml get $_path.$cname.about.label]
     195                set label \
     196                    [string trim [$_owner xml get $_path.$cname.about.label]]
    196197                if {"" == $label} {
    197198                    set label "%type #%n"
     
    208209                        set subst(%id) [$_owner xml element -as id $leading.$ccname]
    209210                        foreach detail [$_owner xml children $leading.$ccname] {
    210                             set subst(%$detail) [$_owner xml get $leading.$ccname.$detail]
     211                            set subst(%$detail) \
     212                                [$_owner xml get $leading.$ccname.$detail]
    211213                        }
    212214                        set str [string map [array get subst] $label]
     
    226228            #
    227229            set val [string trim [$_owner xml get $_path.$cname.value]]
    228             set str [$_owner xml get $_path.$cname.about.label]
     230            set str [string trim [$_owner xml get $_path.$cname.about.label]]
    229231            if {"" == $val} {
    230232                set val $str
     
    276278# ----------------------------------------------------------------------
    277279itcl::body Rappture::ChoiceEntry::_tooltip {} {
    278     set tip [$_owner xml get $_path.about.description]
     280    set tip [string trim [$_owner xml get $_path.about.description]]
    279281
    280282    # get the description for the current choice, if there is one
     
    283285    set desc ""
    284286    if {$path != ""} {
    285         set desc [$_owner xml get $path.about.description]
     287        set desc [string trim [$_owner xml get $path.about.description]]
    286288    }
    287289
  • branches/1.2/gui/scripts/field3dresult.tcl

    r3330 r3646  
    5656    }
    5757    array set flags $args
    58    switch -- $flags(-mode) {
     58    set servers ""
     59    switch -- $flags(-mode) {
    5960        "auto" - "nanovis" - "flowvis" {
    6061            set servers [Rappture::VisViewer::GetServerList "nanovis"]
     
    6566        "vtk" {
    6667            # Old vtk contour widget
    67             set servers ""
    6868        }
    6969        default {
  • branches/1.2/gui/scripts/groupentry.tcl

    r3330 r3646  
    6464
    6565    $itk_component(heading) configure \
    66         -text [$_owner xml get $_path.about.label]
     66        -text [string trim [$_owner xml get $_path.about.label]]
    6767    Rappture::Tooltip::for $itk_component(heading) \
    68         [$_owner xml get $_path.about.description]
     68        [string trim [$_owner xml get $_path.about.description]]
    6969
    7070    itk_component add outline {
     
    121121# ----------------------------------------------------------------------
    122122itcl::body Rappture::GroupEntry::tooltip {} {
    123     return [$_owner xml get $_path.about.description]
     123    return [string trim [$_owner xml get $_path.about.description]]
    124124}
    125125
  • branches/1.2/gui/scripts/imageentry.tcl

    r3513 r3646  
    191191# ----------------------------------------------------------------------
    192192itcl::body Rappture::ImageEntry::label {} {
    193     set label [$_owner xml get $_path.about.label]
    194     return [string trim $label]
     193    set label [string trim [$_owner xml get $_path.about.label]]
     194    return $label
    195195}
    196196
     
    204204# ----------------------------------------------------------------------
    205205itcl::body Rappture::ImageEntry::tooltip {} {
    206     set str [$_owner xml get $_path.about.description]
    207     return [string trim $str]
     206    set str [string trim [$_owner xml get $_path.about.description]]
     207    return $str
    208208}
    209209
  • branches/1.2/gui/scripts/integerentry.tcl

    r3513 r3646  
    142142# ----------------------------------------------------------------------
    143143itcl::body Rappture::IntegerEntry::label {} {
    144     set label [$_owner xml get $_path.about.label]
     144    set label [string trim [$_owner xml get $_path.about.label]]
    145145    if {"" == $label} {
    146146        set label "Integer"
     
    158158# ----------------------------------------------------------------------
    159159itcl::body Rappture::IntegerEntry::tooltip {} {
    160     set str [$_owner xml get $_path.about.description]
    161 
     160    set str [string trim [$_owner xml get $_path.about.description]]
    162161    set min [string trim [$_owner xml get $_path.min]]
    163162    set max [string trim [$_owner xml get $_path.max]]
  • branches/1.2/gui/scripts/loader.tcl

    r3513 r3646  
    136136                continue
    137137            }
    138             set label [$_owner xml get $topath.about.label]
    139             set desc [$_owner xml get $topath.about.description]
     138            set label [string trim [$_owner xml get $topath.about.label]]
     139            set desc [string trim [$_owner xml get $topath.about.description]]
    140140            lappend _uppath $topath $label $desc
    141141        }
     
    164164                set _dnpath2state($this-$frompath) [expr {$i == 0}]
    165165
    166                 set label [$_owner xml get $frompath.about.label]
     166                set label [string trim [$_owner xml get $frompath.about.label]]
    167167                checkbutton $inner.cb$i -text $label \
    168168                    -variable ::Rappture::Loader::_dnpath2state($this-$frompath)
     
    401401# ----------------------------------------------------------------------
    402402itcl::body Rappture::Loader::_tooltip {} {
    403     set str [$_owner xml get $_path.about.description]
     403    set str [string trim [$_owner xml get $_path.about.description]]
    404404
    405405    # get the description for the current choice, if there is one
  • branches/1.2/gui/scripts/main.tcl

    r3513 r3646  
    196196# ----------------------------------------------------------------------
    197197Rappture::MainWin .main -borderwidth 0
    198 .main configure -title [$tool xml get tool.title]
     198.main configure -title [string trim [$tool xml get tool.title]]
    199199wm withdraw .main
    200200wm protocol .main WM_DELETE_WINDOW {Rappture::Logger::cleanup; exit}
  • branches/1.2/gui/scripts/numberentry.tcl

    r3511 r3646  
    5555    foreach pre [$_owner xml children -type preset $path] {
    5656        set value [string trim [$_owner xml get $path.$pre.value]]
    57         set label [$_owner xml get $path.$pre.label]
     57        set label [string trim [$_owner xml get $path.$pre.label]]
    5858        lappend presets $value $label
    5959    }
     
    146146            return
    147147        }
    148         set newval [lindex $args 0]
     148        set newval [string trim [lindex $args 0]]
    149149        $itk_component(gauge) value $newval
    150150        return $newval
     
    167167# ----------------------------------------------------------------------
    168168itcl::body Rappture::NumberEntry::label {} {
    169     set label [$_owner xml get $_path.about.label]
     169    set label [string trim [$_owner xml get $_path.about.label]]
    170170    if {"" == $label} {
    171171        set label "Number"
     
    183183# ----------------------------------------------------------------------
    184184itcl::body Rappture::NumberEntry::tooltip {} {
    185     set str [$_owner xml get $_path.about.description]
     185    set str   [string trim [$_owner xml get $_path.about.description]]
    186186
    187187    set units [string trim [$_owner xml get $_path.units]]
    188     set min [string trim [$_owner xml get $_path.min]]
    189     set max [string trim [$_owner xml get $_path.max]]
     188    set min   [string trim [$_owner xml get $_path.min]]
     189    set max   [string trim [$_owner xml get $_path.max]]
    190190
    191191    if {$units != "" || $min != "" || $max != ""} {
  • branches/1.2/gui/scripts/periodicelemententry.tcl

    r3513 r3646  
    5353    set defval [string trim [$_owner xml get $_path.default]]
    5454    # Active and inactive are lists.  Don't need to trim.
    55     set active [$_owner xml get $_path.active]
    56     set inactive [$_owner xml get $_path.inactive]
     55    set active [string trim [$_owner xml get $_path.active]]
     56    set inactive [string trim [$_owner xml get $_path.inactive]]
    5757    #
    5858    # Create the widget and configure it properly based on other
     
    173173# ----------------------------------------------------------------------
    174174itcl::body Rappture::PeriodicElementEntry::_tooltip {} {
    175     set tip [$_owner xml get $_path.about.description]
     175    set tip [string trim [$_owner xml get $_path.about.description]]
    176176
    177177    # get the description for the current element, if there is one
    178178    set str [$itk_component(element) element get -all]
    179179    if {$_path != ""} {
    180         set desc [$_owner xml get $_path.about.description]
     180        set desc [string trim [$_owner xml get $_path.about.description]]
    181181    }
    182182
  • branches/1.2/gui/scripts/textentry.tcl

    r3513 r3646  
    8686
    8787    set hints [string trim [$_owner xml get $path.about.hints]]
    88     set icon [string trim [$_owner xml get $path.about.icon]]
     88    set icon  [string trim [$_owner xml get $path.about.icon]]
    8989    if {[string length $icon] > 0} {
    9090        set _icon [image create photo -data $icon]
     
    103103    eval itk_initialize $args
    104104
    105     # Don't trim the text default value.  Assume that any leading/trailing
    106     # whitespace is wanted.
    107     set str [$_owner xml get $path.default]
     105    # Trimming for now.  May need a <verbatim> flag to indicate to leave
     106    # the string alone.
     107    set str [string trim [$_owner xml get $path.default]]
    108108    if {"" != $str} {
    109109        value $str
     
    165165# ----------------------------------------------------------------------
    166166itcl::body Rappture::TextEntry::label {} {
    167     set label [$_owner xml get $_path.about.label]
     167    set label [string trim [$_owner xml get $_path.about.label]]
    168168    if {"" == $label} {
    169169        set label "String"
     
    181181# ----------------------------------------------------------------------
    182182itcl::body Rappture::TextEntry::tooltip {} {
    183     set str [$_owner xml get $_path.about.description]
    184     return [string trim $str]
     183    set str [string trim [$_owner xml get $_path.about.description]]
     184    return $str
    185185}
    186186
     
    492492# ----------------------------------------------------------------------
    493493itcl::body Rappture::TextEntry::_edit {option args} {
    494 puts "_edit $option $args"
    495494    if {$itk_option(-state) == "disabled"} {
    496495        return  ;# disabled? then bail out here!
  • branches/1.2/gui/scripts/xyprint.tcl

    r3609 r3646  
    14511451        }
    14521452        set axis [list $axis]
    1453         append out "    if \{ \[preview axis names $axis] == $axis \} \{\n"
     1453        append out "    if \{ [llength [preview axis names $axis]] == 1 \} \{\n"
    14541454        append out "        preview axis configure $axis"
    14551455        foreach opt { -hide -min -max -loose -title -stepsize -subdivisions } {
Note: See TracChangeset for help on using the changeset viewer.