Commit c1c8aa0c authored by Mac Newbold's avatar Mac Newbold

Minor fixes... Fixed layout, etc.

parent a6f0680e
......@@ -5,6 +5,7 @@ use Tk;
#Color values
my $main_bg = 'grey80';
my $act_bg = 'grey90';
#other Variables
......@@ -24,119 +25,126 @@ my $msg_frm =
$main->Frame( -relief=>'sunken', -borderwidth=>2, -background=>$main_bg
)->pack(-side=>'bottom', -fill=>'x');
my $msg_area =
$msg_frm->Label(-background=>$main_bg) ->pack(-side=>'left');
$msg_frm->Label(-background=>$main_bg, -anchor=>'nw', -width=>'30')
->pack(-side=>'left', -anchor=>'nw');
my $op_frm =
$main->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'bottom', -fill=>'x');
my $button_frm =
$op_frm->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'bottom', -fill=>'x');
my $mach_frm =
my $frm =
$main->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'left', -fill=>'x');
my $mach_frm1 =
$mach_frm->Frame( -relief=>'flat', -background=>$main_bg
my $frm1 =
$frm->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'left', -fill=>'x');
my $mach_frm2 =
$mach_frm->Frame( -relief=>'flat', -background=>$main_bg
my $frm2 =
$frm->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'left', -fill=>'x');
my $frm3 =
$frm->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'left', -fill=>'x');
my $button_frm1 =
$mach_frm1->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'bottom', -fill=>'x');
my $button_frm2 =
$mach_frm2->Frame( -relief=>'flat', -background=>$main_bg
) ->pack (-side=>'bottom', -fill=>'x');
#set up the operations
my $op_on = $op_frm->Radiobutton( -variable=> \$op, -text => 'Turn On',
-background=>$main_bg,-value=>'on'
)->pack(-side=>'top',-fill=>'x',
-anchor=>'w');
my $op_off = $op_frm->Radiobutton( -variable=> \$op, -text => 'Turn Off',
-background=>$main_bg,-value=>'off'
)->pack(-side=>'top',-fill=>'x',
-anchor=>'w');
my $op_cyc = $op_frm->Radiobutton( -variable=> \$op, -text => 'Reboot',
-background=>$main_bg,-value=>'cycle'
)->pack(-side=>'top',-fill=>'x',
-anchor=>'w');
#set up the machines
my @mach;
my @machvals
#= (0,0,0,0,0,0,0,0,0,0,0,0)
;
my @machvals;
$mach[1] =
$mach_frm1->Checkbutton(-variable=>\$machvals[1], -text=>"test1",
-background=>$main_bg
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$frm1->Checkbutton(-variable=>\$machvals[1], -text=>"test1",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[2] =
$mach_frm1->Checkbutton(-variable=>\$machvals[2], -text=>"test2",
-background=>$main_bg
$frm1->Checkbutton(-variable=>\$machvals[2], -text=>"test2",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[3] =
$mach_frm1->Checkbutton(-variable=>\$machvals[3], -text=>"test3",
-background=>$main_bg
$frm1->Checkbutton(-variable=>\$machvals[3], -text=>"test3",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[4] =
$mach_frm1->Checkbutton(-variable=>\$machvals[4], -text=>"test4",
-background=>$main_bg
$frm1->Checkbutton(-variable=>\$machvals[4], -text=>"test4",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[5] =
$mach_frm1->Checkbutton(-variable=>\$machvals[5], -text=>"test5",
-background=>$main_bg
$frm1->Checkbutton(-variable=>\$machvals[5], -text=>"test5",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[6] =
$mach_frm1->Checkbutton(-variable=>\$machvals[6], -text=>"test6",
-background=>$main_bg
$frm2->Checkbutton(-variable=>\$machvals[6], -text=>"test6",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[7] =
$mach_frm2->Checkbutton(-variable=>\$machvals[7], -text=>"test7",
-background=>$main_bg
$frm2->Checkbutton(-variable=>\$machvals[7], -text=>"test7",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[8] =
$mach_frm2->Checkbutton(-variable=>\$machvals[8], -text=>"test8",
-background=>$main_bg
$frm2->Checkbutton(-variable=>\$machvals[8], -text=>"test8",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[9] =
$mach_frm2->Checkbutton(-variable=>\$machvals[9], -text=>"test9",
-background=>$main_bg
$frm2->Checkbutton(-variable=>\$machvals[9], -text=>"test9",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[10] =
$mach_frm2->Checkbutton(-variable=>\$machvals[10], -text=>"test10",
-background=>$main_bg
$frm2->Checkbutton(-variable=>\$machvals[10], -text=>"test10",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$mach[11] =
$mach_frm2->Checkbutton(-variable=>\$machvals[11], -text=>"alpha",
-background=>$main_bg
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$frm3->Checkbutton(-variable=>\$machvals[11], -text=>"alpha",
-background=>$main_bg, -width=>'6',-anchor=>'nw'
)->pack(-side=>'top',-fill=>'x');
$mach[12] =
$mach_frm2->Checkbutton(-variable=>\$machvals[12], -text=>"beta",
-background=>$main_bg
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
$frm3->Checkbutton(-variable=>\$machvals[12], -text=>"beta",
-background=>$main_bg, -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x');
$mach[13] =
$frm3->Checkbutton(-variable=>\$machvals[13], -text=>"gamma",
-background=>$main_bg, -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x');
$mach[14] =
$frm3->Checkbutton(-variable=>\$machvals[14], -text=>"delta",
-background=>$main_bg, -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x');
$mach[15] =
$frm3->Checkbutton(-variable=>\$machvals[15], -text=>"",
-background=>$main_bg, -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x');
#set up the operations
my $op_on =
$frm1->
Radiobutton( -variable=> \$op, -text => 'On', -background=>$main_bg,
-value=>'on', -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
my $op_off =
$frm2->
Radiobutton( -variable=> \$op, -text => 'Off',-background=>$main_bg,
-value=>'off', -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
my $op_cyc =
$frm3->
Radiobutton( -variable=> \$op, -text => 'Reboot',-background=>$main_bg,
-value=>'cycle', -width=>'6', -anchor=>'nw'
)->pack(-side=>'top',-fill=>'x', -anchor=>'w');
#set up the buttons
my $go =
$button_frm->Button(-text=>'Go!',-background=>$main_bg,
-relief=>'raised',-command=>
sub {
my $n=0;
@machines=();
while ($n <= $#machvals ) {
if (defined($machvals[$n])&&$machvals[$n]==1) {
push(@machines,"test$n") if ($n <= 10);
push(@machines,"alpha") if ($n==11);
push(@machines,"beta") if ($n==12);
}
$n++;
}
$frm1->Button(-text=>'Go!',-background=>$main_bg,-width=>'6',
-anchor=>'center', -relief=>'raised',-command=>
sub {
my $n=0;
@machines=();
while ($n <= $#machvals ) {
if (defined($machvals[$n])&&$machvals[$n]==1) {
push(@machines,"test$n") if ($n <= 10);
push(@machines,"alpha") if ($n==11);
push(@machines,"beta") if ($n==12);
push(@machines,"gamma") if ($n==13);
push(@machines,"delta") if ($n==14);
}
$n++;
}
if ($#machines<0) {
&message
($msg_area,
......@@ -154,32 +162,23 @@ my $go =
&message ($msg_area,
join ("\n",@output));
}
})
})
->pack(-side=>'left',-anchor=>'s',-fill=>'x',
-padx=>'2',-pady=>'2');
#my $about_btn=
# $button_frm->Button(-text=>'About', -background => $main_bg,
# -relief=>'raised',-command=> sub {
# &message( $msg_area,
# "By Mac Newbold, Flux Research Group,\n",
# "University of Utah Computer Science Dept."); } )
# ->pack(-side=>'left',-anchor=>'s',-fill=>'x',
# -padx=>'2',-pady=>'2');
my $help_btn=
$button_frm->Button(-text=>'Help',-background => $main_bg,
-relief=>'raised',-command=>sub {
$frm2->Button(-text=>'Help',-background => $main_bg,-width=>'6',
-anchor=>'center', -relief=>'raised',-command=>sub {
&message( $msg_area,
"Select a function (on, off, or cycle)\n",
"Then mark all machines to update\n",
"and press the Go! button"); } )
"Select machine(s) to update\n",
"Select on, off, or reboot\n",
"Press the Go! button"); } )
->pack(-side=>'left',-anchor=>'s',-fill=>'x',
-padx=>'2',-pady=>'2');
my $exit_btn=
$button_frm->Button(-text=>'Exit', -background => $main_bg,
-relief=>'raised',-command=>sub{$main->destroy})
$frm3->Button(-text=>'Exit', -background => $main_bg,-width=>'6',
-anchor=>'center', -relief=>'raised',-command=>sub{$main->destroy})
->pack(-side=>'left',-anchor=>'s',-fill=>'x',
-padx=>'2',-pady=>'2');
......@@ -187,7 +186,7 @@ MainLoop();
sub message {
(my $area,my @msg) = @_;
my $text= join('',@msg);
$area->configure(-text=> $text );
my $text= join("",@msg);
$area->configure(-text=> $text, -anchor=>'nw' );
}
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