More work on functions block

This commit is contained in:
2009-10-09 15:50:55 +00:00
parent cb5c211956
commit 832c0fe022
3 changed files with 70 additions and 14 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: Thu Sep 24 20:22:29 2009 # Created: Fri Oct 9 17:49:00 2009
# 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!
@ -41,7 +41,8 @@ use Qt::slots
ShowMuSRT0 => [], ShowMuSRT0 => [],
T0Update => [], T0Update => [],
RunSelectionToggle => [], RunSelectionToggle => [],
fileBrowse => []; fileBrowse => [],
AppendToFunctions => [];
use Qt::attributes qw( use Qt::attributes qw(
musrfit_tabs musrfit_tabs
RUNSPage RUNSPage
@ -1577,7 +1578,7 @@ sub NEW
setName("MuSRFitform" ); setName("MuSRFitform" );
} }
setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) ); setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
setMinimumSize(Qt::Size(23, 270) ); setMinimumSize(Qt::Size(21, 275) );
setIcon($image0 ); setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget")); setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@ -1588,6 +1589,7 @@ sub NEW
musrfit_tabs->setSizePolicy( Qt::SizePolicy(7, 7, 1, 1, musrfit_tabs->sizePolicy()->hasHeightForWidth()) ); musrfit_tabs->setSizePolicy( Qt::SizePolicy(7, 7, 1, 1, musrfit_tabs->sizePolicy()->hasHeightForWidth()) );
musrfit_tabs->setMinimumSize( Qt::Size(560, 400) ); musrfit_tabs->setMinimumSize( Qt::Size(560, 400) );
musrfit_tabs->setMaximumSize( Qt::Size(95, 32767) ); musrfit_tabs->setMaximumSize( Qt::Size(95, 32767) );
musrfit_tabs->setMouseTracking( 0 );
RUNSPage = Qt::Widget(musrfit_tabs, "RUNSPage"); RUNSPage = Qt::Widget(musrfit_tabs, "RUNSPage");
@ -1658,7 +1660,7 @@ sub NEW
groupBox7->setAlignment( int(&Qt::GroupBox::AlignTop) ); groupBox7->setAlignment( int(&Qt::GroupBox::AlignTop) );
my $LayoutWidget_2 = Qt::Widget(groupBox7, '$LayoutWidget_2'); my $LayoutWidget_2 = Qt::Widget(groupBox7, '$LayoutWidget_2');
$LayoutWidget_2->setGeometry( Qt::Rect(8, 21, 625, 125) ); $LayoutWidget_2->setGeometry( Qt::Rect(8, 21, 520, 125) );
my $layout42 = Qt::GridLayout($LayoutWidget_2, 1, 1, 5, 6, '$layout42'); my $layout42 = Qt::GridLayout($LayoutWidget_2, 1, 1, 5, 6, '$layout42');
FitType2 = Qt::ComboBox(0, $LayoutWidget_2, "FitType2"); FitType2 = Qt::ComboBox(0, $LayoutWidget_2, "FitType2");
@ -2187,7 +2189,7 @@ sub NEW
InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Min")); InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Min"));
InitParamTable->setNumCols(InitParamTable->numCols() + 1); InitParamTable->setNumCols(InitParamTable->numCols() + 1);
InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Max")); InitParamTable->horizontalHeader()->setLabel(InitParamTable->numCols() - 1, trUtf8("Max"));
InitParamTable->setGeometry( Qt::Rect(5, 5, 445, 355) ); InitParamTable->setGeometry( Qt::Rect(5, 5, 545, 355) );
InitParamTable->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, InitParamTable->sizePolicy()->hasHeightForWidth()) ); InitParamTable->setSizePolicy( Qt::SizePolicy(5, 5, 0, 0, InitParamTable->sizePolicy()->hasHeightForWidth()) );
InitParamTable->setMaximumSize( Qt::Size(32767, 32767) ); InitParamTable->setMaximumSize( Qt::Size(32767, 32767) );
InitParamTable->setFocusPolicy( &Qt::Table::TabFocus() ); InitParamTable->setFocusPolicy( &Qt::Table::TabFocus() );
@ -2215,7 +2217,7 @@ sub NEW
groupTitle->setMargin( int(5) ); groupTitle->setMargin( int(5) );
my $LayoutWidget_9 = Qt::Widget(groupTitle, '$LayoutWidget_9'); my $LayoutWidget_9 = Qt::Widget(groupTitle, '$LayoutWidget_9');
$LayoutWidget_9->setGeometry( Qt::Rect(6, 8, 530, 100) ); $LayoutWidget_9->setGeometry( Qt::Rect(6, 8, 515, 100) );
my $layout25_2 = Qt::VBoxLayout($LayoutWidget_9, 11, 6, '$layout25_2'); my $layout25_2 = Qt::VBoxLayout($LayoutWidget_9, 11, 6, '$layout25_2');
TITLELabel = Qt::Label($LayoutWidget_9, "TITLELabel"); TITLELabel = Qt::Label($LayoutWidget_9, "TITLELabel");
@ -2727,7 +2729,7 @@ sub NEW
MenuBar->insertSeparator( 8 ); MenuBar->insertSeparator( 8 );
languageChange(); languageChange();
my $resize = Qt::Size(576, 497); my $resize = Qt::Size(579, 501);
$resize = $resize->expandedTo(minimumSizeHint()); $resize = $resize->expandedTo(minimumSizeHint());
resize( $resize ); resize( $resize );
clearWState( &Qt::WState_Polished ); clearWState( &Qt::WState_Polished );
@ -2754,6 +2756,7 @@ sub NEW
Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()"); Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()");
Qt::Object::connect(T0, SIGNAL "activated()", this, SLOT "ShowMuSRT0()"); Qt::Object::connect(T0, SIGNAL "activated()", this, SLOT "ShowMuSRT0()");
Qt::Object::connect(Plot, SIGNAL "activated()", this, SLOT "GoPlot()"); Qt::Object::connect(Plot, SIGNAL "activated()", this, SLOT "GoPlot()");
Qt::Object::connect(AddConstraint, SIGNAL "clicked()", this, SLOT "AppendToFunctions()");
setTabOrder(musrfit_tabs, RunNumbers); setTabOrder(musrfit_tabs, RunNumbers);
setTabOrder(RunNumbers, BeamLine); setTabOrder(RunNumbers, BeamLine);
@ -3575,7 +3578,7 @@ sub UpdateMSRFileInitTable
textMSROutput->append("$line"); textMSROutput->append("$line");
} }
my $FPBlock_ref=MSR::ExtractParamBlk(@lines); (my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
my @FPBloc = @$FPBlock_ref; my @FPBloc = @$FPBlock_ref;
my $PCount=0; my $PCount=0;
@ -3677,7 +3680,7 @@ sub ActivateShComp
my $Component=1; my $Component=1;
CParamsCombo->clear(); CParamsCombo->clear();
TheoryBlock->setText($Full_T_Block);
foreach my $FitType (@FitTypes) { foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1]; my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters ); my @Params = split( /\s+/, $Parameters );
@ -3706,18 +3709,20 @@ sub ActivateShComp
for (my $i=1; $i<=9;$i++) { for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i; my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx); my $ChkBx = child($ParamChkBx);
my $CParam = $Params[$i-1]." ".$Component; my $CParam = $Params[$i-1]."_".$Component;
if ($Params[$i-1] ne "") { if ($Params[$i-1] ne "" && $Params[$i-1] ne "Alpha" && $Params[$i-1] ne "N0" && $Params[$i-1] ne "NBg") {
$ChkBx->setHidden(0); $ChkBx->setHidden(0);
$ChkBx->setEnabled(1); $ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]); $ChkBx ->setText($Params[$i-1]);
CParamsCombo->insertItem($CParam,-1); CParamsCombo->insertItem($CParam,-1);
$Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
} else { } else {
$ChkBx->setHidden(1); $ChkBx->setHidden(1);
} }
} }
$Component++; $Component++;
} }
TheoryBlock->setText($Full_T_Block);
} }
@ -3924,6 +3929,26 @@ sub fileBrowse
} }
sub AppendToFunctions
{
my $ParName=CParamsCombo->currentItem;
my $Full_T_Block=TheoryBlock->text;
my $Constraint=ConstraintLine->text;
# Then clear the text
ConstraintLine->setText("");
# Check how many constraints (lines) in FUNCTIONS Block
my $i=FunctionsBlock->lines();
my $ConstLine="fun$i = $Constraint\n";
FunctionsBlock->append($ConstLine);
# Replace parameter in theory block with fun$1
$Full_T_Block=~ s/$ParName/fun$i/;
TheoryBlock->setText($Full_T_Block);
}
1; 1;

