Preliminary implementation of package apps.
This commit is contained in:
@@ -6,6 +6,14 @@ ext.deploy_type= 'pkg'
|
||||
|
||||
dependencies {
|
||||
implementation 'ch.psi:pshell-workbench:' + version
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = ['src/main/pkg/plugins']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createDefaultTasks(project)
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
import ch.psi.pshell.plot.Plot;
|
||||
import ch.psi.pshell.swing.ChannelSelector;
|
||||
import ch.psi.pshell.ui.App;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.Chrono;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import ch.psi.utils.swing.SwingUtils.OptionResult;
|
||||
import ch.psi.utils.swing.SwingUtils.OptionType;
|
||||
import ch.psi.pshell.framework.App;
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.framework.Panel;
|
||||
import ch.psi.pshell.framework.Setup;
|
||||
import ch.psi.pshell.utils.State;
|
||||
import ch.psi.pshell.utils.Chrono;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import ch.psi.pshell.swing.SwingUtils.OptionResult;
|
||||
import ch.psi.pshell.swing.SwingUtils.OptionType;
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
@@ -20,7 +22,6 @@ import javax.swing.JComboBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -110,14 +111,14 @@ public class Correlation extends Panel {
|
||||
//DecimalFormat formatter = new DecimalFormat("0.##E0");
|
||||
void updateResults(){
|
||||
try{
|
||||
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)getContext().getInterpreterVariable("corr"))));
|
||||
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)Context.getInterpreter().getInterpreterVariable("corr"))));
|
||||
} catch (Exception ex){
|
||||
textCorrelation.setText("");
|
||||
}
|
||||
|
||||
if (checkLinear.isSelected()){
|
||||
try{
|
||||
List pars = (List)getContext().getInterpreterVariable("pars_lin");
|
||||
List pars = (List)Context.getInterpreter().getInterpreterVariable("pars_lin");
|
||||
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
|
||||
} catch (Exception ex){
|
||||
@@ -127,7 +128,7 @@ public class Correlation extends Panel {
|
||||
|
||||
if (checkQuadratic.isSelected()){
|
||||
try{
|
||||
List pars = (List)getContext().getInterpreterVariable("pars_quad");
|
||||
List pars = (List)Context.getInterpreter().getInterpreterVariable("pars_quad");
|
||||
//textQuadratic.setText(String.format("%1.2fx\u00B2 %+1.2fx%+1.2f", (Double)(pars.get(0)), (Double)(pars.get(1)), (Double)(pars.get(0))));
|
||||
textQuadratic.setText(String.format("%1.3gx\u00B2%+1.3gx%+1.3g", pars.get(0), pars.get(1), pars.get(0)));
|
||||
//textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
|
||||
@@ -136,11 +137,11 @@ public class Correlation extends Panel {
|
||||
textQuadratic.setText("");
|
||||
}
|
||||
try{
|
||||
String peak = (String)getContext().getInterpreterVariable("pos_peak");
|
||||
String peak = (String)Context.getInterpreter().getInterpreterVariable("pos_peak");
|
||||
if (peak!=null){
|
||||
textPeak.setText(peak + " (max)");
|
||||
} else {
|
||||
peak = (String)getContext().getInterpreterVariable("neg_peak");
|
||||
peak = (String)Context.getInterpreter().getInterpreterVariable("neg_peak");
|
||||
if (peak!=null){
|
||||
textPeak.setText(peak + " (min)");
|
||||
} else {
|
||||
@@ -484,15 +485,15 @@ public class Correlation extends Panel {
|
||||
if (isRunning()){
|
||||
//abort();
|
||||
//Stooping smootly so displayed variables get updated.
|
||||
getContext().setInterpreterVariable("stop_exec", true);
|
||||
Context.getInterpreter().setInterpreterVariable("stop_exec", true);
|
||||
Chrono chrono = new Chrono();
|
||||
while (!chrono.isTimeout(500)){
|
||||
if (!Boolean.TRUE.equals(getContext().getInterpreterVariable("stop_exec"))){
|
||||
if (!Boolean.TRUE.equals(Context.getInterpreter().getInterpreterVariable("stop_exec"))){
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1);
|
||||
}
|
||||
if (Boolean.TRUE.equals(getContext().getInterpreterVariable("stop_exec"))){
|
||||
if (Boolean.TRUE.equals(Context.getInterpreter().getInterpreterVariable("stop_exec"))){
|
||||
System.out.println("Timeout stopping script - aborting...");
|
||||
abort();
|
||||
}
|
||||
@@ -552,7 +553,7 @@ public class Correlation extends Panel {
|
||||
|
||||
private void buttonElogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonElogActionPerformed
|
||||
try{
|
||||
String snapshotFile = getContext().getSetup().expandPath("{context}/correlation_plot.png");
|
||||
String snapshotFile = Setup.expandPath("{context}/correlation_plot.png");
|
||||
plot.saveSnapshot(snapshotFile, "png");
|
||||
JPanel panel = new JPanel();
|
||||
GridBagLayout layout = new GridBagLayout();
|
||||
Reference in New Issue
Block a user