From e1d8100a9f6913dff978511616810aa8f672ad87 Mon Sep 17 00:00:00 2001 From: etienne Date: Fri, 6 Oct 2006 08:52:53 +0000 Subject: Meilleure gestion de la barre de progression de chargement de fichier. --- src/ivymon | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index 406769e..4030feb 100755 --- a/src/ivymon +++ b/src/ivymon @@ -2162,32 +2162,33 @@ sub loadfile { } # end loadfile +#______ sub stepsnumber { - my $step = 0; - my $timefound; - my $lc; - # select loading mode - # if the 1rst message contains a time field, a dialog window - # will be displayed in order to select replay mode or simple - # display mode. - while() { - chomp; - next if (/^applications=/ or /^(marker\d+)$/); - if (/^messages_number=(.*)/) { - $step = int($1/10); - next; - } - my ($sender, $message) = split(/\s+/, $_, 2); - $timefound = 1 if $message =~ /^(\d[\d\.]+\d)\s+.*/; - last if $step; - $lc++; - } - $step = int($lc/10) unless $step; - $progressbar->configure(-to => $step*10); - seek(IN, 0, 0); - return ($step, $timefound); - + my $step = 0; + my $timefound; + my $lc = 0; + # select loading mode + # if the 1rst message contains a time field, a dialog window + # will be displayed in order to select replay mode or simple + # display mode. + + # get lines number and test if exists time field + while() { + chomp; + next if (/^applications=/ or /^(marker\d+)$/ or /^(messages_number=)/ + or /^\#/); + my ($sender, $message) = split(/\s+/, $_, 2); + if ($message =~ /^(\d[\d\.]+\d)\s+.*/) { + $timefound = 1; + } + $lc++; + } + $step = int($lc/10); + $progressbar->configure(-to => $step*10); + seek(IN, 0, 0); + return ($step, $timefound); + } # end stepsnumber -- cgit v1.1