Remove debugging info.

This commit is contained in:
salman 2013-04-08 09:04:16 +00:00
parent 4903617863
commit 117e23404d
3 changed files with 79 additions and 81 deletions

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'TrimSPGUI.ui' # Form implementation generated from reading ui file 'TrimSPGUI.ui'
# #
# Created: Thu Apr 4 13:53:16 2013 # Created: Mon Apr 8 11:03:16 2013
# 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!
@ -67,7 +67,7 @@ use Qt::attributes qw(
groupBox1 groupBox1
textLabel1_4 textLabel1_4
NL NL
LayerTable layerTable
AddParTab AddParTab
AddParam AddParam
textLabelEF textLabelEF
@ -1439,25 +1439,25 @@ sub NEW
$layout19->addItem($spacer); $layout19->addItem($spacer);
$layout66->addLayout($layout19); $layout66->addLayout($layout19);
LayerTable = Qt::Table($LayoutWidget_4, "LayerTable"); layerTable = Qt::Table($LayoutWidget_4, "layerTable");
LayerTable->setNumCols(LayerTable->numCols() + 1); layerTable->setNumCols(layerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Composition")); layerTable->horizontalHeader()->setLabel(layerTable->numCols() - 1, trUtf8("Composition"));
LayerTable->setNumCols(LayerTable->numCols() + 1); layerTable->setNumCols(layerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Density [g/cm^3]")); layerTable->horizontalHeader()->setLabel(layerTable->numCols() - 1, trUtf8("Density [g/cm^3]"));
LayerTable->setNumCols(LayerTable->numCols() + 1); layerTable->setNumCols(layerTable->numCols() + 1);
LayerTable->horizontalHeader()->setLabel(LayerTable->numCols() - 1, trUtf8("Thickness [Å]")); layerTable->horizontalHeader()->setLabel(layerTable->numCols() - 1, trUtf8("Thickness [Å]"));
LayerTable->setSizePolicy( Qt::SizePolicy(4, 4, 100, 100, LayerTable->sizePolicy()->hasHeightForWidth()) ); layerTable->setSizePolicy( Qt::SizePolicy(4, 4, 100, 100, layerTable->sizePolicy()->hasHeightForWidth()) );
LayerTable->setMinimumSize( Qt::Size(410, 405) ); layerTable->setMinimumSize( Qt::Size(410, 405) );
LayerTable->setAcceptDrops( 1 ); layerTable->setAcceptDrops( 1 );
LayerTable->setResizePolicy( &Qt::Table::AutoOneFit() ); layerTable->setResizePolicy( &Qt::Table::AutoOneFit() );
LayerTable->setDragAutoScroll( 1 ); layerTable->setDragAutoScroll( 1 );
LayerTable->setNumRows( int(1) ); layerTable->setNumRows( int(1) );
LayerTable->setNumCols( int(3) ); layerTable->setNumCols( int(3) );
LayerTable->setRowMovingEnabled( 0 ); layerTable->setRowMovingEnabled( 0 );
LayerTable->setReadOnly( 0 ); layerTable->setReadOnly( 0 );
LayerTable->setSelectionMode( &Qt::Table::NoSelection() ); layerTable->setSelectionMode( &Qt::Table::NoSelection() );
LayerTable->setFocusStyle( &Qt::Table::FollowStyle() ); layerTable->setFocusStyle( &Qt::Table::FollowStyle() );
$layout66->addWidget(LayerTable); $layout66->addWidget(layerTable);
tabs->insertTab( LayersTab, "" ); tabs->insertTab( LayersTab, "" );
AddParTab = Qt::Widget(tabs, "AddParTab"); AddParTab = Qt::Widget(tabs, "AddParTab");
@ -1801,7 +1801,7 @@ sub NEW
Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "OpenHelpWindow()"); Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "OpenHelpWindow()");
Qt::Object::connect(fileQuitAction, SIGNAL "activated()", this, SLOT "ConfirmQuit()"); Qt::Object::connect(fileQuitAction, SIGNAL "activated()", this, SLOT "ConfirmQuit()");
Qt::Object::connect(fileChangeDirAction, SIGNAL "activated()", this, SLOT "DirectoryBrowse()"); Qt::Object::connect(fileChangeDirAction, SIGNAL "activated()", this, SLOT "DirectoryBrowse()");
Qt::Object::connect(LayerTable, SIGNAL "valueChanged(int,int)", this, SLOT "findDensity()"); Qt::Object::connect(layerTable, SIGNAL "valueChanged(int,int)", this, SLOT "findDensity()");
setTabOrder(tabs, NL); setTabOrder(tabs, NL);
setTabOrder(NL, ProjType); setTabOrder(NL, ProjType);
@ -1897,9 +1897,9 @@ sub languageChange
groupBox1->setTitle( trUtf8("Layers") ); groupBox1->setTitle( trUtf8("Layers") );
textLabel1_4->setText( trUtf8("Number of Layers") ); textLabel1_4->setText( trUtf8("Number of Layers") );
Qt::WhatsThis::add(NL, trUtf8("Select the number of the layers of your structure (maximum 7 layers).")); Qt::WhatsThis::add(NL, trUtf8("Select the number of the layers of your structure (maximum 7 layers)."));
LayerTable->horizontalHeader()->setLabel( 0, trUtf8("Composition") ); layerTable->horizontalHeader()->setLabel( 0, trUtf8("Composition") );
LayerTable->horizontalHeader()->setLabel( 1, trUtf8("Density [g/cm^3]") ); layerTable->horizontalHeader()->setLabel( 1, trUtf8("Density [g/cm^3]") );
LayerTable->horizontalHeader()->setLabel( 2, trUtf8("Thickness [Å]") ); layerTable->horizontalHeader()->setLabel( 2, trUtf8("Thickness [Å]") );
tabs->changeTab( LayersTab, trUtf8("Layers") ); tabs->changeTab( LayersTab, trUtf8("Layers") );
AddParam->setTitle( trUtf8("Additional parameters") ); AddParam->setTitle( trUtf8("Additional parameters") );
textLabelEF->setText( trUtf8("EF") ); textLabelEF->setText( trUtf8("EF") );
@ -2051,7 +2051,7 @@ sub ToggleScanSingle
NProj->setDisabled(0); NProj->setDisabled(0);
# NProj->setText("10000"); # NProj->setText("10000");
for (my $i=1;$i<=$All{"NL"};$i++) { for (my $i=1;$i<=$All{"NL"};$i++) {
my $LayerAttrib = LayerTable->item($i-1,2); my $LayerAttrib = layerTable->item($i-1,2);
$LayerAttrib->setEnabled(1); $LayerAttrib->setEnabled(1);
} }
@ -2083,7 +2083,7 @@ sub ToggleScanSingle
Angle->setDisabled(0); Angle->setDisabled(0);
SigAngle->setDisabled(0); SigAngle->setDisabled(0);
NProj->setDisabled(0); NProj->setDisabled(0);
LayerTable->setColumnReadOnly(2,0); layerTable->setColumnReadOnly(2,0);
# then disable one # then disable one
if ($All{"ERadio"}) { if ($All{"ERadio"}) {
E->setDisabled(1); E->setDisabled(1);
@ -2096,7 +2096,7 @@ sub ToggleScanSingle
} elsif ($All{"NProjRadio"}) { } elsif ($All{"NProjRadio"}) {
NProj->setDisabled(1); NProj->setDisabled(1);
} elsif($All{"dRadio"}) { } elsif($All{"dRadio"}) {
my $LayerAttrib = LayerTable->item($All{"ScandL"}-1,2); my $LayerAttrib = layerTable->item($All{"ScandL"}-1,2);
$LayerAttrib->setEnabled(0); $LayerAttrib->setEnabled(0);
} }
# and change title of tab to say enabled # and change title of tab to say enabled
@ -2115,12 +2115,11 @@ sub PrepLayers
$All{"NL"}=NL->text(); $All{"NL"}=NL->text();
# Prepare enough Rows in table for layers # Prepare enough Rows in table for layers
my $OldNL=LayerTable->numRows(); my $OldNL=layerTable->numRows();
if ($OldNL<=$All{"NL"}) { if ($OldNL<=$All{"NL"}) {
LayerTable->setNumRows($All{"NL"}); layerTable->setNumRows($All{"NL"});
} else { } else {
for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) { for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) {
print $i."\n";
removeRowFromTable($i); removeRowFromTable($i);
} }
} }
@ -2138,20 +2137,20 @@ sub removeRowFromTable
my ($deadRow) = @_; my ($deadRow) = @_;
# Loop over columns and take items of the row to remove # Loop over columns and take items of the row to remove
for my $col (0..LayerTable->numCols()-1) { for my $col (0..layerTable->numCols()-1) {
my $dummy=LayerTable->item($deadRow, $col); my $dummy=layerTable->item($deadRow, $col);
# In the items is not defined the row can be removed by simply # In the items is not defined the row can be removed by simply
# reducing the number of rows in table # reducing the number of rows in table
if ($dummy ne "") { if ($dummy ne "") {
LayerTable->takeItem(LayerTable->item($deadRow, $col)); layerTable->takeItem(layerTable->item($deadRow, $col));
for my $row ($deadRow..LayerTable->numRows()-2) { for my $row ($deadRow..layerTable->numRows()-2) {
my $item = LayerTable->item($row+1, $col); my $item = layerTable->item($row+1, $col);
LayerTable->takeItem($item); layerTable->takeItem($item);
LayerTable->setItem($row, $col, $item); layerTable->setItem($row, $col, $item);
} }
} }
} }
LayerTable->setNumRows(LayerTable->numRows()-1); layerTable->setNumRows(layerTable->numRows()-1);
} }
@ -2230,9 +2229,9 @@ sub CollectValues
my $LComp = "L".$i."Comp"; my $LComp = "L".$i."Comp";
my $Lrho="L".$i."rho"; my $Lrho="L".$i."rho";
my $Ld="L".$i."d"; my $Ld="L".$i."d";
$All{"$LComp"}=LayerTable->text($i-1,0); $All{"$LComp"}=layerTable->text($i-1,0);
$All{"$Lrho"}=LayerTable->text($i-1,1); $All{"$Lrho"}=layerTable->text($i-1,1);
$All{"$Ld"}=LayerTable->text($i-1,2); $All{"$Ld"}=layerTable->text($i-1,2);
} }
# Collect projectile parameters # Collect projectile parameters
@ -2383,20 +2382,20 @@ sub CreateInpFile
$Check=0; $Check=0;
# Composition of layers # Composition of layers
my $LComp="L".$i."Comp"; my $LComp="L".$i."Comp";
my $Comp = LayerTable->text($i-1,0); my $Comp = layerTable->text($i-1,0);
$All{$LComp} = $Comp; $All{$LComp} = $Comp;
my %LElComp=Chem::parse_formula($Comp); my %LElComp=Chem::parse_formula($Comp);
if ($Comp eq "") {$Check++;} if ($Comp eq "") {$Check++;}
# Densities of layers # Densities of layers
my $Lrho="L".$i."rho"; my $Lrho="L".$i."rho";
my $rho = LayerTable->text($i-1,1); my $rho = layerTable->text($i-1,1);
$All{$Lrho}=sprintf("%6.2f",$rho); $All{$Lrho}=sprintf("%6.2f",$rho);
if ($rho eq "") {$Check++;} if ($rho eq "") {$Check++;}
# Thickness of layers # Thickness of layers
my $Ld ="L".$i."d"; my $Ld ="L".$i."d";
my $d = LayerTable->text($i-1,2); my $d = layerTable->text($i-1,2);
$All{$Ld}=sprintf("%8.2f",$d); $All{$Ld}=sprintf("%8.2f",$d);
if ($d eq "") {$Check++;} if ($d eq "") {$Check++;}
@ -2756,20 +2755,20 @@ sub OpenFile
my $CRow=$InitPar[0]; my $CRow=$InitPar[0];
if ($InitPar[0] =~ m/L.*Comp$/ ) { if ($InitPar[0] =~ m/L.*Comp$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,0,$InitPar[1]); layerTable->setText($CRow-1,0,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*rho$/ ) { } elsif ($InitPar[0] =~ m/L.*rho$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,1,$InitPar[1]); layerTable->setText($CRow-1,1,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*d$/ ) { } elsif ($InitPar[0] =~ m/L.*d$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,2,$InitPar[1]); layerTable->setText($CRow-1,2,$InitPar[1]);
} else { } else {
$Attrib = child($InitPar[0]); $Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) { if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]); $Attrib->setValue($InitPar[1]);
# Create enough rows in LayerTable # Create enough rows in layerTable
if ($InitPar[0] eq "NL") { if ($InitPar[0] eq "NL") {
LayerTable->setNumRows($InitPar[1]); layerTable->setNumRows($InitPar[1]);
} }
} elsif ($Types{$InitPar[0]} == 2 ) { } elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) { if($InitPar[1] == 1) {

View File

@ -688,7 +688,7 @@
</property> </property>
</column> </column>
<property name="name"> <property name="name">
<cstring>LayerTable</cstring> <cstring>layerTable</cstring>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy> <sizepolicy>
@ -2387,7 +2387,7 @@
<slot>DirectoryBrowse()</slot> <slot>DirectoryBrowse()</slot>
</connection> </connection>
<connection> <connection>
<sender>LayerTable</sender> <sender>layerTable</sender>
<signal>valueChanged(int,int)</signal> <signal>valueChanged(int,int)</signal>
<receiver>TrimSPGUI</receiver> <receiver>TrimSPGUI</receiver>
<slot>findDensity()</slot> <slot>findDensity()</slot>

View File

@ -58,7 +58,7 @@ void TrimSPGUI::ToggleScanSingle()
NProj->setDisabled(0); NProj->setDisabled(0);
# NProj->setText("10000"); # NProj->setText("10000");
for (my $i=1;$i<=$All{"NL"};$i++) { for (my $i=1;$i<=$All{"NL"};$i++) {
my $LayerAttrib = LayerTable->item($i-1,2); my $LayerAttrib = layerTable->item($i-1,2);
$LayerAttrib->setEnabled(1); $LayerAttrib->setEnabled(1);
} }
@ -90,7 +90,7 @@ void TrimSPGUI::ToggleScanSingle()
Angle->setDisabled(0); Angle->setDisabled(0);
SigAngle->setDisabled(0); SigAngle->setDisabled(0);
NProj->setDisabled(0); NProj->setDisabled(0);
LayerTable->setColumnReadOnly(2,0); layerTable->setColumnReadOnly(2,0);
# then disable one # then disable one
if ($All{"ERadio"}) { if ($All{"ERadio"}) {
E->setDisabled(1); E->setDisabled(1);
@ -103,7 +103,7 @@ void TrimSPGUI::ToggleScanSingle()
} elsif ($All{"NProjRadio"}) { } elsif ($All{"NProjRadio"}) {
NProj->setDisabled(1); NProj->setDisabled(1);
} elsif($All{"dRadio"}) { } elsif($All{"dRadio"}) {
my $LayerAttrib = LayerTable->item($All{"ScandL"}-1,2); my $LayerAttrib = layerTable->item($All{"ScandL"}-1,2);
$LayerAttrib->setEnabled(0); $LayerAttrib->setEnabled(0);
} }
# and change title of tab to say enabled # and change title of tab to say enabled
@ -121,20 +121,19 @@ void TrimSPGUI::PrepLayers()
$All{"NL"}=NL->text(); $All{"NL"}=NL->text();
# Prepare enough Rows in table for layers # Prepare enough Rows in table for layers
my $OldNL=LayerTable->numRows(); my $OldNL=layerTable->numRows();
if ($OldNL<=$All{"NL"}) { if ($OldNL<=$All{"NL"}) {
LayerTable->setNumRows($All{"NL"}); layerTable->setNumRows($All{"NL"});
} else { } else {
for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) { for (my $i=$All{"NL"};$i<=$OldNL-1;$i++) {
print $i."\n";
removeRowFromTable($i); removeRowFromTable($i);
} }
} }
} }
# LayerTable->horizontalHeader()->setResizeMode(Qt::HeaderView::Stretch); # layerTable->horizontalHeader()->setResizeMode(Qt::HeaderView::Stretch);
# LayerTable->adjustColumn(0); # layerTable->adjustColumn(0);
# LayerTable->adjustColumn(1); # layerTable->adjustColumn(1);
# LayerTable->adjustColumn(2); # layerTable->adjustColumn(2);
} }
void TrimSPGUI::removeRowFromTable() void TrimSPGUI::removeRowFromTable()
@ -147,20 +146,20 @@ void TrimSPGUI::removeRowFromTable()
my ($deadRow) = @_; my ($deadRow) = @_;
# Loop over columns and take items of the row to remove # Loop over columns and take items of the row to remove
for my $col (0..LayerTable->numCols()-1) { for my $col (0..layerTable->numCols()-1) {
my $dummy=LayerTable->item($deadRow, $col); my $dummy=layerTable->item($deadRow, $col);
# In the items is not defined the row can be removed by simply # In the items is not defined the row can be removed by simply
# reducing the number of rows in table # reducing the number of rows in table
if ($dummy ne "") { if ($dummy ne "") {
LayerTable->takeItem(LayerTable->item($deadRow, $col)); layerTable->takeItem(layerTable->item($deadRow, $col));
for my $row ($deadRow..LayerTable->numRows()-2) { for my $row ($deadRow..layerTable->numRows()-2) {
my $item = LayerTable->item($row+1, $col); my $item = layerTable->item($row+1, $col);
LayerTable->takeItem($item); layerTable->takeItem($item);
LayerTable->setItem($row, $col, $item); layerTable->setItem($row, $col, $item);
} }
} }
} }
LayerTable->setNumRows(LayerTable->numRows()-1); layerTable->setNumRows(layerTable->numRows()-1);
} }
void TrimSPGUI::ProjSmartDefaults() void TrimSPGUI::ProjSmartDefaults()
@ -234,9 +233,9 @@ void TrimSPGUI::CollectValues()
my $LComp = "L".$i."Comp"; my $LComp = "L".$i."Comp";
my $Lrho="L".$i."rho"; my $Lrho="L".$i."rho";
my $Ld="L".$i."d"; my $Ld="L".$i."d";
$All{"$LComp"}=LayerTable->text($i-1,0); $All{"$LComp"}=layerTable->text($i-1,0);
$All{"$Lrho"}=LayerTable->text($i-1,1); $All{"$Lrho"}=layerTable->text($i-1,1);
$All{"$Ld"}=LayerTable->text($i-1,2); $All{"$Ld"}=layerTable->text($i-1,2);
} }
# Collect projectile parameters # Collect projectile parameters
@ -385,20 +384,20 @@ void TrimSPGUI::CreateInpFile()
$Check=0; $Check=0;
# Composition of layers # Composition of layers
my $LComp="L".$i."Comp"; my $LComp="L".$i."Comp";
my $Comp = LayerTable->text($i-1,0); my $Comp = layerTable->text($i-1,0);
$All{$LComp} = $Comp; $All{$LComp} = $Comp;
my %LElComp=Chem::parse_formula($Comp); my %LElComp=Chem::parse_formula($Comp);
if ($Comp eq "") {$Check++;} if ($Comp eq "") {$Check++;}
# Densities of layers # Densities of layers
my $Lrho="L".$i."rho"; my $Lrho="L".$i."rho";
my $rho = LayerTable->text($i-1,1); my $rho = layerTable->text($i-1,1);
$All{$Lrho}=sprintf("%6.2f",$rho); $All{$Lrho}=sprintf("%6.2f",$rho);
if ($rho eq "") {$Check++;} if ($rho eq "") {$Check++;}
# Thickness of layers # Thickness of layers
my $Ld ="L".$i."d"; my $Ld ="L".$i."d";
my $d = LayerTable->text($i-1,2); my $d = layerTable->text($i-1,2);
$All{$Ld}=sprintf("%8.2f",$d); $All{$Ld}=sprintf("%8.2f",$d);
if ($d eq "") {$Check++;} if ($d eq "") {$Check++;}
@ -750,20 +749,20 @@ void TrimSPGUI::OpenFile()
my $CRow=$InitPar[0]; my $CRow=$InitPar[0];
if ($InitPar[0] =~ m/L.*Comp$/ ) { if ($InitPar[0] =~ m/L.*Comp$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,0,$InitPar[1]); layerTable->setText($CRow-1,0,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*rho$/ ) { } elsif ($InitPar[0] =~ m/L.*rho$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,1,$InitPar[1]); layerTable->setText($CRow-1,1,$InitPar[1]);
} elsif ($InitPar[0] =~ m/L.*d$/ ) { } elsif ($InitPar[0] =~ m/L.*d$/ ) {
$CRow =~ s/\D//g; $CRow =~ s/\D//g;
LayerTable->setText($CRow-1,2,$InitPar[1]); layerTable->setText($CRow-1,2,$InitPar[1]);
} else { } else {
$Attrib = child($InitPar[0]); $Attrib = child($InitPar[0]);
if ($Types{$InitPar[0]} == 1) { if ($Types{$InitPar[0]} == 1) {
$Attrib->setValue($InitPar[1]); $Attrib->setValue($InitPar[1]);
# Create enough rows in LayerTable # Create enough rows in layerTable
if ($InitPar[0] eq "NL") { if ($InitPar[0] eq "NL") {
LayerTable->setNumRows($InitPar[1]); layerTable->setNumRows($InitPar[1]);
} }
} elsif ($Types{$InitPar[0]} == 2 ) { } elsif ($Types{$InitPar[0]} == 2 ) {
if($InitPar[1] == 1) { if($InitPar[1] == 1) {