Added code to trick_dp that will check if fxplot exists. If it does then it will

add a radio button for it.  If it doesn't exist, it will not show up in the plot
menu.
This commit is contained in:
Alex Lin 2015-03-04 13:37:20 -06:00
parent 2fab93da66
commit a1fea8a36f
3 changed files with 342 additions and 315 deletions

View File

@ -2,8 +2,11 @@
# trick_dp that determines trick_home based on execution location of this script.
use FindBin qw($Bin);
use lib "$Bin/pm" ;
use File::Basename ;
use Cwd 'abs_path';
use gte ;
if ( ! exists $ENV{TRICK_HOME} ) {
$trick_bin = dirname(abs_path($0)) ;
@ -12,6 +15,9 @@ if ( ! exists $ENV{TRICK_HOME} ) {
# set TRICK_HOME based on the value of trick_home
$ENV{TRICK_HOME} = $trick_home ;
}
$host_cpu = gte("TRICK_HOST_CPU") ;
chomp($host_cpu) ;
$ENV{TRICK_HOST_CPU} = $host_cpu ;
if ( $^O eq "darwin" ) {
$command = "java -classpath $ENV{TRICK_HOME}/bin/java/dist/*:$ENV{TRICK_HOME}/bin/java/lib/*:$ENV{TRICK_HOME}/bin/java/lib/ \\

View File

@ -98,6 +98,7 @@ public abstract class DataProductsApplication extends TrickApplication {
protected static String TEMP_DP_FILE = "/tmp/DP_" + System.getenv("USER") + ".xml";
protected static String TEMP_SESSION_FILE = "/tmp/Session_" + System.getenv("USER") + ".xml";
protected boolean fermiExists ;
//========================================
// Private Data
@ -110,6 +111,7 @@ public abstract class DataProductsApplication extends TrickApplication {
// Options are: "Plot", "Table".
private String displayMode;
//========================================
// Constructors
//========================================
@ -239,7 +241,11 @@ public abstract class DataProductsApplication extends TrickApplication {
} else {
gnuplotButton.setIcon(resourceMap.getIcon("gnuplot.off.icon"));
if (gnuplotRadioButton.isSelected()) {
if ( fermiExists ) {
fermiRadioButton.setSelected(true);
} else {
javaRadioButton.setSelected(true);
}
}
getAction("selectGnuplotTerminal").setEnabled(false);
}
@ -360,15 +366,26 @@ public abstract class DataProductsApplication extends TrickApplication {
fermiRadioButton = new JRadioButtonMenuItem();
fermiRadioButton.setAction(getAction("selectFermi"));
fermiRadioButton.setSelected(true);
javaRadioButton = new JRadioButtonMenuItem(getAction("selectJavaPlot"));
String fermi_exe = UIUtils.getTrickHome() + "/trick_source/data_products/DPX/APPS/FXPLOT/object_" + UIUtils.getTrickHostCPU() + "/fxplot" ;
File f = new File(fermi_exe) ;
fermiExists = f.exists() ;
if ( fermiExists ) {
fermiRadioButton.setSelected(true);
} else {
javaRadioButton.setSelected(true);
}
gnuplotRadioButton = new JRadioButtonMenuItem();
gnuplotRadioButton.setAction(getAction("selectGnuplot"));
radioButtonGroup = new ButtonGroup();
if ( fermiExists ) {
radioButtonGroup.add(fermiRadioButton);
}
radioButtonGroup.add(javaRadioButton);
radioButtonGroup.add(gnuplotRadioButton);

View File

@ -772,7 +772,11 @@ public class TrickDPApplication extends DataProductsApplication {
settingsMenu.addSeparator();
settingsMenu.add(new JLabel("Plot Utility"));
if ( fermiExists ) {
addRadioButtonMenuItems(settingsMenu, new JRadioButtonMenuItem[]{fermiRadioButton, javaRadioButton, gnuplotRadioButton});
} else {
addRadioButtonMenuItems(settingsMenu, new JRadioButtonMenuItem[]{javaRadioButton, gnuplotRadioButton});
}
settingsMenu.addSeparator();