Extract densities from database if found.

This commit is contained in:
salman 2013-03-12 12:39:11 +00:00
parent 75b6071c53
commit 0afa7182b9
3 changed files with 163 additions and 15 deletions

View File

@ -13,6 +13,7 @@ use Ui_TrimSPGUI4;
use QtCore4::slots
# test => [],
ToggleScanSingle => [],
findDensity => [],
PrepLayers => [],
ProjSmartDefaults => [],
helpAboutAction => [],
@ -972,6 +973,25 @@ Copyright 2009-2013 by Zaher Salman.
my $HelpWindow = Qt::MessageBox::about( this, "About TrimSP GUI",$HelpText);
}
# Subroutine: Find density of material from database
sub findDensity()
{
use Chem;
# Get sender name to know which layer
my $sender = this->sender()->objectName();
# Generate the name of the density field
my $rhoSender = substr($sender,0,6)."rho";
# Get the compound formula
my $Compound = this->sender()->text();
# See if you have the density
my $Density=Chem::Densities($Compound);
if ($Density ne "") {
# If the density is in the database submit it
my $rho = child("Qt::LineEdit",$rhoSender);
$rho->setText($Density);
}
}
# Subroutine: keep for tests and debugging
sub test()
{

View File

@ -365,6 +365,10 @@
</sizepolicy>
</property>
</widget>
<zorder>layer4Comp</zorder>
<zorder>layer4rho</zorder>
<zorder>layer4d</zorder>
<zorder>layer1Comp</zorder>
</widget>
</item>
<item>
@ -1754,7 +1758,7 @@
<attribute name="title">
<string>Configure</string>
</attribute>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
@ -2460,6 +2464,118 @@
</hint>
</hints>
</connection>
<connection>
<sender>layer1Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>131</x>
<y>219</y>
</hint>
<hint type="destinationlabel">
<x>722</x>
<y>391</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer2Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>108</x>
<y>271</y>
</hint>
<hint type="destinationlabel">
<x>721</x>
<y>357</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer3Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>90</x>
<y>320</y>
</hint>
<hint type="destinationlabel">
<x>720</x>
<y>427</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer4Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>79</x>
<y>382</y>
</hint>
<hint type="destinationlabel">
<x>718</x>
<y>458</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer5Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>102</x>
<y>434</y>
</hint>
<hint type="destinationlabel">
<x>718</x>
<y>488</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer6Comp</sender>
<signal>textEdited(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>88</x>
<y>481</y>
</hint>
<hint type="destinationlabel">
<x>719</x>
<y>603</y>
</hint>
</hints>
</connection>
<connection>
<sender>layer7Comp</sender>
<signal>textChanged(QString)</signal>
<receiver>TrimSPGUI4</receiver>
<slot>findDensity()</slot>
<hints>
<hint type="sourcelabel">
<x>71</x>
<y>532</y>
</hint>
<hint type="destinationlabel">
<x>714</x>
<y>-7</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>DirectoryBrowse()</slot>
@ -2480,6 +2596,7 @@
<slot>test()</slot>
<slot>TrimBin()</slot>
<slot>GUIPath()</slot>
<slot>findDensity()</slot>
</slots>
<buttongroups>
<buttongroup name="listGroup"/>

View File

@ -5,7 +5,7 @@
#################################################################################
## Form generated from reading UI file 'TrimSPGUI4.ui'
##
## Created: Tue Feb 5 16:22:06 2013
## Created: Thu Feb 7 16:51:02 2013
## by: Qt User Interface Compiler version 4.8.4
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
@ -566,8 +566,8 @@ sub configTab {
return shift->{configTab};
}
sub widget1 {
return shift->{widget1};
sub layoutWidget1 {
return shift->{layoutWidget1};
}
sub verticalLayout_2 {
@ -870,6 +870,10 @@ sub setupUi {
$layer4d->setGeometry( Qt::Rect(320, 20, 85, 25) );
$sizePolicy->setHeightForWidth( $layer4d->sizePolicy()->hasHeightForWidth() );
$layer4d->setSizePolicy( $sizePolicy );
$layer4Comp->raise();
$layer4rho->raise();
$layer4d->raise();
$layer1Comp->raise();
$vboxLayout->addWidget( $boxL4 );
@ -1452,11 +1456,11 @@ sub setupUi {
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 );
my $layoutWidget1 = Qt::Widget( $configTab );
$self->{layoutWidget1} = $layoutWidget1;
$layoutWidget1->setObjectName( "layoutWidget1" );
$layoutWidget1->setGeometry( Qt::Rect(10, 31, 671, 101) );
my $verticalLayout_2 = Qt::VBoxLayout( $layoutWidget1 );
$self->{verticalLayout_2} = $verticalLayout_2;
$verticalLayout_2->setSpacing( 6 );
$verticalLayout_2->setMargin( 11 );
@ -1466,7 +1470,7 @@ sub setupUi {
$self->{horizontalLayout} = $horizontalLayout;
$horizontalLayout->setSpacing( 6 );
$horizontalLayout->setObjectName( "horizontalLayout" );
my $label_2 = Qt::Label( $widget1 );
my $label_2 = Qt::Label( $layoutWidget1 );
$self->{label_2} = $label_2;
$label_2->setObjectName( "label_2" );
my $sizePolicy9 = Qt::SizePolicy( Qt::SizePolicy::Fixed(), Qt::SizePolicy::Preferred() );
@ -1480,13 +1484,13 @@ sub setupUi {
$horizontalLayout->addWidget( $label_2 );
my $trimbin = Qt::LineEdit( $widget1 );
my $trimbin = Qt::LineEdit( $layoutWidget1 );
$self->{trimbin} = $trimbin;
$trimbin->setObjectName( "trimbin" );
$horizontalLayout->addWidget( $trimbin );
my $trimBinBrowse = Qt::PushButton( $widget1 );
my $trimBinBrowse = Qt::PushButton( $layoutWidget1 );
$self->{trimBinBrowse} = $trimBinBrowse;
$trimBinBrowse->setObjectName( "trimBinBrowse" );
@ -1499,7 +1503,7 @@ sub setupUi {
$self->{horizontalLayout_2} = $horizontalLayout_2;
$horizontalLayout_2->setSpacing( 6 );
$horizontalLayout_2->setObjectName( "horizontalLayout_2" );
my $label_3 = Qt::Label( $widget1 );
my $label_3 = Qt::Label( $layoutWidget1 );
$self->{label_3} = $label_3;
$label_3->setObjectName( "label_3" );
$sizePolicy9->setHeightForWidth( $label_3->sizePolicy()->hasHeightForWidth() );
@ -1509,13 +1513,13 @@ sub setupUi {
$horizontalLayout_2->addWidget( $label_3 );
my $pathTrimGUI = Qt::LineEdit( $widget1 );
my $pathTrimGUI = Qt::LineEdit( $layoutWidget1 );
$self->{pathTrimGUI} = $pathTrimGUI;
$pathTrimGUI->setObjectName( "pathTrimGUI" );
$horizontalLayout_2->addWidget( $pathTrimGUI );
my $guiPathBrowse = Qt::PushButton( $widget1 );
my $guiPathBrowse = Qt::PushButton( $layoutWidget1 );
$self->{guiPathBrowse} = $guiPathBrowse;
$guiPathBrowse->setObjectName( "guiPathBrowse" );
@ -1642,6 +1646,13 @@ sub setupUi {
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()' );
Qt::Object::connect($layer1Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer2Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer3Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer4Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer5Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer6Comp, SIGNAL 'textEdited(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
Qt::Object::connect($layer7Comp, SIGNAL 'textChanged(QString)' , $trimSPGUI4, SLOT 'findDensity()' );
$tabs->setCurrentIndex( 0 );