Commit 42c467ae authored by Mac Newbold's avatar Mac Newbold

Minor fixes. Renamed reboot to cycle.

parent 0fd45560
......@@ -16,7 +16,7 @@ my @machines=();
#set up main
my $main = MainWindow->new();
$main->title("Power");
$main->title("vpower - Visual Power");
#$main->minsize( qw(200 100) );
$main->configure(-background => $main_bg );
......@@ -47,43 +47,43 @@ my @mach;
my @machvals;
$mach[1] =
$frm1->Checkbutton(-variable=>\$machvals[1], -text=>"test1",
$frm1->Checkbutton(-variable=>\$machvals[1], -text=>"tbpc01",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[2] =
$frm1->Checkbutton(-variable=>\$machvals[2], -text=>"test2",
$frm1->Checkbutton(-variable=>\$machvals[2], -text=>"tbpc02",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[3] =
$frm1->Checkbutton(-variable=>\$machvals[3], -text=>"test3",
$frm1->Checkbutton(-variable=>\$machvals[3], -text=>"tbpc03",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[4] =
$frm1->Checkbutton(-variable=>\$machvals[4], -text=>"test4",
$frm1->Checkbutton(-variable=>\$machvals[4], -text=>"tbpc04",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[5] =
$frm1->Checkbutton(-variable=>\$machvals[5], -text=>"test5",
$frm1->Checkbutton(-variable=>\$machvals[5], -text=>"tbpc05",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[6] =
$frm2->Checkbutton(-variable=>\$machvals[6], -text=>"test6",
$frm2->Checkbutton(-variable=>\$machvals[6], -text=>"tbpc06",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[7] =
$frm2->Checkbutton(-variable=>\$machvals[7], -text=>"test7",
$frm2->Checkbutton(-variable=>\$machvals[7], -text=>"tbpc07",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[8] =
$frm2->Checkbutton(-variable=>\$machvals[8], -text=>"test8",
$frm2->Checkbutton(-variable=>\$machvals[8], -text=>"tbpc08",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[9] =
$frm2->Checkbutton(-variable=>\$machvals[9], -text=>"test9",
$frm2->Checkbutton(-variable=>\$machvals[9], -text=>"tbpc09",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[10] =
$frm2->Checkbutton(-variable=>\$machvals[10], -text=>"test10",
$frm2->Checkbutton(-variable=>\$machvals[10], -text=>"tbpc10",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[11] =
......@@ -123,7 +123,7 @@ my $op_off =
my $op_cyc =
$frm3->
Radiobutton( -variable=> \$op, -text => 'Reboot',-background=>$main_bg,
Radiobutton( -variable=> \$op, -text => 'Cycle',-background=>$main_bg,
-value=>'cycle', -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
......@@ -137,7 +137,8 @@ my $go =
@machines=();
while ($n <= $#machvals ) {
if (defined($machvals[$n])&&$machvals[$n]==1) {
push(@machines,"test$n") if ($n <= 10);
push(@machines,"tbpc0$n") if ($n < 10);
push(@machines,"tbpc$n") if ($n == 10);
push(@machines,"alpha") if ($n==11);
push(@machines,"beta") if ($n==12);
push(@machines,"gamma") if ($n==13);
......@@ -145,23 +146,28 @@ my $go =
}
$n++;
}
if ($#machines<0) {
&message
($msg_area,
"Please select at least one machine.");
} elsif (!$op) {
&message ($msg_area,
"Please select an operation.");
} else {
my @output=();
open(PWR,"power $op @machines |");
while (<PWR>) {
chop;
push (@output,$_);
}
&message ($msg_area,
join ("\n",@output));
}
if ($#machines<0) {
&message
($msg_area,
"Please select at least one machine.");
} elsif (!$op) {
&message ($msg_area,
"Please select an operation.");
} else {
my @output=();
open(PWR,"power $op @machines |");
while (<PWR>) {
chop;
push (@output,$_);
}
&message ($msg_area,
join ("\n",@output));
my $n=0;
while ($n <= $#machvals ) {
$machvals[$n]=0;
$n++;
}
}
})
->pack(-side=>'left',-anchor=>'s',-fill=>'x',
-padx=>'2',-pady=>'2');
......@@ -171,7 +177,7 @@ my $help_btn=
-anchor=>'center', -relief=>'raised',-command=>sub {
&message( $msg_area,
"Select machine(s) to update\n",
"Select on, off, or reboot\n",
"Select on, off, or cycle\n",
"Press the Go! button"); } )
->pack(-side=>'left',-anchor=>'s',-fill=>'x',
-padx=>'2',-pady=>'2');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment