@matheusbsbs / matheus-bagliano / commits / 96225dbe96
Fork 0

git-gui: Make the status bar easier to read in the setup wizard

The setup wizard looks better if we layout the progress bar as two lines: the first line holds the message text and our text formatting of the progress while the second line holds the bar itself. Both extend the full width of the window and we try to pad out the message text so the window doesn't expand when the completed progress number jumps to the next order of magnitude. This change required updating the progress meter format string to allow the application to supply the precision. So we also are updating all of the translations at once to use the newer formatting string. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Sep 26, 2007 at 15:31 UTC 96225dbe966fdbf00ef1a3a1dd801534953c9919
9 files changed +47 -19
lib/choose_repository.tcl
+2 -2
@@ -481,7 +481,7 @@ method _do_clone2 {} {
481
482 switch -exact -- $clone_type {
483 hardlink {
484 - set o_cons [status_bar::new $w_body]
484 + set o_cons [status_bar::two_line $w_body]
485 pack $w_body -fill x -padx 10 -pady 10
486
487 $o_cons start \
@@ -780,7 +780,7 @@ method _do_clone_checkout {HEAD} {
780 return
781 }
782
783 - set o_cons [status_bar::new $w_body]
783 + set o_cons [status_bar::two_line $w_body]
784 pack $w_body -fill x -padx 10 -pady 10
785 $o_cons start \
786 [mc "Creating working directory"] \
lib/status_bar.tcl
+33 -5
@@ -6,6 +6,7 @@ class status_bar {
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 c_pack ; # script to pack the canvas with
10 field status {}; # single line of text we show
11 field prefix {}; # text we format into status
12 field units {}; # unit of progress
@@ -24,6 +25,29 @@ constructor new {path} {
25 -anchor w \
26 -justify left
27 pack $w_l -side left
28 + set c_pack [cb _oneline_pack]
29 +
30 + bind $w <Destroy> [cb _delete %W]
31 + return $this
32 +}
33 +
34 +method _oneline_pack {} {
35 + $w_c conf -width 100
36 + pack $w_c -side right
37 +}
38 +
39 +constructor two_line {path} {
40 + set w $path
41 + set w_l $w.l
42 + set w_c $w.c
43 +
44 + frame $w
45 + label $w_l \
46 + -textvariable @status \
47 + -anchor w \
48 + -justify left
49 + pack $w_l -anchor w -fill x
50 + set c_pack [list pack $w_c -fill x]
51
52 bind $w <Destroy> [cb _delete %W]
53 return $this
@@ -34,13 +58,12 @@ method start {msg uds} {
58 $w_c coords bar 0 0 0 20
59 } else {
60 canvas $w_c \
37 - -width 100 \
61 -height [expr {int([winfo reqheight $w_l] * 0.6)}] \
62 -borderwidth 1 \
63 -relief groove \
64 -highlightt 0
65 $w_c create rectangle 0 0 0 20 -tags bar -fill navy
43 - pack $w_c -side right
66 + eval $c_pack
67 }
68
69 set status $msg
@@ -53,11 +76,16 @@ method update {have total} {
76 set pdone 0
77 if {$total > 0} {
78 set pdone [expr {100 * $have / $total}]
79 + set cdone [expr {[winfo width $w_c] * $have / $total}]
80 }
81
58 - set status [mc "%s ... %i of %i %s (%2i%%)" \
59 - $prefix $have $total $units $pdone]
60 - $w_c coords bar 0 0 $pdone 20
82 + set prec [string length [format %i $total]]
83 + set status [mc "%s ... %*i of %*i %s (%3i%%)" \
84 + $prefix \
85 + $prec $have \
86 + $prec $total \
87 + $units $pdone]
88 + $w_c coords bar 0 0 $cdone 20
89 }
90
91 method update_meter {buf} {
po/de.po
+2 -2
@@ -1350,8 +1350,8 @@ msgstr "Fehler beim Erstellen des Icons:"
1350
1351 #: lib/status_bar.tcl:58
1352 #, tcl-format
1353 -msgid "%s ... %i of %i %s (%2i%%)"
1354 -msgstr "%s ... %i von %i %s (%2i%%)"
1353 +msgid "%s ... %*i of %*i %s (%3i%%)"
1354 +msgstr "%s ... %*i von %*i %s (%3i%%)"
1355
1356 #: lib/transport.tcl:7
1357 #, tcl-format
po/git-gui.pot
+1 -1
@@ -1216,7 +1216,7 @@ msgstr ""
1216
1217 #: lib/status_bar.tcl:58
1218 #, tcl-format
1219 -msgid "%s ... %i of %i %s (%2i%%)"
1219 +msgid "%s ... %*i of %*i %s (%3i%%)"
1220 msgstr ""
1221
1222 #: lib/transport.tcl:7
po/hu.po
+2 -2
@@ -1344,8 +1344,8 @@ msgstr "Nem sikerült írni az ikont:"
1344
1345 #: lib/status_bar.tcl:58
1346 #, tcl-format
1347 -msgid "%s ... %i of %i %s (%2i%%)"
1348 -msgstr "%s ... %i / %i %s (%2i%%)"
1347 +msgid "%s ... %*i of %*i %s (%3i%%)"
1348 +msgstr "%s ... %*i / %*i %s (%3i%%)"
1349
1350 #: lib/transport.tcl:7
1351 #, tcl-format
po/it.po
+2 -2
@@ -1344,8 +1344,8 @@ msgstr "Impossibile scrivere icona:"
1344
1345 #: lib/status_bar.tcl:58
1346 #, tcl-format
1347 -msgid "%s ... %i of %i %s (%2i%%)"
1348 -msgstr "%s ... %i di %i %s (%2i%%)"
1347 +msgid "%s ... %*i of %*i %s (%3i%%)"
1348 +msgstr "%s ... %*i di %*i %s (%3i%%)"
1349
1350 #: lib/transport.tcl:7
1351 #, tcl-format
po/ja.po
+2 -2
@@ -1333,8 +1333,8 @@ msgstr "アイコンが書けません:"
1333
1334 #: lib/status_bar.tcl:58
1335 #, tcl-format
1336 -msgid "%s ... %i of %i %s (%2i%%)"
1337 -msgstr "%1$s ... %3$i %4$s 中の %$2i (%5$2i%%)"
1336 +msgid "%s ... %*i of %*i %s (%3i%%)"
1337 +msgstr "%1$s ... %3$*i %4$s 中の %$2*i (%5$3i%%)"
1338
1339 #: lib/transport.tcl:7
1340 #, tcl-format
po/ru.po
+2 -2
@@ -1434,8 +1434,8 @@ msgstr "Невозможно записать значок:"
1434
1435 #: lib/status_bar.tcl:58
1436 #, tcl-format
1437 -msgid "%s ... %i of %i %s (%2i%%)"
1438 -msgstr "%s ... %i из %i %s (%2i%%)"
1437 +msgid "%s ... %*i of %*i %s (%3i%%)"
1438 +msgstr "%s ... %*i из %*i %s (%3i%%)"
1439
1440 #: lib/transport.tcl:7
1441 #, tcl-format
po/zh_cn.po
+1 -1
@@ -1238,7 +1238,7 @@ msgstr ""
1238
1239 #: lib/status_bar.tcl:58
1240 #, tcl-format
1241 -msgid "%s ... %i of %i %s (%2i%%)"
1241 +msgid "%s ... %*i of %*i %s (%3i%%)"
1242 msgstr ""
1243
1244 #: lib/transport.tcl:7