diff --git a/correlation/build.gradle b/correlation/build.gradle index c78565a..44d4692 100644 --- a/correlation/build.gradle +++ b/correlation/build.gradle @@ -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) diff --git a/correlation/config/devices.properties b/correlation/src/main/pkg/config/devices.properties similarity index 100% rename from correlation/config/devices.properties rename to correlation/src/main/pkg/config/devices.properties diff --git a/correlation/config/jcae.properties b/correlation/src/main/pkg/config/jcae.properties similarity index 100% rename from correlation/config/jcae.properties rename to correlation/src/main/pkg/config/jcae.properties diff --git a/correlation/devices/cam_server.properties b/correlation/src/main/pkg/devices/cam_server.properties similarity index 100% rename from correlation/devices/cam_server.properties rename to correlation/src/main/pkg/devices/cam_server.properties diff --git a/correlation/devices/dispatcher.properties b/correlation/src/main/pkg/devices/dispatcher.properties similarity index 100% rename from correlation/devices/dispatcher.properties rename to correlation/src/main/pkg/devices/dispatcher.properties diff --git a/correlation/plugins/Correlation.form b/correlation/src/main/pkg/plugins/Correlation.form similarity index 100% rename from correlation/plugins/Correlation.form rename to correlation/src/main/pkg/plugins/Correlation.form diff --git a/correlation/plugins/Correlation.java b/correlation/src/main/pkg/plugins/Correlation.java similarity index 94% rename from correlation/plugins/Correlation.java rename to correlation/src/main/pkg/plugins/Correlation.java index d7234bc..a248699 100644 --- a/correlation/plugins/Correlation.java +++ b/correlation/src/main/pkg/plugins/Correlation.java @@ -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(); diff --git a/correlation/script/correlation.py b/correlation/src/main/pkg/script/correlation.py similarity index 100% rename from correlation/script/correlation.py rename to correlation/src/main/pkg/script/correlation.py