Changeset 1929 for trunk/gui/scripts/progress.tcl
- Timestamp:
- Oct 22, 2010, 4:06:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/progress.tcl
r1861 r1929 46 46 itcl::body Rappture::Progress::constructor {args} { 47 47 itk_component add bar { 48 48 canvas $itk_interior.bar -highlightthickness 0 49 49 } { 50 51 52 50 usual 51 keep -borderwidth -relief 52 ignore -highlightthickness -highlightbackground -highlightcolor 53 53 } 54 54 pack $itk_component(bar) -expand yes -fill both … … 56 56 57 57 itk_component add message { 58 58 label $itk_interior.mesg -anchor w -width 1 59 59 } 60 60 … … 76 76 itcl::body Rappture::Progress::settings {args} { 77 77 if {[llength $args] == 0} { 78 78 return [list -percent $_percent -message $_message] 79 79 } 80 80 81 81 Rappture::getopts args params { 82 83 82 value -percent "" 83 value -message "__ignore__" 84 84 } 85 85 86 86 set changed 0 87 87 if {$params(-percent) != ""} { 88 89 90 91 92 93 94 95 96 97 98 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 99 99 } 100 100 if {$params(-message) != "__ignore__"} { 101 102 101 set _message $params(-message) 102 set changed 1 103 103 } 104 104 105 105 if {$changed} { 106 107 106 _redraw 107 update idletasks 108 108 } 109 109 } … … 119 119 120 120 if {[string length $_message] > 0} { 121 122 121 $itk_component(message) configure -text $_message 122 pack $itk_component(message) -fill x 123 123 } else { 124 124 pack forget $itk_component(message) 125 125 } 126 126 127 127 if {[$itk_component(bar) find all] == ""} { 128 129 130 131 132 133 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 134 134 } 135 135
Note: See TracChangeset
for help on using the changeset viewer.