View File

@ -70,6 +70,9 @@
<height>32767</height> <height>32767</height>
</size> </size>
</property> </property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<widget class="QWidget"> <widget class="QWidget">
<property name="name"> <property name="name">
<cstring>RUNSPage</cstring> <cstring>RUNSPage</cstring>
@ -5019,6 +5022,12 @@
<receiver>MuSRFitform</receiver> <receiver>MuSRFitform</receiver>
<slot>GoPlot()</slot> <slot>GoPlot()</slot>
</connection> </connection>
<connection>
<sender>AddConstraint</sender>
<signal>clicked()</signal>
<receiver>MuSRFitform</receiver>
<slot>AppendToFunctions()</slot>
</connection>
</connections> </connections>
<tabstops> <tabstops>
<tabstop>musrfit_tabs</tabstop> <tabstop>musrfit_tabs</tabstop>
@ -5125,6 +5134,7 @@
<slot>T0Update()</slot> <slot>T0Update()</slot>
<slot>RunSelectionToggle()</slot> <slot>RunSelectionToggle()</slot>
<slot>fileBrowse()</slot> <slot>fileBrowse()</slot>
<slot>AppendToFunctions()</slot>
</slots> </slots>
<layoutdefaults spacing="6" margin="11"/> <layoutdefaults spacing="6" margin="11"/>
</UI> </UI>

