diff options
author | etienne | 2001-11-27 10:57:51 +0000 |
---|---|---|
committer | etienne | 2001-11-27 10:57:51 +0000 |
commit | bc835dde6c3598cd88d655cc7febb6c2a559b928 (patch) | |
tree | c807398143a9fb6f4ba06ee6ccaae24a419aa6c1 | |
parent | b9cdee7c060c5b83bc53c19c58382e6f5d713a21 (diff) | |
download | ivymon-bc835dde6c3598cd88d655cc7febb6c2a559b928.zip ivymon-bc835dde6c3598cd88d655cc7febb6c2a559b928.tar.gz ivymon-bc835dde6c3598cd88d655cc7febb6c2a559b928.tar.bz2 ivymon-bc835dde6c3598cd88d655cc7febb6c2a559b928.tar.xz |
* Correction de bug concernant les fonctions Save/Load
-rwxr-xr-x | src/ivymon | 24 |
1 files changed, 19 insertions, 5 deletions
@@ -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 |