summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ivymon24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/ivymon b/src/ivymon
index b5c1679..b94444d 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -7,6 +7,7 @@ use Tk::Balloon;
use Tk::FBox;
use Tk::ErrorDialog;
use Tk::Dialog;
+use Tk::ProgressBar;
use Ivy;
use Carp;
use strict 'vars';
@@ -827,7 +828,7 @@ sub deletemarker {
sub addmarker {
my $index = shift;
my $marker = shift;
- print "index=$index marker=$marker\n";
+ #print "index=$index marker=$marker\n";
$messagesText->configure(-state => 'normal');
$messagesText->insert($index, "$marker\n");
$messagesText->tagAdd($marker, $index, "$index + ".(length($marker)+1)." chars");
@@ -1383,13 +1384,13 @@ sub loadfile {
$messagesNumber++;
$line++;
&updateMessages($sender, $message, 1);
- #print "sender=$sender message=$message\n";
+ #print "sender=$sender message=$message step=$step line=$line\n";
$progressbar->value($line);
- $progressbar->update if ($line % $step == 0);
+ $progressbar->update if ($step == 0 or $line % $step == 0);
}
}
close(IN);
- $progressbar->value(0);
+ $progressbar->value(0);
} # end loadfile
@@ -1414,16 +1415,29 @@ sub savefile {
my $nblines = $messagesText->index("end");
$nblines =~ s/\.\d+$//;
+ $nblines--;
+ $progressbar->configure(-to => $nblines);
+ my $step = int($nblines/10);
+ #print "step=$step\n";
print OUT "messages_number=$nblines\n" or $mw->Tk::Error("$!\n");
# save messages 100 by 100, in order to reduce memory usage
my $index = "1.0";
+ my $counter = 0;
while(1) {
my $messages = $messagesText->get($index, "$index + 100 lines");
$index = "$index + 100 lines";
- last unless $messages;
+ unless ($messages) {
+ $progressbar->value($nblines);
+ $progressbar->update;
+ last;
+ }
print OUT $messages or $mw->Tk::Error("$!\n");
+ $progressbar->value($counter);
+ $counter += 100;
+ $progressbar->update if ($step == 0 or $counter % $step == 0);
}
close(OUT);
+ $progressbar->value(0);
} # end savefile