Finished implementing basic export capability.

This commit is contained in:
salman 2009-09-14 11:39:12 +00:00
parent 4b9ae9fe4d
commit d1e7cc82ba
4 changed files with 46 additions and 30 deletions

View File

@ -1241,6 +1241,7 @@ sub ExportParams {
my $Shared = 0;
my $TABLE="";
my $HEADER="RUN";
my %All = %{$_[0]};
my @RUNS = ();
@ -1300,6 +1301,10 @@ sub ExportParams {
if ( $#FitTypes != 0 && ( $Param ne "Alpha" ) ){
$Param = join( "", $Param, "_", "$Component" );
}
# $All{"Header"} - 0/1 for with/without header
if ($All{"Header"} && $iRun == 1) {
$HEADER=join("\t",$HEADER,$Param,"$erradd$Param");
}
$Shared = $All{"Sh_$Param"};
if ( $Shared!=1 || $iRun == 1 ) {
@ -1312,6 +1317,13 @@ sub ExportParams {
$line=join("\t",$line,$value,$error);
$PCount++;
}
elsif ($Shared==1) {
# The parameter is shared, take the value from the first run
$Param=$Param."_1";
$value = $All{"$Param"};
$error = $All{"$erradd$Param"};
$line=join("\t",$line,$value,$error);
}
$NP++;
}
$Component++;
@ -1361,6 +1373,10 @@ sub ExportParams {
}
$TABLE=$TABLE."$line\n"
}
if ($All{"Header"}) {
$TABLE=$HEADER."\n".$TABLE;
}
return $TABLE;
}

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'MuSRFit.ui'
#
# Created: Sun Sep 13 23:02:53 2009
# Created: Mon Sep 14 13:29:17 2009
# by: The PerlQt User Interface Compiler (puic)
#
# WARNING! All changes made in this file will be lost!
@ -585,7 +585,7 @@ sub NEW
setName("MuSRFitform" );
}
setSizePolicy(Qt::SizePolicy(3, 3, 1, 1, this->sizePolicy()->hasHeightForWidth()) );
setMinimumSize(Qt::Size(23, 246) );
setMinimumSize(Qt::Size(21, 251) );
setIcon($image0 );
setCentralWidget(Qt::Widget(this, "qt_central_widget"));
@ -2198,6 +2198,8 @@ sub parametersExport
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=1;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
@ -2209,7 +2211,9 @@ sub parametersExport
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
print $Text;
open( DATF,q{>},"$file" );
print DATF $Text;
close(DATF);
}
}
@ -2217,9 +2221,11 @@ sub parametersExport
sub parametersAppend
{
my %All=CreateAllInput();
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=0;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getOpneFileName(
my $file=Qt::FileDialog::getOpenFileName(
"./",
"Data Files (*.dat)",
this,
@ -2228,17 +2234,11 @@ sub parametersAppend
# If the user gave a filename the copy to it
if ($file ne "") {
if (-e $FILENAME) {
my $Text = MSR::ExportParams(\%All);
print $Text;
} else {
if ($file ne "") {
my $Warning = "Warning: No data file found yet!";
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>>},"$file" );
print DATF $Text;
close(DATF);
}
MSR::ExportParams(\%All);
}

View File

@ -22,8 +22,8 @@
</property>
<property name="minimumSize">
<size>
<width>23</width>
<height>246</height>
<width>21</width>
<height>251</height>
</size>
</property>
<property name="caption">

View File

@ -96,6 +96,8 @@ void Form1::fileExit()
void Form1::parametersExport()
{
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=1;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getSaveFileName(
"$FILENAME",
@ -107,16 +109,20 @@ void Form1::parametersExport()
# If the user gave a filename the copy to it
if ($file ne "") {
my $Text = MSR::ExportParams(\%All);
print $Text;
open( DATF,q{>},"$file" );
print DATF $Text;
close(DATF);
}
}
void Form1::parametersAppend()
{
my %All=CreateAllInput();
my %All=CreateAllInput();
# Add also a flag for header
$All{"Header"}=0;
my $FILENAME=$All{"FILENAME"}.".dat";
my $file=Qt::FileDialog::getOpneFileName(
my $file=Qt::FileDialog::getOpenFileName(
"./",
"Data Files (*.dat)",
this,
@ -125,17 +131,11 @@ void Form1::parametersAppend()
# If the user gave a filename the copy to it
if ($file ne "") {
if (-e $FILENAME) {
my $Text = MSR::ExportParams(\%All);
print $Text;
} else {
if ($file ne "") {
my $Warning = "Warning: No data file found yet!";
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
}
}
my $Text = MSR::ExportParams(\%All);
open( DATF,q{>>},"$file" );
print DATF $Text;
close(DATF);
}
MSR::ExportParams(\%All);
}