This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
[PATCH] Use new itcl::feedback option "fraction"
- From: Keith Seitz <keiths at redhat dot com>
- To: Insight Maling List <insight at sources dot redhat dot com>
- Date: Mon, 1 Apr 2002 14:42:51 -0800 (PST)
- Subject: [PATCH] Use new itcl::feedback option "fraction"
Hi,
This is the follow-on patch for the feedback widget change I just
committed. This fixes the growing problems with the meters in the download
dialog.
Keith
ChangeLog
2002-04-01 Keith Seitz <keiths@redhat.com>
* library/download.itb (constructor): Set feedback meter
to "0.0".
Remove "steps" array.
(update_download): Use fractional completions for feedback.
(done): Ditto.
* library/download.ith (protected variable steps): Remove.
Patch
Index: library/download.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.itb,v
retrieving revision 1.6
diff -p -r1.6 download.itb
*** library/download.itb 2001/07/13 23:59:05 1.6
--- library/download.itb 2002/04/01 22:42:37
*************** body Download::constructor {args} {
*** 31,42 ****
set i 0
while {$i <$num_sections} {
! iwidgets::feedback $f.meter$i -steps $num_steps
grid forget [$f.meter$i component percentage]
label $f.sec$i -text [lindex $section(names) $i] -anchor w
label $f.num$i -text $bytes($i) -anchor e
grid $f.sec$i $f.meter$i $f.num$i -padx 4 -pady 4 -sticky news
- set steps($i) 0
incr i
}
grid columnconfigure $f 1 -weight 1
--- 31,41 ----
set i 0
while {$i <$num_sections} {
! iwidgets::feedback $f.meter$i -steps $num_steps -fraction 0.0
grid forget [$f.meter$i component percentage]
label $f.sec$i -text [lindex $section(names) $i] -anchor w
label $f.num$i -text $bytes($i) -anchor e
grid $f.sec$i $f.meter$i $f.num$i -padx 4 -pady 4 -sticky news
incr i
}
grid columnconfigure $f 1 -weight 1
*************** body Download::update_download { sec num
*** 64,79 ****
set i $section($s)
if {$s == $sec} {
! set stepSize [expr {int($bytes($i) / $num_steps)}]
! set new_step [expr {int($num / $stepSize)}]
! set diff [expr {$new_step - $steps($i)}]
! set steps($i) $new_step
! $itk_interior.f.meter$i step $diff
break
} else {
! if {$steps($i) != $num_steps} {
! $itk_interior.f.meter$i step $num_steps
! }
}
}
--- 63,73 ----
set i $section($s)
if {$s == $sec} {
! set f [expr {$num / $bytes($i)}]
! $itk_interior.f.meter$i configure -fraction $f
break
} else {
! $itk_interior.f.meter$i configure -fraction 1.0
}
}
*************** body Download::done { {msg ""} } {
*** 97,105 ****
# set all indicators to FULL
foreach sec $section(names) {
set i $section($sec)
! if {$steps($i) != $num_steps} {
! $itk_interior.f.meter$i step $num_steps
! }
}
} else {
# download failed
--- 91,97 ----
# set all indicators to FULL
foreach sec $section(names) {
set i $section($sec)
! $itk_interior.f.meter$i configure -fraction 1.0
}
} else {
# download failed
Index: library/download.ith
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/download.ith,v
retrieving revision 1.2
diff -p -r1.2 download.ith
*** library/download.ith 2001/07/13 23:59:05 1.2
--- library/download.ith 2002/04/01 22:42:37
*************** class Download {
*** 16,23 ****
inherit ManagedWin
protected {
- variable steps
-
common total_bytes
common section
common bytes
--- 16,21 ----