summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2001-12-17 15:50:54 +0000
committeretienne2001-12-17 15:50:54 +0000
commit4ac1d2665fbf41061f9d0d7de30a2e42c0a3361f (patch)
tree9ad82fbd4848b975bade7be3bc47a680100cbee5
parent9170396199f00b449d75cbba7c7c45bf8f0753f2 (diff)
downloadivymon-4ac1d2665fbf41061f9d0d7de30a2e42c0a3361f.zip
ivymon-4ac1d2665fbf41061f9d0d7de30a2e42c0a3361f.tar.gz
ivymon-4ac1d2665fbf41061f9d0d7de30a2e42c0a3361f.tar.bz2
ivymon-4ac1d2665fbf41061f9d0d7de30a2e42c0a3361f.tar.xz
* On adapte le rafraichissement de l'affichae en fonction d'une nombre de messages
a afficher : cela se traduit par un affichage plus rapide lors de sequence Scroll lock/Scroll, ou lors de flux de messages importants. * Retour du bouton Clear * Affichage d'une fenetre de confirmation pour les actions Clear et Exit * Ajout des messages SectorEvent, SelectionEvent, DeselectionEvent, ClosedClearanceEditor, OpenClearanceEditor a la liste des messages a envoyer * L'insertion d'un marqueur se fait lors d'un double click sur l'entete du message (l'appname) afin de pouvoir toujours exploiter les double-clicks de selection de mot; l'insertion se fait desormais apres le message * Correction de bugs concernant : o le chargement de fichier (trop lent). o les appname comportant des blancs. o l'ajout de caracteres " superflus apres une sequence Save/Load
-rwxr-xr-xsrc/ivymon168
1 files changed, 133 insertions, 35 deletions
diff --git a/src/ivymon b/src/ivymon
index 24b1a21..7eef0a9 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -54,15 +54,21 @@ my $markers_cnt = 0;
my $duration = 0;
my $time = 0;
my $fmtduration = '00:00';
-my $bytes = 0 ;
+
+# displayed messages counters
my $messagesNumber = 0;
+my $messagesLastNumber = 0;
+my $messagesSpeed = 0;
+
my $bindingsFlag = 0;
my $stopFlag = 0;
my $noMessageYet = 1;
my $jump_cnt = 0;
-my $appname = 'IvyMon';
+my $noUpdateFlag = 0;
+my $appname = 'IvyMon';
+$appname =~ s/ /_/g;
# Rejeu messages array
my @send_def =
@@ -117,6 +123,15 @@ my @send_def =
'FileWrite Type=rejeu Name=',
'FileWrite Type=simu Name=',
'FileWrite Type=dump Name=',
+ 'SelectionEvent acc= wp= role= Flight=',
+ 'SelectionEvent acc= wp= Flight=',
+ 'DeselectionEvent acc= wp= role= Flight=',
+ 'DeselectionEvent acc= wp= Flight=',
+ 'ClosedClearanceEditor Acc= Wp= Role= Flight=',
+ 'ClosedClearanceEditor Acc= Wp= Flight=',
+ 'OpenClearanceEditor Acc= Wp= Role= Flight=',
+ 'OpenClearanceEditor Acc= Wp= Flight=',
+ 'SectorEvent Flight= SectorOut= SectorIn= Time=',
);
# Rejeu available (not effective) bindings array
@@ -331,11 +346,9 @@ my $top2_fm = $top_fm->Frame()->pack(-side => 'top',
);
my $messagesLabel =
$top2_fm->Label(-text => "Messages :")->pack(-side => 'left');
-
-my $messagesCounterLabel =
+my $messagesCounterValue =
$top2_fm->Label(-textvariable => \$messagesNumber)->pack(-side => 'right');
-
my $messagesText =
$top_fm->Scrolled(Text,
-scrollbars => 'e',
@@ -349,7 +362,7 @@ my $messagesText =
-side => 'bottom');
&wheelmousebindings($messagesText);
$messagesText->bind('<1>', sub {$messagesText->focus;});
-$messagesText->bind('<Double-1>', \&marker);
+$messagesText->tagBind('sender', '<Double-1>', \&marker);
my $bgcolor = $messagesText->cget(-background);
@@ -369,6 +382,30 @@ $messagesText->tagConfigure('marker3', -background => 'darkseagreen',
$messagesText->tagConfigure('marker4',
-background => 'ivory', -foreground => 'ivory');
+for my $marker (qw(marker0 marker1 marker2 marker3 marker4)) {
+ $messagesText->tagBind($marker, '<Double-1>', \&marker);
+}
+
+
+# check received messages speed and adjust drawing frequency
+$messagesCounterValue->repeat(1000, sub {
+ $messagesSpeed = $messagesNumber - $messagesLastNumber;
+ $messagesLastNumber = $messagesNumber;
+ # if update mechanism is off, we force it here
+ if ($noUpdateFlag) {
+ $messagesCounterValue->update;
+ $messagesText->see('end');
+ }
+ # if too many messages, update mechanism is unset
+ if ($messagesSpeed > 50) {
+ $noUpdateFlag = 1;
+ #print "$messagesSpeed received messages/second !\n";
+ # in nominal case, update mechanism is set
+ # (each time a message is received, update is forced in Text window)
+ } else {
+ $noUpdateFlag = 0;
+ }
+});
#----------------------------------------------------------------------------------
# Bindings area
@@ -528,8 +565,15 @@ $control_fm->Checkbutton(-text => 'Balloon help',
}
);
$balloon_cb->grid(-column => 1,
- -columnspan => 3,
+ -columnspan => 2,
-row => 1);
+my $exitButton =
+ $control_fm->Button(-height => 2,
+ -width => 4,
+ -command => [\&bye],
+ -text => 'Exit')->grid(-column => 3,
+ -row => 1);
+
my $loadButton =
$control_fm->Button(-height => 2,
-width => 4,
@@ -566,13 +610,13 @@ my $stopButton =
-command => [\&stop, 1],
-text => "Scroll\nLock")->grid(-column => 2,
-row => 3);
-my $exitButton =
+my $clearButton =
$control_fm->Button(-height => 2,
-width => 4,
- -command => [\&bye],
- -text => 'Exit')->grid(-column => 3,
- -row => 3);
-
+ -command => [\&clear, 1],
+ -state => 'normal',
+ -text => 'Clear')->grid(-column => 3,
+ -row => 3);
#----------------------------------------------------------------------------------
# Update default bindings and messages lists
#----------------------------------------------------------------------------------
@@ -609,7 +653,7 @@ $balloonhelp->attach($effectivebindingsList, -balloonmsg =>
);
$balloonhelp->attach($clientsListbox,-balloonmsg =>
"Select an application name to highlight\n".
- "related Ivy messages in the Messages area");
+ "related Ivy messages in the Messages area.");
$balloonhelp->attach($sendEntry, -balloonmsg =>
"This input field is used to enter new messages or\n".
"edit default one from list above. In both case, hit\n".
@@ -623,8 +667,9 @@ $balloonhelp->attach($sendList, -balloonmsg =>
"or double click on predefined message to send it."
);
$balloonhelp->attach($messagesText, -balloonmsg =>
- "You can insert colored marker by double-clicking between\n".
- "two messages. Then, you can quickly access markers\n".
+ "You can insert colored marker by double-clicking on a\n".
+ "message application name (marker will be created after\n".
+ "the message). Then, you can quickly access markers\n".
"using the [Jump] button in control panel. To remove a\n".
"marker, just double-click on it."
);
@@ -636,13 +681,25 @@ $balloonhelp->attach($searchEntry, -balloonmsg =>
"keys to access previous inputs."
);
$balloonhelp->attach($stopButton, -balloonmsg =>
- "Stop scrolling in Messages area"
+ "Stop scrolling in Messages area."
);
$balloonhelp->attach($startButton, -balloonmsg =>
- "Restart scrolling in Messages area"
+ "Restart scrolling in Messages area."
);
$balloonhelp->attach($jumpButton, -balloonmsg =>
- "Access next marker in Messages area"
+ "Access next marker in Messages area."
+ );
+$balloonhelp->attach($clearButton, -balloonmsg =>
+ "Remove messages displayed\n".
+ "in Messages area."
+ );
+$balloonhelp->attach($loadButton, -balloonmsg =>
+ "Load messages file and display\n".
+ "its content in Messages area."
+ );
+$balloonhelp->attach($saveButton, -balloonmsg =>
+ "Save the content of Messages\n".
+ "area in a file."
);
# alarm on balloon help
@@ -701,7 +758,9 @@ sub addIvyBinding {
if ($stopFlag) {
&bufferizeMessages(@_);
} else {
+ &beforeUpdatingMessages;
&updateMessages(@_);
+ &afterUpdatingMessages;
}
}]);
@@ -724,6 +783,7 @@ sub checkClientsStatus {
my $status = $_[4];
my $host = $_[5];
my $message;
+ $appname =~ s/ /_/g;
if ($status eq 'died') {
$connectedClients{$appname}--;
} elsif ($status eq 'new') {
@@ -819,7 +879,7 @@ sub marker {
if ($foundmarker) {
&deletemarker($foundmarker);
} else {
- my $index = $messagesText->index('current linestart');
+ my $index = $messagesText->index('current linestart + 1 lines');
my $nb = $markers_cnt % 5;
&addmarker($index, 'marker'.$nb);
$markers_cnt++;
@@ -855,24 +915,22 @@ sub bufferizeMessages {
push(@messagesbuffer, [$sender, $message]);
splice(@messagesbuffer, 0, 1) if @messagesbuffer > $history;
-}
+} # end bufferizeMessages
-sub dumpBuffMessages {
- my (@messages) = @_;
- for my $msg (@messages) {
- &updateMessages($msg->[0], $msg->[1]);
- }
+sub beforeUpdatingMessages {
+ $messagesText->configure(-state => 'normal');
+
+
+} # end beforeUpdatingMessages
-} # end dumpBuffMessages
sub updateMessages {
- my ($sender, $message, $noUpdateFlag) = @_;
+ my ($sender, $message) = @_;
$noMessageYet = 0;
chomp($message);
$message = '"' . $message . '"' ;
# is scrolling is available, format and then display message
my $text = "$sender $message\n";
- $messagesText->configure(-state => 'normal');
# look at history : compare widget text lines number with history size
my ($linesNb) = split(/\./, $messagesText->index('end'));
$linesNb--;
@@ -893,13 +951,15 @@ sub updateMessages {
$index1 = "$index2 + 1 chars";
$index2 = "$index1 + $msglen chars";
$messagesText->tagAdd($sender, $index1, $index2);
- $messagesText->configure(-state => 'disabled');
- $messagesText->see('end');
- $bytes += length($message);
$messagesText->update unless $noUpdateFlag;
} # end updateMessages
+sub afterUpdatingMessages {
+ $messagesText->see('end');
+ $messagesText->configure(-state => 'disabled');
+
+} # end afterUpdatingMessages
sub highlightString {
my ($i1, $i2) = @_;
@@ -1131,7 +1191,9 @@ sub sendMsg {
my $entry = shift;
$ivy->sendMsgs($entry);
$messagesNumber++;
+ &beforeUpdatingMessages;
&updateMessages($appname, $entry);
+ &afterUpdatingMessages;
} # end sendMsg
@@ -1345,7 +1407,16 @@ sub searchAll {
# Functions related to control panel
#----------------------------------------------------------------------------------
sub bye {
- #$ivy->stop;
+ if ($messagesNumber > 0) {
+ my $diag = $mw->Dialog(-text =>
+ "Really quit Ivymon ?",
+ -default_button => 'OK',
+ -buttons => [qw(OK Cancel)]);
+ my $answer = $diag->Show;
+ if ($answer eq 'Cancel') {
+ return;
+ }
+ }
exit;
}
@@ -1380,9 +1451,13 @@ sub start {
$messagesText->insert('insert', "\n");
}
$startButton->configure(-state => 'disabled');
+ $noUpdateFlag = 1;
+ &beforeUpdatingMessages;
for my $msg (@messagesbuffer) {
&updateMessages($msg->[0], $msg->[1]);
}
+ &afterUpdatingMessages;
+ $noUpdateFlag = 0;
$stopFlag = 0;
$stopButton->configure(-state => 'normal');
@@ -1414,6 +1489,8 @@ sub loadfile {
my %client;
my $step = 0;
my $line = 0;
+ $noUpdateFlag = 1;
+ &beforeUpdatingMessages;
while(<IN>) {
chomp;
if (/^applications=/) {
@@ -1436,14 +1513,17 @@ sub loadfile {
}
$messagesNumber++;
$line++;
- &updateMessages($sender, $message, 1);
+ $message =~ s/^\"(.*)\"$/$1/;
+ &updateMessages($sender, $message);
#print "sender=$sender message=$message step=$step line=$line\n";
$progressbar->value($line);
$progressbar->update if ($step == 0 or $line % $step == 0);
}
}
+ &afterUpdatingMessages;
+ $noUpdateFlag = 0;
close(IN);
- $progressbar->value(0);
+ $progressbar->value(0);
} # end loadfile
@@ -1508,6 +1588,24 @@ sub savefile {
} # end savefile
+sub clear {
+ if ($messagesNumber > 0) {
+ my $diag = $mw->Dialog(-text =>
+ "Do you really want to remove displayed messages ?",
+ -default_button => 'OK',
+ -buttons => [qw(OK Cancel)]);
+ my $answer = $diag->Show;
+ if ($answer eq 'Cancel') {
+ return;
+ }
+ }
+ $messagesText->configure(-state => 'normal');
+ $messagesNumber = 0;
+ $messagesText->delete('0.0', 'end');
+ $messagesText->configure(-state => 'disabled');
+
+} # end clear
+
#----------------------------------------------------------------------------------
# General functions
@@ -1662,7 +1760,7 @@ The B<Control> panel contains some general control buttons. Set ou unset balloon
=item B<-b> ip:port
-Sets the bus domain and port number to be used (default: 127.255.255.255:2010)
+Sets the bus domain and port number to be used. Use $IVYBUS variable if defined. Default is 127.255.255.255:2010.
=item B<-help>