Add possibility to change TRIMBIN and GUIPATH interactively.

This commit is contained in:
salman 2013-02-05 15:20:44 +00:00
parent ba50550a62
commit 438ca3f007
4 changed files with 301 additions and 2 deletions

View File

@ -3,4 +3,4 @@
export TRIMBIN=$HOME/bin/trimsp7l
export PERLLIB=$HOME/LEM/simulation/trimsp/TrimSPGUI4
perl $HOME/LEM/simulation/trimsp/TrimSPGUI4/TrimSPGUI.pl
perl $PERLLIB/TrimSPGUI.pl

View File

@ -19,6 +19,8 @@ use QtCore4::slots
helpContentsAction => [],
CollectValues => [],
CreateInpFile => [],
GUIPath => [],
TrimBin => [],
StartSequenceOne => [],
DirectoryBrowse => [],
ConfirmQuit => [],
@ -488,6 +490,47 @@ sub CreateInpFile()
}
# This subroutine is used to define diffirent variables
sub TrimBin
{
my $file=Qt::FileDialog::getOpenFileName(
this,
"Select the Trim.SP binary file",
$ENV{'TRIMBIN'},
"Trim.SP binary (.* *.* *)");
# If the user gave a valid filename try to read it
if ($file eq "") {
$file=$ENV{'TRIMBIN'};
} else {
$ENV{'TRIMBIN'}=$file;
}
this->{ui}->trimbin->setText($file);
return $file;
}
# This subroutine is used to define diffirent variables
sub GUIPath
{
my $FileBrowser = Qt::FileDialog::getExistingDirectory(
this,
"Chose the directory where the TrimSP GUI is.",
$ENV{'PERLLIB'},
1);
# If nothing is returned keep as is
if ($FileBrowser eq "") {
$FileBrowser=$ENV{'PERLLIB'};
} else {
$ENV{'PERLLIB'}=$FileBrowser;
}
this->{ui}->pathTrimGUI->setText($FileBrowser);
# Return a string with the directory name
return $FileBrowser ;
}
# Subroutine: Start the simulation with the current parameters
sub StartSequenceOne()
{

View File

@ -1750,6 +1750,101 @@
</widget>
</widget>
</widget>
<widget class="QWidget" name="ConfigTab">
<attribute name="title">
<string>Configure</string>
</attribute>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>31</y>
<width>671</width>
<height>101</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Trim.SP binary</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="trimbin"/>
</item>
<item>
<widget class="QPushButton" name="TrimBinBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>140</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Trim.SP GUI path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pathTrimGUI"/>
</item>
<item>
<widget class="QPushButton" name="guiPathBrowse">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
@ -2333,6 +2428,38 @@
</hint>
</hints>
</connection>
<connection>
<sender>TrimBinBrowse</sender>
<signal>clicked()</signal>
<receiver>TrimSPGUI4</receiver>
<slot>TrimBin()</slot>
<hints>
<hint type="sourcelabel">
<x>648</x>
<y>107</y>
</hint>
<hint type="destinationlabel">
<x>721</x>
<y>221</y>
</hint>
</hints>
</connection>
<connection>
<sender>guiPathBrowse</sender>
<signal>clicked()</signal>
<receiver>TrimSPGUI4</receiver>
<slot>GUIPath()</slot>
<hints>
<hint type="sourcelabel">
<x>625</x>
<y>162</y>
</hint>
<hint type="destinationlabel">
<x>722</x>
<y>307</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>DirectoryBrowse()</slot>
@ -2351,6 +2478,8 @@
<slot>SaveFile()</slot>
<slot>SaveFileAs()</slot>
<slot>test()</slot>
<slot>TrimBin()</slot>
<slot>GUIPath()</slot>
</slots>
<buttongroups>
<buttongroup name="listGroup"/>

View File

@ -5,7 +5,7 @@
#################################################################################
## Form generated from reading UI file 'TrimSPGUI4.ui'
##
## Created: Wed Jan 30 17:16:55 2013
## Created: Tue Feb 5 15:16:21 2013
## by: Qt User Interface Compiler version 4.8.4
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
@ -562,6 +562,50 @@ sub scanStep {
return shift->{scanStep};
}
sub configTab {
return shift->{configTab};
}
sub widget1 {
return shift->{widget1};
}
sub verticalLayout_2 {
return shift->{verticalLayout_2};
}
sub horizontalLayout {
return shift->{horizontalLayout};
}
sub label_2 {
return shift->{label_2};
}
sub trimbin {
return shift->{trimbin};
}
sub trimBinBrowse {
return shift->{trimBinBrowse};
}
sub horizontalLayout_2 {
return shift->{horizontalLayout_2};
}
sub label_3 {
return shift->{label_3};
}
sub pathTrimGUI {
return shift->{pathTrimGUI};
}
sub guiPathBrowse {
return shift->{guiPathBrowse};
}
sub menuBar {
return shift->{menuBar};
}
@ -1405,6 +1449,82 @@ sub setupUi {
$verticalLayout->addLayout( $scanLoop );
$tabs->addTab( $scansTab, Qt::Application::translate( 'TrimSPGUI4', "Scans (Disbaled)", undef, Qt::Application::UnicodeUTF8() ) );
my $configTab = Qt::Widget( );
$self->{configTab} = $configTab;
$configTab->setObjectName( "configTab" );
my $widget1 = Qt::Widget( $configTab );
$self->{widget1} = $widget1;
$widget1->setObjectName( "widget1" );
$widget1->setGeometry( Qt::Rect(10, 31, 671, 101) );
my $verticalLayout_2 = Qt::VBoxLayout( $widget1 );
$self->{verticalLayout_2} = $verticalLayout_2;
$verticalLayout_2->setSpacing( 6 );
$verticalLayout_2->setMargin( 11 );
$verticalLayout_2->setObjectName( "verticalLayout_2" );
$verticalLayout_2->setContentsMargins(0, 0, 0, 0 );
my $horizontalLayout = Qt::HBoxLayout( );
$self->{horizontalLayout} = $horizontalLayout;
$horizontalLayout->setSpacing( 6 );
$horizontalLayout->setObjectName( "horizontalLayout" );
my $label_2 = Qt::Label( $widget1 );
$self->{label_2} = $label_2;
$label_2->setObjectName( "label_2" );
my $sizePolicy9 = Qt::SizePolicy( Qt::SizePolicy::Fixed(), Qt::SizePolicy::Preferred() );
$self->{$sizePolicy9} = $sizePolicy9;
$sizePolicy9->setHorizontalStretch( 0 );
$sizePolicy9->setVerticalStretch( 0 );
$sizePolicy9->setHeightForWidth( $label_2->sizePolicy()->hasHeightForWidth() );
$label_2->setSizePolicy( $sizePolicy9 );
$label_2->setMinimumSize( Qt::Size(110, 0) );
$label_2->setMaximumSize( Qt::Size(140, 16777215) );
$horizontalLayout->addWidget( $label_2 );
my $trimbin = Qt::LineEdit( $widget1 );
$self->{trimbin} = $trimbin;
$trimbin->setObjectName( "trimbin" );
$horizontalLayout->addWidget( $trimbin );
my $trimBinBrowse = Qt::PushButton( $widget1 );
$self->{trimBinBrowse} = $trimBinBrowse;
$trimBinBrowse->setObjectName( "trimBinBrowse" );
$horizontalLayout->addWidget( $trimBinBrowse );
$verticalLayout_2->addLayout( $horizontalLayout );
my $horizontalLayout_2 = Qt::HBoxLayout( );
$self->{horizontalLayout_2} = $horizontalLayout_2;
$horizontalLayout_2->setSpacing( 6 );
$horizontalLayout_2->setObjectName( "horizontalLayout_2" );
my $label_3 = Qt::Label( $widget1 );
$self->{label_3} = $label_3;
$label_3->setObjectName( "label_3" );
$sizePolicy9->setHeightForWidth( $label_3->sizePolicy()->hasHeightForWidth() );
$label_3->setSizePolicy( $sizePolicy9 );
$label_3->setMinimumSize( Qt::Size(110, 0) );
$label_3->setMaximumSize( Qt::Size(140, 16777215) );
$horizontalLayout_2->addWidget( $label_3 );
my $pathTrimGUI = Qt::LineEdit( $widget1 );
$self->{pathTrimGUI} = $pathTrimGUI;
$pathTrimGUI->setObjectName( "pathTrimGUI" );
$horizontalLayout_2->addWidget( $pathTrimGUI );
my $guiPathBrowse = Qt::PushButton( $widget1 );
$self->{guiPathBrowse} = $guiPathBrowse;
$guiPathBrowse->setObjectName( "guiPathBrowse" );
$horizontalLayout_2->addWidget( $guiPathBrowse );
$verticalLayout_2->addLayout( $horizontalLayout_2 );
$tabs->addTab( $configTab, Qt::Application::translate( 'TrimSPGUI4', "Configure", undef, Qt::Application::UnicodeUTF8() ) );
$gridLayout->addWidget( $tabs, 0, 0, 1, 1 );
@ -1520,6 +1640,8 @@ sub setupUi {
Qt::Object::connect($radioLoop, SIGNAL 'toggled(bool)' , $trimSPGUI4, SLOT 'ToggleScanSingle()' );
Qt::Object::connect($scandL, SIGNAL 'valueChanged(int)' , $trimSPGUI4, SLOT 'ToggleScanSingle()' );
Qt::Object::connect($projComboBox, SIGNAL 'currentIndexChanged(int)' , $trimSPGUI4, SLOT 'ProjSmartDefaults()' );
Qt::Object::connect($trimBinBrowse, SIGNAL 'clicked()' , $trimSPGUI4, SLOT 'TrimBin()' );
Qt::Object::connect($guiPathBrowse, SIGNAL 'clicked()' , $trimSPGUI4, SLOT 'GUIPath()' );
$tabs->setCurrentIndex( 0 );
@ -1659,6 +1781,11 @@ sub retranslateUi {
$self->{textLabel2_2_2_2}->setText( Qt::Application::translate( 'TrimSPGUI4', "Step", undef, Qt::Application::UnicodeUTF8() ) );
$self->{scanStep}->setText( Qt::Application::translate( 'TrimSPGUI4', "1000", undef, Qt::Application::UnicodeUTF8() ) );
$self->{tabs}->setTabText( $self->{tabs}->indexOf( $self->{scansTab}), Qt::Application::translate( 'TrimSPGUI4', "Scans (Disbaled)", undef, Qt::Application::UnicodeUTF8() ) );
$self->{label_2}->setText( Qt::Application::translate( 'TrimSPGUI4', "Trim.SP binary", undef, Qt::Application::UnicodeUTF8() ) );
$self->{trimBinBrowse}->setText( Qt::Application::translate( 'TrimSPGUI4', "Browse", undef, Qt::Application::UnicodeUTF8() ) );
$self->{label_3}->setText( Qt::Application::translate( 'TrimSPGUI4', "Trim.SP GUI path", undef, Qt::Application::UnicodeUTF8() ) );
$self->{guiPathBrowse}->setText( Qt::Application::translate( 'TrimSPGUI4', "Browse", undef, Qt::Application::UnicodeUTF8() ) );
$self->{tabs}->setTabText( $self->{tabs}->indexOf( $self->{configTab}), Qt::Application::translate( 'TrimSPGUI4', "Configure", undef, Qt::Application::UnicodeUTF8() ) );
$self->{file}->setTitle( Qt::Application::translate( 'TrimSPGUI4', "&File", undef, Qt::Application::UnicodeUTF8() ) );
$self->{plot}->setTitle( Qt::Application::translate( 'TrimSPGUI4', "&Plot", undef, Qt::Application::UnicodeUTF8() ) );
$self->{helpMenu}->setTitle( Qt::Application::translate( 'TrimSPGUI4', "&Help", undef, Qt::Application::UnicodeUTF8() ) );