Skip to content

Executioner

Saif Ahmed edited this page Mar 9, 2018 · 8 revisions

This is a program that Executes other programs, a launcher in other words. I use this to test standard applications as each new version of GUIDeFATE is being worked on, but one could adapt it for any other purpose. It itself is a test utility containing buttons, combo-boxes and a text-entry widget. In this particular iteration the test applications are expected to also accept parameters to select the backend, and also the type of assistance required.

#!/usr/bin/env perl 
#A test script that calls the test files in scripts folder
#uses GUIDeFATE (which in turn depends on Wx or Tk)

use lib '../lib/';
use strict;
use warnings;
use GUIDeFATE;

my $window=<<END;
+--------------------------------------+
|T Executioner                         |
+M-------------------------------------+
|  ^bends ^     Options       ^optns^  |
|  {Calculator                      }  |
|  {Rock Paper Scissors Lizard Spock}  |
|  {GUI Gnuplotter                  }  |
|  { Text editor                    }  |
|  { Executioner (this)             }  |
|  [                    ]{Execute   }  |
+--------------------------------------+


bends=Wx,Tk,Gtk,Qt,Win32
optns=Quiet,Verbose,Assist

END


my $backend=$ARGV[0]?$ARGV[0]:"wx";
my $assist=$ARGV[1]?$ARGV[1]:"q";
my $gui=GUIDeFATE->new($window,$backend,$assist);
my $frame=$gui->getFrame;
$gui->MainLoop;

sub combo0{
	$backend=$frame->getValue("combo0");
}
sub combo1{
	$assist=$frame->getValue("combo1");
}

sub btn3 #called using button with label Calculator                       
  {
  system("(perl -I../lib/ calculator.pl $backend $assist &)");
   };
sub btn4 #called using button with label Rock Paper Scissors Lizard Spock 
  {
  system("(perl -I../lib/ rpsls.pl $backend $assist &)");
  };

sub btn5 #called using button with label GUI Gnuplotter                   
  {
  system("(perl -I../lib/ GUIgnuplot.pl $backend $assist &)");
   };

sub btn6 #called using button with label  Text editor                     
  {
  system("(perl -I../lib/ texteditor.pl $backend $assist &)");
   };
sub btn7 #called using button with label Executioner                       
  {
  system("(perl -I../lib/ Executioner.pl $backend $assist &)");
   };

sub textctrl9
   {
	system("(perl -I../lib/ ". $frame->getValue("textctrl9") . " $backend $assist &)");
   };
sub btn8 #called using button with label Executioner                       
  {
  system("(perl -I../lib/ ". $frame->getValue("textctrl9") . " $backend $assist &)");
   };

Clone this wiki locally