Can create a mac file..

This commit is contained in:
2011-04-07 15:26:15 +00:00
parent 8d8e5a27cc
commit d86fdde7b1
5 changed files with 2013 additions and 121 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'QmuSRSim.ui'
#
# Created: Fri Apr 1 13:15:48 2011
# Created: Thu Apr 7 17:22:13 2011
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@ -32,7 +32,7 @@ use Qt::slots
CreateAllInput => [],
StartCalc => [];
use Qt::attributes qw(
tabWidget3
Tabs
tab
frame5
textLabel2_2_2_2_2_3
@ -40,9 +40,6 @@ use Qt::attributes qw(
SR_B
textLabel2_2_2_2_3
textLabel2
L1
L3
textLabel2_3_2_2
textLabel2_2_2
textLabel2_2_3
BFIELD
@ -55,6 +52,12 @@ use Qt::attributes qw(
textLabel2_2_2_2
RA_R
TL
textLabel2_3_2_2
textLabel2_3_2_2_2
ENERGY
textLabel2_3_2_2_2_2
L1
L3
tab_2
frame5_2
textLabel2_3_2_3_2
@ -70,9 +73,12 @@ use Qt::attributes qw(
textLabel2_2_2_2_2_2_3
textLabel2_2_2_2_4
RA_R_2
L3_2
L1_2
textLabel2_3_2_2_2_3
ENERGY_2
textLabel2_3_2_2_2_2_2
L2_2
L3_2
Start
MenuBar
fileMenu
@ -17854,10 +17860,10 @@ sub NEW
$LayoutWidget->setGeometry( Qt::Rect(0, 10, 830, 350) );
my $layout7 = Qt::VBoxLayout($LayoutWidget, 11, 6, '$layout7');
tabWidget3 = Qt::TabWidget($LayoutWidget, "tabWidget3");
tabWidget3->setBackgroundOrigin( &Qt::TabWidget::WidgetOrigin() );
Tabs = Qt::TabWidget($LayoutWidget, "Tabs");
Tabs->setBackgroundOrigin( &Qt::TabWidget::WidgetOrigin() );
tab = Qt::Widget(tabWidget3, "tab");
tab = Qt::Widget(Tabs, "tab");
frame5 = Qt::Frame(tab, "frame5");
frame5->setGeometry( Qt::Rect(0, 0, 811, 271) );
@ -17897,18 +17903,6 @@ sub NEW
textLabel2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
L1 = Qt::LineEdit(frame5, "L1");
L1->setGeometry( Qt::Rect(69, 100, 55, 24) );
L3 = Qt::LineEdit(frame5, "L3");
L3->setGeometry( Qt::Rect(350, 230, 55, 24) );
textLabel2_3_2_2 = Qt::Label(frame5, "textLabel2_3_2_2");
textLabel2_3_2_2->setGeometry( Qt::Rect(313, 230, 31, 24) );
textLabel2_3_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
textLabel2_2_2 = Qt::Label(frame5, "textLabel2_2_2");
textLabel2_2_2->setGeometry( Qt::Rect(453, 230, 31, 24) );
textLabel2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
@ -17970,9 +17964,41 @@ sub NEW
TL = Qt::LineEdit(frame5, "TL");
TL->setGeometry( Qt::Rect(490, 230, 55, 24) );
tabWidget3->insertTab( tab, "" );
tab_2 = Qt::Widget(tabWidget3, "tab_2");
textLabel2_3_2_2 = Qt::Label(frame5, "textLabel2_3_2_2");
textLabel2_3_2_2->setGeometry( Qt::Rect(313, 230, 31, 24) );
textLabel2_3_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
my $LayoutWidget_4 = Qt::Widget(frame5, '$LayoutWidget_4');
$LayoutWidget_4->setGeometry( Qt::Rect(210, 20, 180, 26) );
my $layout10 = Qt::HBoxLayout($LayoutWidget_4, 0, 0, '$layout10');
textLabel2_3_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_3_2_2_2");
textLabel2_3_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout10->addWidget(textLabel2_3_2_2_2);
ENERGY = Qt::LineEdit($LayoutWidget_4, "ENERGY");
ENERGY->setBackgroundOrigin( &Qt::LineEdit::ParentOrigin() );
$layout10->addWidget(ENERGY);
textLabel2_3_2_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_3_2_2_2_2");
textLabel2_3_2_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout10->addWidget(textLabel2_3_2_2_2_2);
L1 = Qt::LineEdit(frame5, "L1");
L1->setGeometry( Qt::Rect(69, 100, 55, 24) );
L3 = Qt::LineEdit(frame5, "L3");
L3->setGeometry( Qt::Rect(350, 230, 55, 24) );
Tabs->insertTab( tab, "" );
tab_2 = Qt::Widget(Tabs, "tab_2");
frame5_2 = Qt::Frame(tab_2, "frame5_2");
frame5_2->setGeometry( Qt::Rect(0, 0, 811, 271) );
@ -18007,26 +18033,26 @@ sub NEW
BFIELD_2 = Qt::LineEdit(frame5_2, "BFIELD_2");
BFIELD_2->setGeometry( Qt::Rect(680, 230, 55, 24) );
my $LayoutWidget_4 = Qt::Widget(frame5_2, '$LayoutWidget_4');
$LayoutWidget_4->setGeometry( Qt::Rect(630, 30, 100, 98) );
my $layout3_3 = Qt::GridLayout($LayoutWidget_4, 1, 1, 0, 0, '$layout3_3');
my $LayoutWidget_5 = Qt::Widget(frame5_2, '$LayoutWidget_5');
$LayoutWidget_5->setGeometry( Qt::Rect(630, 30, 100, 98) );
my $layout3_3 = Qt::GridLayout($LayoutWidget_5, 1, 1, 0, 0, '$layout3_3');
textLabel2_2_2_2_2_4 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_4");
textLabel2_2_2_2_2_4 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_4");
textLabel2_2_2_2_2_4->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_4->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_4, 1, 0);
RA_B_2 = Qt::LineEdit($LayoutWidget_4, "RA_B_2");
RA_B_2 = Qt::LineEdit($LayoutWidget_5, "RA_B_2");
$layout3_3->addWidget(RA_B_2, 1, 1);
RA_T_2 = Qt::LineEdit($LayoutWidget_4, "RA_T_2");
RA_T_2 = Qt::LineEdit($LayoutWidget_5, "RA_T_2");
RA_T_2->setAcceptDrops( 0 );
$layout3_3->addWidget(RA_T_2, 0, 1);
RA_L_2 = Qt::LineEdit($LayoutWidget_4, "RA_L_2");
RA_L_2 = Qt::LineEdit($LayoutWidget_5, "RA_L_2");
my $pal = Qt::Palette();
my $cg = Qt::ColorGroup();
$cg->setColor(&Qt::ColorGroup::Foreground, &black);
@ -18084,38 +18110,58 @@ sub NEW
$layout3_3->addWidget(RA_L_2, 3, 1);
textLabel2_2_2_2_2_2_2_2 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_2_2_2");
textLabel2_2_2_2_2_2_2_2 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_2_2_2");
textLabel2_2_2_2_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_2_2_2, 3, 0);
textLabel2_2_2_2_2_2_3 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_2_2_3");
textLabel2_2_2_2_2_2_3 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_2_2_3");
textLabel2_2_2_2_2_2_3->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_2_2_3->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_2_2_3, 2, 0);
textLabel2_2_2_2_4 = Qt::Label($LayoutWidget_4, "textLabel2_2_2_2_4");
textLabel2_2_2_2_4 = Qt::Label($LayoutWidget_5, "textLabel2_2_2_2_4");
textLabel2_2_2_2_4->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_2_2_2_4->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout3_3->addWidget(textLabel2_2_2_2_4, 0, 0);
RA_R_2 = Qt::LineEdit($LayoutWidget_4, "RA_R_2");
RA_R_2 = Qt::LineEdit($LayoutWidget_5, "RA_R_2");
$layout3_3->addWidget(RA_R_2, 2, 1);
L3_2 = Qt::LineEdit(frame5_2, "L3_2");
L3_2->setGeometry( Qt::Rect(460, 230, 55, 24) );
L1_2 = Qt::LineEdit(frame5_2, "L1_2");
L1_2->setGeometry( Qt::Rect(69, 100, 55, 24) );
my $LayoutWidget_6 = Qt::Widget(frame5_2, '$LayoutWidget_6');
$LayoutWidget_6->setGeometry( Qt::Rect(210, 20, 180, 26) );
my $layout10_2 = Qt::HBoxLayout($LayoutWidget_6, 0, 0, '$layout10_2');
textLabel2_3_2_2_2_3 = Qt::Label($LayoutWidget_6, "textLabel2_3_2_2_2_3");
textLabel2_3_2_2_2_3->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2_2_3->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2_2_3->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout10_2->addWidget(textLabel2_3_2_2_2_3);
ENERGY_2 = Qt::LineEdit($LayoutWidget_6, "ENERGY_2");
ENERGY_2->setBackgroundOrigin( &Qt::LineEdit::ParentOrigin() );
$layout10_2->addWidget(ENERGY_2);
textLabel2_3_2_2_2_2_2 = Qt::Label($LayoutWidget_6, "textLabel2_3_2_2_2_2_2");
textLabel2_3_2_2_2_2_2->setBackgroundMode( &Qt::Label::PaletteBackground() );
textLabel2_3_2_2_2_2_2->setPaletteForegroundColor( Qt::Color(0, 0, 0) );
textLabel2_3_2_2_2_2_2->setPaletteBackgroundColor( Qt::Color(255, 255, 255) );
$layout10_2->addWidget(textLabel2_3_2_2_2_2_2);
L2_2 = Qt::LineEdit(frame5_2, "L2_2");
L2_2->setGeometry( Qt::Rect(190, 230, 55, 24) );
tabWidget3->insertTab( tab_2, "" );
$layout7->addWidget(tabWidget3);
L3_2 = Qt::LineEdit(frame5_2, "L3_2");
L3_2->setGeometry( Qt::Rect(460, 230, 55, 24) );
Tabs->insertTab( tab_2, "" );
$layout7->addWidget(Tabs);
my $layout6 = Qt::HBoxLayout(undef, 0, 6, '$layout6');
@ -18210,7 +18256,7 @@ sub NEW
Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()");
Qt::Object::connect(Start, SIGNAL "clicked()", this, SLOT "StartCalc()");
setTabOrder(tabWidget3, L1);
setTabOrder(Tabs, L1);
setTabOrder(L1, SR_B);
setTabOrder(SR_B, SR_E);
setTabOrder(SR_E, L3);
@ -18241,14 +18287,17 @@ sub languageChange
textLabel2_2_2_2_2_3->setText( trUtf8("<b><font size=\"+1\">SR_E</font></b>") );
textLabel2_2_2_2_3->setText( trUtf8("<b><font size=\"+1\">SR_B</font></b>") );
textLabel2->setText( trUtf8("<b><font size=\"+1\">L1</font></b>") );
textLabel2_3_2_2->setText( trUtf8("<b><font size=\"+1\">L3</font></b>") );
textLabel2_2_2->setText( trUtf8("<b><font size=\"+1\">TL</font></b>") );
textLabel2_2_3->setText( trUtf8("<b><font size=\"+1\">B Field</font></b>") );
textLabel2_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">RA_B</font></b>") );
textLabel2_2_2_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">RA_L</font></b>") );
textLabel2_2_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">RA_R</font></b>") );
textLabel2_2_2_2->setText( trUtf8("<b><font size=\"+1\">RA_T</font></b>") );
tabWidget3->changeTab( tab, trUtf8("Spin Rotator") );
textLabel2_3_2_2->setText( trUtf8("<b><font size=\"+1\">L3</font></b>") );
textLabel2_3_2_2_2->setText( trUtf8("<b><font size=\"+1\">Energy</font></b>") );
textLabel2_3_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">keV</font></b>") );
L3->setText( undef );
Tabs->changeTab( tab, trUtf8("Spin Rotator") );
textLabel2_3_2_3_2->setText( trUtf8("<b><font size=\"+1\">L1</font></b>") );
textLabel2_3_2_3->setText( trUtf8("<b><font size=\"+1\">L2</font></b>") );
textLabel2_3_2->setText( trUtf8("<b><font size=\"+1\">L3</font></b>") );
@ -18257,7 +18306,9 @@ sub languageChange
textLabel2_2_2_2_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">RA_L</font></b>") );
textLabel2_2_2_2_2_2_3->setText( trUtf8("<b><font size=\"+1\">RA_R</font></b>") );
textLabel2_2_2_2_4->setText( trUtf8("<b><font size=\"+1\">RA_T</font></b>") );
tabWidget3->changeTab( tab_2, trUtf8("Current") );
textLabel2_3_2_2_2_3->setText( trUtf8("<b><font size=\"+1\">Energy</font></b>") );
textLabel2_3_2_2_2_2_2->setText( trUtf8("<b><font size=\"+1\">keV</font></b>") );
Tabs->changeTab( tab_2, trUtf8("Current") );
Start->setText( trUtf8("Start") );
fileNewAction->setText( trUtf8("New") );
fileNewAction->setMenuText( trUtf8("&New") );
@ -18412,13 +18463,16 @@ sub CreateAllInput
{
my %All=();
my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E",
"L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2");
my @AllParams= ("L1","L3","TL","BFIELD","RA_T","RA_B","RA_R","RA_L","SR_B","SR_E","ENERGY",
"L1_2","L2_2","L3_2","BFIELD_2","RA_T_2","RA_B_2","RA_R_2","RA_L_2","ENERGY_2");
foreach my $Param (@AllParams) {
my $Child = child($Param);
my $Value = $Child->text;
$All{$Param}=$Value;
# print "$Param=".$All{$Param}."\n";
}
# Return Hash with all important values
return %All;
}
@ -18426,6 +18480,57 @@ sub StartCalc
{
my %All=CreateAllInput();
my $Page = Tabs->currentPageIndex;
my %ToReplace=();
my @SpaceHolder=();
my $FName="SRBeamLine.mac";
# 0 for spin rotator and 1 for current.
if ($Page == 0) {
%ToReplace= (
"L1"=>"L1VOLTAGE",
"L3"=>"L3VOLTAGE",
"TL"=>"TLVOLTAGE",
"BFIELD"=>"SAM_BFIELD",
"RA_T"=>"RA_TVOL",
"RA_B"=>"RA_BVOL",
"RA_R"=>"RA_RVOL",
"RA_L"=>"RA_LVOL",
"SR_B"=>"SR_BFIELD",
"SR_E"=>"SR_EFIELD",
"ENERGY"=>"ENERGY"
);
# Use the following template
$FName="SRBeamLine.mac";
} elsif ($Page == 1) {
%ToReplace= (
"L1_2"=>"L1VOLTAGE",
"L2_2"=>"L2VOLTAGE",
"L3_2"=>"L3VOLTAGE",
"BFIELD_2"=>"SAM_BFIELD",
"RA_T_2"=>"RA_TVOL",
"RA_B_2"=>"RA_BVOL",
"RA_R_2"=>"RA_RVOL",
"RA_L_2"=>"RA_LVOL",
"ENERGY_2"=>"ENERGY"
);
# Use the following template
$FName="CBeamLine.mac";
}
open(MACF,"$FName");
my @lines=<MACF>;
close(MACF);
for my $key (keys %ToReplace) {
# Need to check values of replace parameters...
map(s/$ToReplace{$key}/$All{$key}/, @lines);
print "Replacing \t".$ToReplace{$key}."\t by \t".$All{$key}."\n";
}
open(NEWMACF,">1000.mac");
print (NEWMACF "@lines");
close(NEWMACF);
}