Ignore:
Timestamp:
Oct 22, 2010, 4:06:10 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r1861 r1929  
    4646itcl::body Rappture::Progress::constructor {args} {
    4747    itk_component add bar {
    48         canvas $itk_interior.bar -highlightthickness 0
     48        canvas $itk_interior.bar -highlightthickness 0
    4949    } {
    50         usual
    51         keep -borderwidth -relief
    52         ignore -highlightthickness -highlightbackground -highlightcolor
     50        usual
     51        keep -borderwidth -relief
     52        ignore -highlightthickness -highlightbackground -highlightcolor
    5353    }
    5454    pack $itk_component(bar) -expand yes -fill both
     
    5656
    5757    itk_component add message {
    58         label $itk_interior.mesg -anchor w -width 1
     58        label $itk_interior.mesg -anchor w -width 1
    5959    }
    6060
     
    7676itcl::body Rappture::Progress::settings {args} {
    7777    if {[llength $args] == 0} {
    78         return [list -percent $_percent -message $_message]
     78        return [list -percent $_percent -message $_message]
    7979    }
    8080
    8181    Rappture::getopts args params {
    82         value -percent ""
    83         value -message "__ignore__"
     82        value -percent ""
     83        value -message "__ignore__"
    8484    }
    8585
    8686    set changed 0
    8787    if {$params(-percent) != ""} {
    88         if {![string is double $params(-percent)]} {
    89             error "bad value \"$params(-percent)\": should be 0-100"
    90         }
    91         if {$params(-percent) < 0} {
    92             set params(-percent) 0
    93         }
    94         if {$params(-percent) > 100} {
    95             set params(-percent) 100
    96         }
    97         set _percent $params(-percent)
    98         set changed 1
     88        if {![string is double $params(-percent)]} {
     89            error "bad value \"$params(-percent)\": should be 0-100"
     90        }
     91        if {$params(-percent) < 0} {
     92            set params(-percent) 0
     93        }
     94        if {$params(-percent) > 100} {
     95            set params(-percent) 100
     96        }
     97        set _percent $params(-percent)
     98        set changed 1
    9999    }
    100100    if {$params(-message) != "__ignore__"} {
    101         set _message $params(-message)
    102         set changed 1
     101        set _message $params(-message)
     102        set changed 1
    103103    }
    104104
    105105    if {$changed} {
    106         _redraw
    107         update idletasks
     106        _redraw
     107        update idletasks
    108108    }
    109109}
     
    119119
    120120    if {[string length $_message] > 0} {
    121         $itk_component(message) configure -text $_message
    122         pack $itk_component(message) -fill x
     121        $itk_component(message) configure -text $_message
     122        pack $itk_component(message) -fill x
    123123    } else {
    124         pack forget $itk_component(message)
     124        pack forget $itk_component(message)
    125125    }
    126126
    127127    if {[$itk_component(bar) find all] == ""} {
    128         $itk_component(bar) create rectangle 0 0 1 1 \
    129             -outline "" -fill $itk_option(-barbackground) -tags barbg
    130         $itk_component(bar) create rectangle 0 0 1 1 \
    131             -outline "" -fill $itk_option(-barcolor) -tags bar
    132         $itk_component(bar) create text 0 0 \
    133             -anchor center -text "" -font $itk_option(-font) -tags number
     128        $itk_component(bar) create rectangle 0 0 1 1 \
     129            -outline "" -fill $itk_option(-barbackground) -tags barbg
     130        $itk_component(bar) create rectangle 0 0 1 1 \
     131            -outline "" -fill $itk_option(-barcolor) -tags bar
     132        $itk_component(bar) create text 0 0 \
     133            -anchor center -text "" -font $itk_option(-font) -tags number
    134134    }
    135135
Note: See TracChangeset for help on using the changeset viewer.