Changeset 3647 for trunk


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

add string trim to inputs

Location:
trunk/gui/scripts
Files:
15 edited

Legend:

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

    r3523 r3647  
    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]
  • trunk/gui/scripts/booleanentry.tcl

    r3635 r3647  
    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
  • trunk/gui/scripts/choiceentry.tcl

    r3513 r3647  
    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
  • trunk/gui/scripts/controls.tcl

    r3642 r3647  
    577577        foreach name $showing {
    578578            set wv $_name2info($name-value)
    579             $wv configure -heading no
    580 
    581             set label [$wv component heading cget -text]
    582             if {"" == $label} {
    583                 set label "Group #$gn"
    584             }
    585             set _name2info($name-label) $label
    586             $_tabs insert end $name -text $label \
    587                 -activebackground $itk_option(-background) \
    588                 -window $_frame -fill both
    589 
    590             incr gn
     579            if { [winfo class $wv] == "GroupEntry" } {
     580                $wv configure -heading no
     581                set label [$wv component heading cget -text]
     582                if {"" == $label} {
     583                    set label "Group #$gn"
     584                }
     585                set _name2info($name-label) $label
     586                $_tabs insert end $name -text $label \
     587                    -activebackground $itk_option(-background) \
     588                    -window $_frame -fill both
     589                incr gn
    591590        }
    592591
  • trunk/gui/scripts/drawingentry.tcl

    r3636 r3647  
    264264# ----------------------------------------------------------------------
    265265itcl::body Rappture::DrawingEntry::label {} {
    266     set label [$_owner xml get $_path.about.label]
     266    set label [string trim [$_owner xml get $_path.about.label]]
    267267    if {$label eq ""} {
    268268        set label "Drawing"
  • trunk/gui/scripts/gauge.tcl

    r3642 r3647  
    139139    }
    140140
     141    itk_component add spindn {
     142        button $itk_component(spinner).down -image [Rappture::icon intminus] \
     143            -borderwidth 1 -relief raised -highlightthickness 0 \
     144            -command [itcl::code $this bump -1]
     145    } {
     146        usual
     147        ignore -borderwidth -highlightthickness
     148        rename -background -buttonbackground buttonBackground Background
     149    }
     150    pack $itk_component(spindn) -side left -expand yes -fill both
     151
    141152    itk_component add spinup {
    142153        button $itk_component(spinner).up -image [Rappture::icon intplus] \
     
    148159        rename -background -buttonbackground buttonBackground Background
    149160    }
    150     pack $itk_component(spinup) -side left -expand yes -fill both
    151 
    152     itk_component add spindn {
    153         button $itk_component(spinner).down -image [Rappture::icon intminus] \
    154             -borderwidth 1 -relief raised -highlightthickness 0 \
    155             -command [itcl::code $this bump -1]
    156     } {
    157         usual
    158         ignore -borderwidth -highlightthickness
    159         rename -background -buttonbackground buttonBackground Background
    160     }
    161     pack $itk_component(spindn) -side right -expand yes -fill both
    162 
     161    pack $itk_component(spinup) -side right -expand yes -fill both
    163162
    164163    itk_component add presets {
     
    214213        # response about min and max values in familiar units.
    215214        #
    216         set newval [set nv [lindex $args 0]]
     215        set newval [set nv [string trim [lindex $args 0]]]
    217216        set units $itk_option(-units)
    218217        if {"" != $units} {
  • trunk/gui/scripts/groupentry.tcl

    r3330 r3647  
    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
  • trunk/gui/scripts/imageentry.tcl

    r3513 r3647  
    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
  • trunk/gui/scripts/integerentry.tcl

    r3513 r3647  
    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]]
  • trunk/gui/scripts/loader.tcl

    r3513 r3647  
    9494    set newfile ""
    9595    foreach comp [$_owner xml children -type new $path] {
    96         set name [string trim [$_owner xml get $path.$comp]]
     96        set name  [string trim [$_owner xml get $path.$comp]]
    9797        set fname [file join $fdir examples $name]
    9898
     
    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)
     
    239239
    240240    set _copyfrom [string trim [$_owner xml get $path.copy.from]]
    241     set _copyto [string trim [$_owner xml get $path.copy.to]]
     241    set _copyto   [string trim [$_owner xml get $path.copy.to]]
    242242
    243243    #
     
    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
  • trunk/gui/scripts/main.tcl

    r3513 r3647  
    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}
  • trunk/gui/scripts/numberentry.tcl

    r3511 r3647  
    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 != ""} {
  • trunk/gui/scripts/periodicelemententry.tcl

    r3513 r3647  
    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
  • trunk/gui/scripts/spinint.tcl

    r3642 r3647  
    6767    pack $itk_component(controls) -side right
    6868
     69    itk_component add down {
     70        button $itk_component(controls).spindn \
     71            -image [Rappture::icon intminus] \
     72            -borderwidth 1 -relief raised -highlightthickness 0 \
     73            -command [itcl::code $this bump down]
     74    } {
     75        usual
     76        ignore -borderwidth -highlightthickness
     77        rename -background -buttonbackground buttonBackground Background
     78    }
     79    pack $itk_component(down) -side left -expand yes -fill both
     80
    6981    itk_component add up {
    7082        button $itk_component(controls).spinup \
     
    7789        rename -background -buttonbackground buttonBackground Background
    7890    }
    79     pack $itk_component(up) -side left -expand yes -fill both
    80 
    81     itk_component add down {
    82         button $itk_component(controls).spindn \
    83             -image [Rappture::icon intminus] \
    84             -borderwidth 1 -relief raised -highlightthickness 0 \
    85             -command [itcl::code $this bump down]
    86     } {
    87         usual
    88         ignore -borderwidth -highlightthickness
    89         rename -background -buttonbackground buttonBackground Background
    90     }
    91     pack $itk_component(down) -side right -expand yes -fill both
     91    pack $itk_component(up) -side right -expand yes -fill both
    9292
    9393    eval itk_initialize $args
  • trunk/gui/scripts/textentry.tcl

    r3636 r3647  
    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
Note: See TracChangeset for help on using the changeset viewer.