summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-10-10 16:00:46 +0000
committerdamien <damien@mandriva.com>2001-10-10 16:00:46 +0000
commitb4bd91dd44dce7dd64485e089ae2b607a59e5807 (patch)
tree836dad46879de59beab68e71acde04c008593264 /perl-install/standalone
parent61d7ac50f63bacf8e1389dc34e059dd014dffc46 (diff)
downloaddrakx-backup-do-not-use-b4bd91dd44dce7dd64485e089ae2b607a59e5807.tar
drakx-backup-do-not-use-b4bd91dd44dce7dd64485e089ae2b607a59e5807.tar.gz
drakx-backup-do-not-use-b4bd91dd44dce7dd64485e089ae2b607a59e5807.tar.bz2
drakx-backup-do-not-use-b4bd91dd44dce7dd64485e089ae2b607a59e5807.tar.xz
drakx-backup-do-not-use-b4bd91dd44dce7dd64485e089ae2b607a59e5807.zip
ergo and features improvments, pipe handling correction
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/net_monitor109
1 files changed, 79 insertions, 30 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 031cbfab2..2c503a860 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -173,7 +173,9 @@ connection() if ($connect && !$isconnected || $disconnect && $isconnected);
Gtk->main;
Gtk->exit(0);
+my $during_connection;
sub connection {
+ $during_connection = 1;
my $isconnected2 = $isconnected;
$button_connect->set_sensitive(0);
$button_close->set_sensitive(0);
@@ -212,6 +214,7 @@ sub connection {
});
$button_connect->set_sensitive(1);
$button_close->set_sensitive(1);
+ undef $during_connection;
0;
});
Gtk->main_iteration while Gtk->events_pending;
@@ -316,6 +319,7 @@ sub change_color {
my_gtk::gtkcolor($color[0]*65535, $color[1]*65535, $color[2]*65535);
}
+my $scale;
sub update {
connected_bg(\$isconnected);
my @intfs = get_val();
@@ -328,30 +332,50 @@ sub update {
$default_intf = $intf;
$monitor->{$intf}{initialr} = $monitor->{$intf}{val}->[0];
$monitor->{$intf}{initialt} = $monitor->{$intf}{val}->[8];
+ $monitor->{$intf}{darea} = new Gtk::DrawingArea();
+ $monitor->{$intf}{darea}->set_events(["pointer_motion_mask"]);
$notebook->append_page(gtkshow(my $page = gtkpack_(new Gtk::VBox(0,0),
0, gtkpack__(gtkset_border_width(new Gtk::HBox(0,0), 5),
- gtksize($monitor->{$intf}{darea} = new Gtk::DrawingArea(),300, 150)),
- 0, gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_t = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colort = change_color($colort);
- $gct->set_foreground($colort);
- $_[0]->draw(undef);
- }),
- _("sent: "), $monitor->{$intf}{labelt} = new Gtk::Label("0")),
- 0, gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_r = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colorr = change_color($colorr);
- $gcr->set_foreground($colorr);
- $_[0]->draw(undef);
- }),
- _("received: "), $monitor->{$intf}{labelr} = new Gtk::Label("0")),
- 0, gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
- gtksignal_connect(my $button_a = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
- $colora = change_color($colora);
- $gca->set_foreground($colora);
- $_[0]->draw(undef);
- }),
- _("average"))
+ gtksize($monitor->{$intf}{darea},300, 150)),
+ 0, gtkpack_(new Gtk::HBox(0,0),
+ 1, gtkpack__(new Gtk::VBox(0,0),
+ gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
+ gtksignal_connect(my $button_t = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
+ $colort = change_color($colort);
+ $gct->set_foreground($colort);
+ $_[0]->draw(undef);
+ }),
+ _("sent: "), $monitor->{$intf}{labelt} = new Gtk::Label("0")),
+ gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
+ gtksignal_connect(my $button_r = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
+ $colorr = change_color($colorr);
+ $gcr->set_foreground($colorr);
+ $_[0]->draw(undef);
+ }),
+ _("received: "), $monitor->{$intf}{labelr} = new Gtk::Label("0")),
+ gtkpack__(gtkset_border_width(new Gtk::HBox(0,5), 5),
+ gtksignal_connect(my $button_a = gtkset_relief(new Gtk::Button(), 'none'), clicked => sub {
+ $colora = change_color($colora);
+ $gca->set_foreground($colora);
+ $_[0]->draw(undef);
+ }),
+ _("average"))
+ ),
+ 0, gtkpack__(gtkset_border_width(new Gtk::VBox(0,0), 5),
+ gtkadd(gtkset_shadow_type(new Gtk::Frame(_("Local measure")), 'etched_out'),
+ gtkpack__(gtkset_border_width(new Gtk::VBox(0,0), 5),
+ gtkpack__(new Gtk::HBox(0,0),
+ _('sent: '),
+ my $measure_t = new Gtk::Label("0")
+ ),
+ gtkpack__(new Gtk::HBox(0,0),
+ _('received: '),
+ my $measure_r = new Gtk::Label("0")
+ )
+ )
+ )
+ )
+ )
)),
new Gtk::Label($intf));
foreach my $i ([$button_t, $gct],[$button_r, $gcr],[$button_a, $gca]) {
@@ -363,6 +387,18 @@ sub update {
$monitor->{$intf}{referencer} = $monitor->{$intf}{val}->[0];
$monitor->{$intf}{referencet} = $monitor->{$intf}{val}->[8];
$monitor->{$intf}{pixmap_db}->draw_rectangle ($monitor->{$intf}{darea}->style->black_gc, 1, 0, 0, 300, 150);
+ $monitor->{$intf}{darea}->signal_connect( motion_notify_event =>
+ sub { my ($w, $e) = @_;
+ my $x = $e->{'x'} - 50;
+ my $y = $e->{'y'};
+ my $received = $x >= 0 ? $monitor->{$intf}{stack_r}[$x] : 0;
+ my $transmitted = $x >= 0 ? $monitor->{$intf}{stack_t}[$x] : 0;
+ my $type;
+ $y * $scale / 150 < $transmitted and $type = _('transmitted');
+ (150 - $y) * $scale / 150 < $received and $type = _('received');
+ $measure_r->set(formatXiB($received));
+ $measure_t->set(formatXiB($transmitted));
+ });
$monitor->{$intf}{darea}->signal_connect( expose_event => sub {
$monitor->{$intf}{darea}->window->draw_pixmap ($monitor->{$intf}{darea}->style->bg_gc('normal'),
$monitor->{$intf}{pixmap_db}, 0, 0, 0, 0, 300, 150);
@@ -377,7 +413,7 @@ sub update {
}
@interfaces = @intfs;
my $netc={};
- if ($isconnected != -1) {
+ if ($isconnected != -1 && !$during_connection) {
$button_connect->set_sensitive(1);
$label_c->set($isconnected ? _("Disconnect") : _("Connect"));
$statusbar->pop(1);
@@ -401,12 +437,13 @@ sub draw_monitor {
foreach (@{$o->{stack_t}}) { $maxt = $_ if $_>$maxt }
my $ech = $maxr + $maxt;
$ech == 0 and $ech = 1;
- my $step=50;
+ $scale = $ech;
+ my $step=49;
foreach (@{$o->{stack_t}}) {
$o->{pixmap_db}->draw_rectangle($gct, 1, $step, 0, 1, $_*150/$ech);
$step++;
}
- $step=50;
+ $step=49;
my ($av1, $av2, $last_a);
foreach (@{$o->{stack_ta}}) {
if($_ != -1) {
@@ -420,12 +457,12 @@ sub draw_monitor {
}
$step++;
}
- $step=50;
+ $step=49;
foreach (@{$o->{stack_r}}) {
$o->{pixmap_db}->draw_rectangle($gcr, 1, $step, 151-$_*150/$ech, 1, $_*150/$ech);
$step++;
}
- $step=50;
+ $step=49;
($av1, $av2) = undef;
foreach (@{$o->{stack_ra}}) {
if($_ != -1) {
@@ -439,6 +476,7 @@ sub draw_monitor {
$step++;
}
+ my $switch = 1;
my $gcl = new Gtk::Gdk::GC($o->{darea}->window);
$gcl->set_foreground($o->{darea}->window->get_colormap->color_white());
$gcl->set_line_attributes (1, 'on-off-dash', 'not-last', 'round');
@@ -456,13 +494,24 @@ sub draw_monitor {
if ($dif1 < $dif2) {
$text = formatXiB((150-$i)*$ech/150);
$gc2=$gcr;
+ my $x_l=5;
+ if ($i > 30 && $switch) {
+ $o->{pixmap_db}->draw_line($gct, $x_l, 0, $x_l, $i-30);
+ $o->{pixmap_db}->draw_line($gct, $x_l-1, 0, $x_l-1, $i-30);
+ $o->{pixmap_db}->draw_line($gct, $x_l+1, 0, $x_l+1, $i-30);
+ $o->{pixmap_db}->draw_polygon($gct, 1, $x_l-4, $i-30, $x_l+5, $i-30, $x_l, $i-25);
+ }
+ if ($switch) {
+ $o->{pixmap_db}->draw_line($gcr, $x_l, 150, $x_l, $i);
+ $o->{pixmap_db}->draw_line($gcr, $x_l-1, 150, $x_l-1, $i);
+ $o->{pixmap_db}->draw_line($gcr, $x_l+1, 150, $x_l+1, $i);
+ $o->{pixmap_db}->draw_polygon($gcr, 1, $x_l-5, $i, $x_l+5, $i, $x_l, $i-6);
+ }
+ undef $switch;
} else {
$text = formatXiB($i*$ech/150);
$gc2=$gct;
}
-# $text = formatXiB((150-$i)*$ech/150);
-# $gc2 = $o->{darea}->style->white_gc;
-
my $w = $style->font->string_width($text);
$o->{pixmap_db}->draw_string($style->font, $gc2, 45-$w, $i+5, ($text) );
}