Fix warning message when TrimSP binary is not found.

This commit is contained in:
salman 2013-02-05 16:29:36 +00:00
parent 3740a74381
commit 1e5806a520
2 changed files with 39 additions and 19 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: Tue Feb 5 15:22:18 2013 # Created: Tue Feb 5 15:53:55 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!
@ -2466,8 +2466,6 @@ sub CollectValues
sub CreateInpFile sub CreateInpFile
{ {
# use lib '$ENV{HOME}/Projects/TrimSPGUI/Chem';
# push @INC, "$ENV{HOME}/Projects/TrimSPGUI";
use Chem; use Chem;
# The proper way I think is not to have scan sequences implimented here # The proper way I think is not to have scan sequences implimented here
# but rather call this multiple times to generate the scan # but rather call this multiple times to generate the scan
@ -2669,7 +2667,7 @@ sub StartSequenceOne
if (!$ENV{'TRIMBIN'}) { if (!$ENV{'TRIMBIN'}) {
# If trim.sp binary is not defined give warning and return # If trim.sp binary is not defined give warning and return
my $Warning = Qt::MessageBox::information( this, "Warning", my $Warning = Qt::MessageBox::information( this, "Warning",
"Warning:\n TrimSP binary is not found.\n Define using environment variable, e.g.\n export TRIMBIN=/usr/local/bin/trimsp7l\n or use the Configuration tab."); "Warning:\n TrimSP binary is not found.\n Define using the Configuration tab.");
return(0); return(0);
} }
@ -3126,15 +3124,16 @@ sub GUIPath
# If nothing is returned keep as is # If nothing is returned keep as is
if ($FileBrowser eq "") { if ($FileBrowser eq "") {
$FileBrowser="$ENV{'PERLLIB'}"; $FileBrowser=$ENV{'PERLLIB'};
} else { } else {
TrimGUIPath->setText($FileBrowser); $ENV{'PERLLIB'}=$FileBrowser;
$ENV{'PERLLIB'}=$FileBrowser;
} }
TrimGUIPath->setText($FileBrowser);
# Return a string with the directory name # Return a string with the directory name
return $FileBrowser ; return $FileBrowser ;
} }
sub TrimBin sub TrimBin
@ -3148,11 +3147,12 @@ sub TrimBin
"Select the Trim.SP binary file"); "Select the Trim.SP binary file");
# If the user gave a valid filename try to read it # If the user gave a valid filename try to read it
if ($file ne "") { if ($file eq "") {
$file=$ENV{'TRIMBIN'};
} else {
$ENV{'TRIMBIN'}=$file; $ENV{'TRIMBIN'}=$file;
TRIMBIN->setText($file);
} }
TRIMBIN->setText($file);
return $file; return $file;
} }

View File

@ -311,8 +311,6 @@ void TrimSPGUI::CollectValues()
void TrimSPGUI::CreateInpFile() void TrimSPGUI::CreateInpFile()
{ {
# use lib '$ENV{HOME}/Projects/TrimSPGUI/Chem';
# push @INC, "$ENV{HOME}/Projects/TrimSPGUI";
use Chem; use Chem;
# The proper way I think is not to have scan sequences implimented here # The proper way I think is not to have scan sequences implimented here
# but rather call this multiple times to generate the scan # but rather call this multiple times to generate the scan
@ -513,7 +511,7 @@ void TrimSPGUI::StartSequenceOne()
if (!$ENV{'TRIMBIN'}) { if (!$ENV{'TRIMBIN'}) {
# If trim.sp binary is not defined give warning and return # If trim.sp binary is not defined give warning and return
my $Warning = Qt::MessageBox::information( this, "Warning", my $Warning = Qt::MessageBox::information( this, "Warning",
"Warning:\n TrimSP binary is not found.\n Define using environment variable, e.g.\n export TRIMBIN=/usr/local/bin/trimsp7l\n or use the Configuration tab."); "Warning:\n TrimSP binary is not found.\n Define using the Configuration tab.");
return(0); return(0);
} }
@ -961,14 +959,35 @@ void TrimSPGUI::GUIPath()
# If nothing is returned keep as is # If nothing is returned keep as is
if ($FileBrowser eq "") { if ($FileBrowser eq "") {
$FileBrowser="$ENV{'PERLLIB'}"; $FileBrowser=$ENV{'PERLLIB'};
} else { } else {
TrimGUIPath->setText($FileBrowser); $ENV{'PERLLIB'}=$FileBrowser;
$ENV{'PERLLIB'}=$FileBrowser;
} }
TrimGUIPath->setText($FileBrowser);
# Return a string with the directory name # Return a string with the directory name
return $FileBrowser ; return $FileBrowser ;
}
sub TrimBin
{
my $file=Qt::FileDialog::getOpenFileName(
"$ENV{'TRIMBIN'}",
"Trim.SP binary (.* *.* *)",
this,
"open file dialog",
"Select the Trim.SP binary file");
# If the user gave a valid filename try to read it
if ($file eq "") {
$file=$ENV{'TRIMBIN'};
} else {
$ENV{'TRIMBIN'}=$file;
}
TRIMBIN->setText($file);
return $file;
} }
@ -982,10 +1001,11 @@ void TrimSPGUI::TrimBin()
"Select the Trim.SP binary file"); "Select the Trim.SP binary file");
# If the user gave a valid filename try to read it # If the user gave a valid filename try to read it
if ($file ne "") { if ($file eq "") {
$file=$ENV{'TRIMBIN'};
} else {
$ENV{'TRIMBIN'}=$file; $ENV{'TRIMBIN'}=$file;
TRIMBIN->setText($file);
} }
TRIMBIN->setText($file);
return $file; return $file;
} }