summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7cb8f5)
raw | patch | inline | side by side (parent: a7cb8f5)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 26 Sep 2007 19:31:42 +0000 (15:31 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 26 Sep 2007 19:31:42 +0000 (15:31 -0400) |
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>
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>
lib/choose_repository.tcl | patch | blob | history | |
lib/status_bar.tcl | patch | blob | history | |
po/de.po | patch | blob | history | |
po/git-gui.pot | patch | blob | history | |
po/hu.po | patch | blob | history | |
po/it.po | patch | blob | history | |
po/ja.po | patch | blob | history | |
po/ru.po | patch | blob | history | |
po/zh_cn.po | patch | blob | history |
index 8d3c81e7c05e7f26f23070ab63352d17d031ec80..16bf67c34f0f4ee4ff795386cf70762b35b962c8 100644 (file)
switch -exact -- $clone_type {
hardlink {
- set o_cons [status_bar::new $w_body]
+ set o_cons [status_bar::two_line $w_body]
pack $w_body -fill x -padx 10 -pady 10
$o_cons start \
return
}
- set o_cons [status_bar::new $w_body]
+ set o_cons [status_bar::two_line $w_body]
pack $w_body -fill x -padx 10 -pady 10
$o_cons start \
[mc "Creating working directory"] \
diff --git a/lib/status_bar.tcl b/lib/status_bar.tcl
index 769ef81c4bfd153e55ae4cfcacbaaa6ac2c4ffd5..5c5bf7c731738db2bba607384715f5ab4fceba25 100644 (file)
--- a/lib/status_bar.tcl
+++ b/lib/status_bar.tcl
field w ; # our own window path
field w_l ; # text widget we draw messages into
field w_c ; # canvas we draw a progress bar into
+field c_pack ; # script to pack the canvas with
field status {}; # single line of text we show
field prefix {}; # text we format into status
field units {}; # unit of progress
-anchor w \
-justify left
pack $w_l -side left
+ set c_pack [cb _oneline_pack]
+
+ bind $w <Destroy> [cb _delete %W]
+ return $this
+}
+
+method _oneline_pack {} {
+ $w_c conf -width 100
+ pack $w_c -side right
+}
+
+constructor two_line {path} {
+ set w $path
+ set w_l $w.l
+ set w_c $w.c
+
+ frame $w
+ label $w_l \
+ -textvariable @status \
+ -anchor w \
+ -justify left
+ pack $w_l -anchor w -fill x
+ set c_pack [list pack $w_c -fill x]
bind $w <Destroy> [cb _delete %W]
return $this
$w_c coords bar 0 0 0 20
} else {
canvas $w_c \
- -width 100 \
-height [expr {int([winfo reqheight $w_l] * 0.6)}] \
-borderwidth 1 \
-relief groove \
-highlightt 0
$w_c create rectangle 0 0 0 20 -tags bar -fill navy
- pack $w_c -side right
+ eval $c_pack
}
set status $msg
set pdone 0
if {$total > 0} {
set pdone [expr {100 * $have / $total}]
+ set cdone [expr {[winfo width $w_c] * $have / $total}]
}
- set status [mc "%s ... %i of %i %s (%2i%%)" \
- $prefix $have $total $units $pdone]
- $w_c coords bar 0 0 $pdone 20
+ set prec [string length [format %i $total]]
+ set status [mc "%s ... %*i of %*i %s (%3i%%)" \
+ $prefix \
+ $prec $have \
+ $prec $total \
+ $units $pdone]
+ $w_c coords bar 0 0 $cdone 20
}
method update_meter {buf} {
diff --git a/po/de.po b/po/de.po
index 7d57dd15f93327752a01205a035b9ff3d8765cd3..94b7463ca3b8dec3c7f09ac32ddb2328730a46dc 100644 (file)
--- a/po/de.po
+++ b/po/de.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
-msgstr "%s ... %i von %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%s ... %*i von %*i %s (%3i%%)"
#: lib/transport.tcl:7
#, tcl-format
diff --git a/po/git-gui.pot b/po/git-gui.pot
index 991efea5f3f9f82ae9ba6e15528021470edcec58..b35230257241095eacad27f9666aa7552b85714b 100644 (file)
--- a/po/git-gui.pot
+++ b/po/git-gui.pot
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
msgstr ""
#: lib/transport.tcl:7
diff --git a/po/hu.po b/po/hu.po
index faac58f810d8dffa04374592f97390736d5177dd..1e189b60860c9962b9f2c1cf80e861cf4549a08f 100644 (file)
--- a/po/hu.po
+++ b/po/hu.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
-msgstr "%s ... %i / %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%s ... %*i / %*i %s (%3i%%)"
#: lib/transport.tcl:7
#, tcl-format
diff --git a/po/it.po b/po/it.po
index 17a5c218825ffb9a69ddd76b384db29737900c7f..ad5cd9e5da9f9ca7e849f5633f8070519045d55f 100644 (file)
--- a/po/it.po
+++ b/po/it.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
-msgstr "%s ... %i di %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%s ... %*i di %*i %s (%3i%%)"
#: lib/transport.tcl:7
#, tcl-format
diff --git a/po/ja.po b/po/ja.po
index 17139080ec394debed71679f2f6f8f5ad9ab971e..cdbc981ca5e95ab5eb51fa3b781444717a88b459 100644 (file)
--- a/po/ja.po
+++ b/po/ja.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
-msgstr "%1$s ... %3$i %4$s 中の %$2i (%5$2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%1$s ... %3$*i %4$s 中の %$2*i (%5$3i%%)"
#: lib/transport.tcl:7
#, tcl-format
diff --git a/po/ru.po b/po/ru.po
index c44d30af0af2b00901be456dc75fe5d25591ab4b..20080338c889c837860c838376da45dcc0041396 100644 (file)
--- a/po/ru.po
+++ b/po/ru.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
-msgstr "%s ... %i из %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
+msgstr "%s ... %*i из %*i %s (%3i%%)"
#: lib/transport.tcl:7
#, tcl-format
diff --git a/po/zh_cn.po b/po/zh_cn.po
index 45eb5b5f98f515182c42c7468d0b3c3be2246114..d1ed94f8a96dd6809f58e9d51ec4471c4ac1b2fd 100644 (file)
--- a/po/zh_cn.po
+++ b/po/zh_cn.po
#: lib/status_bar.tcl:58
#, tcl-format
-msgid "%s ... %i of %i %s (%2i%%)"
+msgid "%s ... %*i of %*i %s (%3i%%)"
msgstr ""
#: lib/transport.tcl:7