1 # git-gui status bar mega-widget
2 # Copyright (C) 2007 Shawn Pearce
6 field w ; # our own window path
7 field w_l ; # text widget we draw messages into
8 field w_c ; # canvas we draw a progress bar into
9 field status {}; # single line of text we show
10 field prefix {}; # text we format into status
11 field units {}; # unit of progress
13 constructor new {path} {
22 -textvariable @status \
27 bind $w <Destroy> [cb _delete %W]
31 method start {msg uds} {
32 if {[winfo exists $w_c]} {
33 $w_c coords bar 0 0 0 20
37 -height [expr {int([winfo reqheight $w_l] * 0.6)}] \
41 $w_c create rectangle 0 0 0 20 -tags bar -fill navy
50 method update {have total} {
53 set pdone [expr {100 * $have / $total}]
56 set status [format "%s ... %i of %i %s (%2i%%)" \
57 $prefix $have $total $units $pdone]
58 $w_c coords bar 0 0 $pdone 20
70 method _delete {current} {