Year combox automatic filling.

This commit is contained in:
salman 2011-04-26 11:21:21 +00:00
parent 043d185a60
commit 01bbb3cd73
3 changed files with 119 additions and 124 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui' # Form implementation generated from reading ui file 'MuSRFit.ui'
# #
# Created: Tue Dec 14 15:53:57 2010 # Created: Tue Apr 26 12:46:56 2011
# by: The PerlQt User Interface Compiler (puic) # by: The PerlQt User Interface Compiler (puic)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -68,11 +68,11 @@ use Qt::attributes qw(
YEARLabel YEARLabel
BeamLine BeamLine
BeamLineLabel BeamLineLabel
YEAR
RunNumbers RunNumbers
YEAR
RUNSMan RUNSMan
RunFiles
Browse Browse
RunFiles
FittingPage FittingPage
Yi Yi
Minimization Minimization
@ -2047,32 +2047,37 @@ sub NEW
BeamLineLabel->setGeometry( Qt::Rect(127, 55, 99, 26) ); BeamLineLabel->setGeometry( Qt::Rect(127, 55, 99, 26) );
BeamLineLabel->setMinimumSize( Qt::Size(0, 20) ); BeamLineLabel->setMinimumSize( Qt::Size(0, 20) );
YEAR = Qt::ComboBox(0, RUNSAuto, "YEAR");
YEAR->setGeometry( Qt::Rect(420, 55, 100, 26) );
YEAR->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, YEAR->sizePolicy()->hasHeightForWidth()) );
YEAR->setMinimumSize( Qt::Size(0, 20) );
RunNumbers = Qt::LineEdit(RUNSAuto, "RunNumbers"); RunNumbers = Qt::LineEdit(RUNSAuto, "RunNumbers");
RunNumbers->setGeometry( Qt::Rect(15, 25, 505, 26) ); RunNumbers->setGeometry( Qt::Rect(15, 25, 505, 26) );
RunNumbers->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, RunNumbers->sizePolicy()->hasHeightForWidth()) ); RunNumbers->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, RunNumbers->sizePolicy()->hasHeightForWidth()) );
RunNumbers->setMinimumSize( Qt::Size(0, 23) ); RunNumbers->setMinimumSize( Qt::Size(0, 23) );
YEAR = Qt::ComboBox(0, RUNSAuto, "YEAR");
YEAR->setGeometry( Qt::Rect(420, 55, 100, 25) );
YEAR->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, YEAR->sizePolicy()->hasHeightForWidth()) );
YEAR->setMinimumSize( Qt::Size(0, 20) );
YEAR->setEditable( 0 );
YEAR->setSizeLimit( int(16) );
YEAR->setInsertionPolicy( &Qt::ComboBox::AtTop() );
YEAR->setAutoCompletion( 1 );
YEAR->setDuplicatesEnabled( 0 );
$layout43->addWidget(RUNSAuto); $layout43->addWidget(RUNSAuto);
RUNSMan = Qt::GroupBox($LayoutWidget_3, "RUNSMan"); RUNSMan = Qt::GroupBox($LayoutWidget_3, "RUNSMan");
RUNSMan->setEnabled( 1 ); RUNSMan->setEnabled( 1 );
RUNSMan->setMargin( int(5) ); RUNSMan->setMargin( int(5) );
RunFiles = Qt::LineEdit(RUNSMan, "RunFiles");
RunFiles->setEnabled( 1 );
RunFiles->setGeometry( Qt::Rect(15, 25, 505, 26) );
RunFiles->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, RunFiles->sizePolicy()->hasHeightForWidth()) );
RunFiles->setMinimumSize( Qt::Size(0, 23) );
Browse = Qt::PushButton(RUNSMan, "Browse"); Browse = Qt::PushButton(RUNSMan, "Browse");
Browse->setEnabled( 1 ); Browse->setEnabled( 1 );
Browse->setGeometry( Qt::Rect(420, 55, 100, 26) ); Browse->setGeometry( Qt::Rect(420, 55, 100, 26) );
Browse->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, Browse->sizePolicy()->hasHeightForWidth()) ); Browse->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, Browse->sizePolicy()->hasHeightForWidth()) );
Browse->setMinimumSize( Qt::Size(0, 20) ); Browse->setMinimumSize( Qt::Size(0, 20) );
RunFiles = Qt::LineEdit(RUNSMan, "RunFiles");
RunFiles->setEnabled( 1 );
RunFiles->setGeometry( Qt::Rect(15, 25, 505, 26) );
RunFiles->setSizePolicy( Qt::SizePolicy(0, 0, 0, 0, RunFiles->sizePolicy()->hasHeightForWidth()) );
RunFiles->setMinimumSize( Qt::Size(0, 23) );
$layout43->addWidget(RUNSMan); $layout43->addWidget(RUNSMan);
musrfit_tabs->insertTab( RUNSPage, "" ); musrfit_tabs->insertTab( RUNSPage, "" );
@ -3188,22 +3193,14 @@ sub languageChange
BeamLine->insertItem( trUtf8("Dolly") ); BeamLine->insertItem( trUtf8("Dolly") );
BeamLine->insertItem( trUtf8("LTF") ); BeamLine->insertItem( trUtf8("LTF") );
BeamLineLabel->setText( trUtf8("On beam line") ); BeamLineLabel->setText( trUtf8("On beam line") );
YEAR->clear();
YEAR->insertItem( trUtf8("2010") );
YEAR->insertItem( trUtf8("2009") );
YEAR->insertItem( trUtf8("2008") );
YEAR->insertItem( trUtf8("2007") );
YEAR->insertItem( trUtf8("2006") );
YEAR->insertItem( trUtf8("2005") );
YEAR->insertItem( trUtf8("2004") );
Qt::ToolTip::add(RunNumbers, trUtf8("Numbers of RUNs to fit. Multiple runs are comma separated.")); Qt::ToolTip::add(RunNumbers, trUtf8("Numbers of RUNs to fit. Multiple runs are comma separated."));
Qt::WhatsThis::add(RunNumbers, trUtf8("Numbers of RUNs to fit. Multiple runs are comma separated.")); Qt::WhatsThis::add(RunNumbers, trUtf8("Numbers of RUNs to fit. Multiple runs are comma separated."));
RUNSMan->setTitle( trUtf8("RUN Files") ); RUNSMan->setTitle( trUtf8("RUN Files") );
Qt::ToolTip::add(RunFiles, trUtf8("Names of data files to be fit. Multiple data files are comma separated."));
Qt::WhatsThis::add(RunFiles, trUtf8("Names of data files to be fit. Multiple data files are comma separated."));
Browse->setText( trUtf8("Browse") ); Browse->setText( trUtf8("Browse") );
Qt::ToolTip::add(Browse, trUtf8("Browse to select data files for fitting.")); Qt::ToolTip::add(Browse, trUtf8("Browse to select data files for fitting."));
Qt::WhatsThis::add(Browse, trUtf8("Browse to select data files for fitting.")); Qt::WhatsThis::add(Browse, trUtf8("Browse to select data files for fitting."));
Qt::ToolTip::add(RunFiles, trUtf8("Names of data files to be fit. Multiple data files are comma separated."));
Qt::WhatsThis::add(RunFiles, trUtf8("Names of data files to be fit. Multiple data files are comma separated."));
musrfit_tabs->changeTab( RUNSPage, trUtf8("RUNS") ); musrfit_tabs->changeTab( RUNSPage, trUtf8("RUNS") );
Minimization->clear(); Minimization->clear();
Minimization->insertItem( trUtf8("MINIMIZE") ); Minimization->insertItem( trUtf8("MINIMIZE") );
@ -3604,7 +3601,6 @@ sub helpAbout
sub CreateAllInput sub CreateAllInput
{ {
# TODO: Need to automatically generage years list depending on beamline
my %All=(); my %All=();
# From RUNS Tab # From RUNS Tab
@ -3616,6 +3612,14 @@ sub CreateAllInput
$All{"optionsFourier"} = optionsFourier->isOn(); $All{"optionsFourier"} = optionsFourier->isOn();
$All{"optionsT0"} = optionsT0->isOn(); $All{"optionsT0"} = optionsT0->isOn();
$All{"YEAR"} =YEAR->currentText; $All{"YEAR"} =YEAR->currentText;
if ($All{"YEAR"} eq "") {
# If year combobox is empty fill it up from 2004 up to current year
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $current_year = 1900 + $yearOffset;
for (my $i=$current_year;$i>=2004;$i--) {
YEAR->insertItem($i,-1);
}
}
# Time range and BINS # Time range and BINS
$All{"Tis"} = Tis->text; $All{"Tis"} = Tis->text;
$All{"Tfs"} = Tfs->text; $All{"Tfs"} = Tfs->text;
@ -4058,6 +4062,8 @@ sub InitializeTab
# Fill the table with labels and values of parametr # Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) { for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount}); my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
# Now make sure we have no nans
if ($error eq "nan") { $error=0.1;}
# If you use this then reading the parameters from the table is a problem # If you use this then reading the parameters from the table is a problem
# You need to extract the correct parameter name from the row label # You need to extract the correct parameter name from the row label
# InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param"); # InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param");

View File

@ -1798,68 +1798,6 @@
<string>On beam line</string> <string>On beam line</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox">
<item>
<property name="text">
<string>2010</string>
</property>
</item>
<item>
<property name="text">
<string>2009</string>
</property>
</item>
<item>
<property name="text">
<string>2008</string>
</property>
</item>
<item>
<property name="text">
<string>2007</string>
</property>
</item>
<item>
<property name="text">
<string>2006</string>
</property>
</item>
<item>
<property name="text">
<string>2005</string>
</property>
</item>
<item>
<property name="text">
<string>2004</string>
</property>
</item>
<property name="name">
<cstring>YEAR</cstring>
</property>
<property name="geometry">
<rect>
<x>420</x>
<y>55</y>
<width>100</width>
<height>26</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
<widget class="QLineEdit"> <widget class="QLineEdit">
<property name="name"> <property name="name">
<cstring>RunNumbers</cstring> <cstring>RunNumbers</cstring>
@ -1893,6 +1831,48 @@
<string>Numbers of RUNs to fit. Multiple runs are comma separated.</string> <string>Numbers of RUNs to fit. Multiple runs are comma separated.</string>
</property> </property>
</widget> </widget>
<widget class="QComboBox">
<property name="name">
<cstring>YEAR</cstring>
</property>
<property name="geometry">
<rect>
<x>420</x>
<y>55</y>
<width>100</width>
<height>25</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="sizeLimit">
<number>16</number>
</property>
<property name="insertionPolicy">
<enum>AtTop</enum>
</property>
<property name="autoCompletion">
<bool>true</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</widget> </widget>
<widget class="QGroupBox"> <widget class="QGroupBox">
<property name="name"> <property name="name">
@ -1907,42 +1887,6 @@
<property name="title"> <property name="title">
<string>RUN Files</string> <string>RUN Files</string>
</property> </property>
<widget class="QLineEdit">
<property name="name">
<cstring>RunFiles</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>15</x>
<y>25</y>
<width>505</width>
<height>26</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>23</height>
</size>
</property>
<property name="toolTip" stdset="0">
<string>Names of data files to be fit. Multiple data files are comma separated.</string>
</property>
<property name="whatsThis" stdset="0">
<string>Names of data files to be fit. Multiple data files are comma separated.</string>
</property>
</widget>
<widget class="QPushButton"> <widget class="QPushButton">
<property name="name"> <property name="name">
<cstring>Browse</cstring> <cstring>Browse</cstring>
@ -1982,6 +1926,42 @@
<string>Browse to select data files for fitting.</string> <string>Browse to select data files for fitting.</string>
</property> </property>
</widget> </widget>
<widget class="QLineEdit">
<property name="name">
<cstring>RunFiles</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>15</x>
<y>25</y>
<width>505</width>
<height>26</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>23</height>
</size>
</property>
<property name="toolTip" stdset="0">
<string>Names of data files to be fit. Multiple data files are comma separated.</string>
</property>
<property name="whatsThis" stdset="0">
<string>Names of data files to be fit. Multiple data files are comma separated.</string>
</property>
</widget>
</widget> </widget>
</vbox> </vbox>
</widget> </widget>

View File

@ -212,7 +212,6 @@ void MuSRFitMenu::helpAbout()
void MuSRFitform::CreateAllInput() void MuSRFitform::CreateAllInput()
{ {
# TODO: Need to automatically generage years list depending on beamline
my %All=(); my %All=();
# From RUNS Tab # From RUNS Tab
@ -224,6 +223,14 @@ void MuSRFitform::CreateAllInput()
$All{"optionsFourier"} = optionsFourier->isOn(); $All{"optionsFourier"} = optionsFourier->isOn();
$All{"optionsT0"} = optionsT0->isOn(); $All{"optionsT0"} = optionsT0->isOn();
$All{"YEAR"} =YEAR->currentText; $All{"YEAR"} =YEAR->currentText;
if ($All{"YEAR"} eq "") {
# If year combobox is empty fill it up from 2004 up to current year
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
my $current_year = 1900 + $yearOffset;
for (my $i=$current_year;$i>=2004;$i--) {
YEAR->insertItem($i,-1);
}
}
# Time range and BINS # Time range and BINS
$All{"Tis"} = Tis->text; $All{"Tis"} = Tis->text;
$All{"Tfs"} = Tfs->text; $All{"Tfs"} = Tfs->text;
@ -656,6 +663,8 @@ void MuSRFitform::InitializeTab()
# Fill the table with labels and values of parametr # Fill the table with labels and values of parametr
for (my $PCount=0;$PCount<$NParam;$PCount++) { for (my $PCount=0;$PCount<$NParam;$PCount++) {
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount}); my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
# Now make sure we have no nans
if ($error eq "nan") { $error=0.1;}
# If you use this then reading the parameters from the table is a problem # If you use this then reading the parameters from the table is a problem
# You need to extract the correct parameter name from the row label # You need to extract the correct parameter name from the row label
# InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param"); # InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param");