summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2004-02-12 15:20:49 +0000
committeretienne2004-02-12 15:20:49 +0000
commitea7526c706d3b69b71d9243c5addb9d6c0a59693 (patch)
treedd26ebca69bad2c3aed7b8c4f0c140103eb6b25b
parent774a010e8337ac75e1b1708e2f92df9c1c131c19 (diff)
downloadivymon-ea7526c706d3b69b71d9243c5addb9d6c0a59693.zip
ivymon-ea7526c706d3b69b71d9243c5addb9d6c0a59693.tar.gz
ivymon-ea7526c706d3b69b71d9243c5addb9d6c0a59693.tar.bz2
ivymon-ea7526c706d3b69b71d9243c5addb9d6c0a59693.tar.xz
*** empty log message ***
-rw-r--r--debian/changelog7
-rwxr-xr-xsrc/ivymon92
2 files changed, 88 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog
index 8641bb0..600a2e9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ivymon (1.4) unstable; urgency=low
+
+ * Add a 'Filter' button to display the messages sent by an agent in a
+ separate window .
+
+ -- Daniel Etienne <etienne@cena.fr> Thu, 12 Feb 2004 16:20:10 +0100
+
ivymon (1.3) unstable; urgency=low
* New option: -size, allow the setting of the main window dimension.
diff --git a/src/ivymon b/src/ivymon
index 24dbe0b..1c72a93 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -28,6 +28,7 @@ my $casesensitiveflag = 1;
my $regexpflag = 0;
# misc
my $hostname = hostname();
+my %clientsMessagesTpl;
my %connectedClients;
my %clientsBindings;
my %clientBindingsTpl;
@@ -426,25 +427,29 @@ $clientsListbox->bind('<1>', [\&selectClient]);
$clientsListbox->bind('<Double-1>', [\&showClientBindings]);
&wheelmousebindings($clientsListbox);
-my $clientsButtons_fm = $clients_fm->Frame(
- )->pack(-fill => 'both', -expand => 1, -side => 'bottom');
+my $clientsButtons_fm =
+ $clients_fm->Frame()->pack(-fill => 'both', -expand => 1, -side => 'bottom');
-my $clientsSeeBindings_btnmsg = "See bindings";
-if($smallsized){
- $clientsSeeBindings_btnmsg = "Bindings";
-}
my $clientsSeeBindings_btn =
$clientsButtons_fm->Button(-command => [\&showClientBindings],
-state => 'disabled',
- -text => $clientsSeeBindings_btnmsg
- )->pack(-side => 'left');
+ -text => 'See bindings',
+ )->pack(-side => 'top', -fill => 'both', -expand => 1);
+my $clientsButtons2_fm =
+ $clientsButtons_fm->Frame()->pack(-fill => 'both', -expand => 1, -side => 'top');
+my $clientsFilter_btn =
+ $clientsButtons2_fm->Button(-command => [\&filterClient],
+ -state => 'disabled',
+ -text => "Filter",
+ )->pack(-side => 'left', -fill => 'both', -expand => 1);
my $clientsKill_btn =
- $clientsButtons_fm->Button(-command => [\&killClient],
+ $clientsButtons2_fm->Button(-command => [\&killClient],
-state => 'disabled',
- -text => "Kill")->pack(-side => 'left');
+ -text => "Kill",
+ )->pack(-side => 'left', -fill => 'both', -expand => 1);
#----------------------------------------------------------------------------------
# Messages to send area
@@ -704,6 +709,8 @@ $balloonhelp->attach($clientsListbox,-balloonmsg =>
"Ivy messages in the Messages area. \n".
"Double-click on it to display the application \n".
"bindings or click on the 'See bindings' button.\n".
+ "To display messages in a separate window, click\n".
+ "on the 'Filter' button. \n".
"To kill an agent, click on the 'Kill' button. ");
$balloonhelp->attach($sendEntry, -balloonmsg =>
"This input field is used to enter new messages or\n".
@@ -855,7 +862,6 @@ sub removeClient {
for my $host ((keys(%{$connectedClients{$client}}))) {
$num += $connectedClients{$client}->{$host};
}
- print "client=$client num=$num\n";
delete $clientsBindings{$client} if $num == 0;
&manageClient($client, $host);
@@ -922,17 +928,64 @@ sub selectClient {
$selectedClient = undef;
$clientsListbox->selectionClear($selindex);
$clientsKill_btn->configure(-state => 'disabled');
+ $clientsFilter_btn->configure(-state => 'disabled');
$clientsSeeBindings_btn->configure(-state => 'disabled');
return;
}
$messagesText->tagConfigure($client, -background => 'gray70');
$selectedClient = $client;
$clientsKill_btn->configure(-state => 'normal');
+ $clientsFilter_btn->configure(-state => 'normal');
$clientsSeeBindings_btn->configure(-state => 'normal');
} # end selectClient
+sub filterClient {
+ my $selindex = $clientsListbox->curselection;
+ my $client = $clientsListbox->get($selindex);
+ $client =~ s/^-- //;
+ $client =~ s/\(\d+\)$//;
+ $client =~ s/\s.*//;
+ # si une fenetre client existe, on la raise
+ if (defined $clientsMessagesTpl{$client} and
+ Tk::Exists $clientsMessagesTpl{$client}) {
+ $clientsMessagesTpl{$client}->toplevel->raise;
+ return;
+ # sinon, on la crée
+ } else {
+ my $tpl = $mw->Toplevel;
+ my $title = "$client messages";
+ $tpl->title($title);
+ $tpl->Label(-text => $title)->pack(-side => 'top',
+ -padx => 10,
+ -pady => 10);
+ $clientsMessagesTpl{$client} =
+ $tpl->Scrolled('Text',
+ -scrollbars => 'e',
+ )->pack(-side => 'top',
+ -fill => 'both',
+ -expand => 1);
+ &wheelmousebindings($clientsMessagesTpl{$client});
+
+ $tpl->Button(-text => 'Close',
+ -command => [sub { $clientsMessagesTpl{$client} = undef;
+ $tpl->destroy;
+ }],
+ )->pack(-side => 'top',
+ -padx => 10,
+ -pady => 10);
+ }
+
+ my @list = $messagesText->tagRanges($client);
+ for (my $i=0; $i < @list; $i += 2) {
+ &updateClientMessages($client, $messagesText->get($list[$i], $list[$i+1]));
+ }
+ $clientsMessagesTpl{$client}->configure(-state => 'disabled');
+
+} # end filterClient
+
+
sub showClientBindings {
my $selindex = $clientsListbox->curselection;
@@ -964,6 +1017,7 @@ sub showClientBindings {
if $clientsBindings{$client}->{$regexp} > 0;
$i++;
}
+ $t->configure(-state => 'disabled');
$tpl->Button(-text => 'Close',
-command => [sub {$tpl->destroy;
$clientsListbox->selectionClear($_[0])
@@ -1079,6 +1133,20 @@ sub updateMessages {
} # end updateMessages
+sub updateClientMessages {
+ my ($sender, $message) = @_;
+ return unless $clientsMessagesTpl{$sender} and
+ Tk::Exists $clientsMessagesTpl{$sender};
+ $clientsMessagesTpl{$sender}->configure(-state => 'normal');
+ $clientsMessagesTpl{$sender}->insert('end', $message);
+ $clientsMessagesTpl{$sender}->insert('end', "\n");
+ $clientsMessagesTpl{$sender}->update unless $noUpdateFlag;
+ $clientsMessagesTpl{$sender}->see('end');
+ $clientsMessagesTpl{$sender}->configure(-state => 'disabled');
+
+} # end updateClientMessages
+
+
sub loadMessage {
my ($sender, $message) = @_;
$recordedNumber++;
@@ -1091,6 +1159,8 @@ sub loadMessage {
my $index3 = "$index2 + 1 chars";
my $index4 = "$index3 + ".length($message)." chars";
$messagesText->tagAdd($sender, $index3, $index4);
+ &updateClientMessages($sender, $message) if $clientsMessagesTpl{$sender} and
+ Tk::Exists $clientsMessagesTpl{$sender};
} # end loadmessages