View File

@ -567,7 +567,7 @@ void MuSRFitform::ActivateShComp()
my $Component=1; my $Component=1;
CParamsCombo->clear(); CParamsCombo->clear();
TheoryBlock->setText($Full_T_Block);
foreach my $FitType (@FitTypes) { foreach my $FitType (@FitTypes) {
my $Parameters=$Paramcomp[$Component-1]; my $Parameters=$Paramcomp[$Component-1];
my @Params = split( /\s+/, $Parameters ); my @Params = split( /\s+/, $Parameters );
@ -596,18 +596,20 @@ void MuSRFitform::ActivateShComp()
for (my $i=1; $i<=9;$i++) { for (my $i=1; $i<=9;$i++) {
my $ParamChkBx="ShParam_".$Component."_".$i; my $ParamChkBx="ShParam_".$Component."_".$i;
my $ChkBx = child($ParamChkBx); my $ChkBx = child($ParamChkBx);
my $CParam = $Params[$i-1]." ".$Component; my $CParam = $Params[$i-1]."_".$Component;
if ($Params[$i-1] ne "") { if ($Params[$i-1] ne "" && $Params[$i-1] ne "Alpha" && $Params[$i-1] ne "N0" && $Params[$i-1] ne "NBg") {
$ChkBx->setHidden(0); $ChkBx->setHidden(0);
$ChkBx->setEnabled(1); $ChkBx->setEnabled(1);
$ChkBx ->setText($Params[$i-1]); $ChkBx ->setText($Params[$i-1]);
CParamsCombo->insertItem($CParam,-1); CParamsCombo->insertItem($CParam,-1);
$Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
} else { } else {
$ChkBx->setHidden(1); $ChkBx->setHidden(1);
} }
} }
$Component++; $Component++;
} }
TheoryBlock->setText($Full_T_Block);
} }
void MuSRFitform::InitializeTab() void MuSRFitform::InitializeTab()
@ -800,3 +802,22 @@ void MuSRFitform::fileBrowse()
} }
RunFiles->setText($RunFiles); RunFiles->setText($RunFiles);
} }
void MuSRFitform::AppendToFunctions()
{
my $ParName=CParamsCombo->currentItem;
my $Full_T_Block=TheoryBlock->text;
my $Constraint=ConstraintLine->text;
# Then clear the text
ConstraintLine->setText("");
# Check how many constraints (lines) in FUNCTIONS Block
my $i=FunctionsBlock->lines();
my $ConstLine="fun$i = $Constraint\n";
FunctionsBlock->append($ConstLine);
# Replace parameter in theory block with fun$1
$Full_T_Block=~ s/$ParName/fun$i/;
TheoryBlock->setText($Full_T_Block);
}