This commit is contained in:
2025-09-09 18:32:30 +02:00
parent 49b31b74ba
commit 5e752ba302
4 changed files with 17 additions and 17 deletions
@@ -358,15 +358,15 @@ public class AthosScreens extends Panel {
void startRecording() throws Exception { void startRecording() throws Exception {
stopRecording(); stopRecording();
Context.getInterpreter().startExecution(CommandSource.plugin, null, cameraName, null, false); Context.getSequencer().startExecution(CommandSource.plugin, null, cameraName, null, false);
Context.getInterpreter().setExecutionPar("name", cameraName); Context.getSequencer().setExecutionPar("name", cameraName);
Context.getInterpreter().setExecutionPar("open", true); Context.getSequencer().setExecutionPar("open", true);
recordingScan = new MonitorScan(dataPipeline.getStream(), getReadables(), -1, -1); recordingScan = new MonitorScan(dataPipeline.getStream(), getReadables(), -1, -1);
Threading.getFuture(() -> recordingScan.start()).handle((ret, t) -> { Threading.getFuture(() -> recordingScan.start()).handle((ret, t) -> {
recordingScan = null; recordingScan = null;
return ret; return ret;
}); });
String fileName = Context.getInterpreter().getExecutionPars().getPath(); String fileName = Context.getSequencer().getExecutionPars().getPath();
logger.info("Start recording: " + fileName); logger.info("Start recording: " + fileName);
fileHistory.add(fileName); fileHistory.add(fileName);
listFile.setModel(new javax.swing.AbstractListModel<String>() { listFile.setModel(new javax.swing.AbstractListModel<String>() {
@@ -387,7 +387,7 @@ public class AthosScreens extends Panel {
if (recordingScan != null) { if (recordingScan != null) {
logger.info("Stop recording"); logger.info("Stop recording");
recordingScan.abort(); recordingScan.abort();
Context.getInterpreter().endExecution(); Context.getSequencer().endExecution();
recordingScan = null; recordingScan = null;
} }
} }
@@ -111,14 +111,14 @@ public class Correlation extends Panel {
//DecimalFormat formatter = new DecimalFormat("0.##E0"); //DecimalFormat formatter = new DecimalFormat("0.##E0");
void updateResults(){ void updateResults(){
try{ try{
textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)Context.getInterpreter().getInterpreterVariable("corr")))); textCorrelation.setText(String.format("%1.4f", Double.valueOf((Double)Context.getSequencer().getInterpreterVariable("corr"))));
} catch (Exception ex){ } catch (Exception ex){
textCorrelation.setText(""); textCorrelation.setText("");
} }
if (checkLinear.isSelected()){ if (checkLinear.isSelected()){
try{ try{
List pars = (List)Context.getInterpreter().getInterpreterVariable("pars_lin"); List pars = (List)Context.getSequencer().getInterpreterVariable("pars_lin");
//textLinear.setText(String.format("%1.3fx%+1.3f", (Double)(pars.get(1)), (Double)(pars.get(0)))); //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))); textLinear.setText(String.format("%1.6gx%+1.6g",pars.get(1), pars.get(0)));
} catch (Exception ex){ } catch (Exception ex){
@@ -128,7 +128,7 @@ public class Correlation extends Panel {
if (checkQuadratic.isSelected()){ if (checkQuadratic.isSelected()){
try{ try{
List pars = (List)Context.getInterpreter().getInterpreterVariable("pars_quad"); List pars = (List)Context.getSequencer().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.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(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))); //textQuadratic.setText(formatter.format(pars.get(2))+ formatter.format(pars.get(1)) + formatter.format(pars.get(0)));
@@ -137,11 +137,11 @@ public class Correlation extends Panel {
textQuadratic.setText(""); textQuadratic.setText("");
} }
try{ try{
String peak = (String)Context.getInterpreter().getInterpreterVariable("pos_peak"); String peak = (String)Context.getSequencer().getInterpreterVariable("pos_peak");
if (peak!=null){ if (peak!=null){
textPeak.setText(peak + " (max)"); textPeak.setText(peak + " (max)");
} else { } else {
peak = (String)Context.getInterpreter().getInterpreterVariable("neg_peak"); peak = (String)Context.getSequencer().getInterpreterVariable("neg_peak");
if (peak!=null){ if (peak!=null){
textPeak.setText(peak + " (min)"); textPeak.setText(peak + " (min)");
} else { } else {
@@ -485,15 +485,15 @@ public class Correlation extends Panel {
if (isRunning()){ if (isRunning()){
//abort(); //abort();
//Stooping smootly so displayed variables get updated. //Stooping smootly so displayed variables get updated.
Context.getInterpreter().setInterpreterVariable("stop_exec", true); Context.getSequencer().setInterpreterVariable("stop_exec", true);
Chrono chrono = new Chrono(); Chrono chrono = new Chrono();
while (!chrono.isTimeout(500)){ while (!chrono.isTimeout(500)){
if (!Boolean.TRUE.equals(Context.getInterpreter().getInterpreterVariable("stop_exec"))){ if (!Boolean.TRUE.equals(Context.getSequencer().getInterpreterVariable("stop_exec"))){
break; break;
} }
Thread.sleep(1); Thread.sleep(1);
} }
if (Boolean.TRUE.equals(Context.getInterpreter().getInterpreterVariable("stop_exec"))){ if (Boolean.TRUE.equals(Context.getSequencer().getInterpreterVariable("stop_exec"))){
System.out.println("Timeout stopping script - aborting..."); System.out.println("Timeout stopping script - aborting...");
abort(); abort();
} }
@@ -267,14 +267,14 @@ public class ScreenPanelSF extends Panel implements CamServerViewer.CamServerVie
c.gridy = 1; c.gridy = 1;
panel.add(comboLogbook, c); panel.add(comboLogbook, c);
c.gridy = 0; c.gridy = 0;
panel.add(new JLabel(Context.getInterpreter().getExecutionPars().getPath()), c); panel.add(new JLabel(Context.getSequencer().getExecutionPars().getPath()), c);
if (SwingUtils.showOption(getTopLevel(), "Success", panel, OptionType.OkCancel) == OptionResult.Yes) { if (SwingUtils.showOption(getTopLevel(), "Success", panel, OptionType.OkCancel) == OptionResult.Yes) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("Camera: ").append(name).append("\n"); message.append("Camera: ").append(name).append("\n");
message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n"); message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n");
message.append("Filter: ").append(String.valueOf(valueFilter.getLabel().getText())).append("\n"); message.append("Filter: ").append(String.valueOf(valueFilter.getLabel().getText())).append("\n");
message.append("Data file: ").append(Context.getInterpreter().getExecutionPars().getPath()).append("\n"); message.append("Data file: ").append(Context.getSequencer().getExecutionPars().getPath()).append("\n");
message.append("Comment: ").append(textComment.getText()).append("\n"); message.append("Comment: ").append(textComment.getText()).append("\n");
//Add slicing message //Add slicing message
Overlay[] fitOv = camServerViewer.getFitOverlays(); Overlay[] fitOv = camServerViewer.getFitOverlays();
@@ -329,13 +329,13 @@ public class ScreenPanelSLS extends Panel implements CamServerViewer.CamServerVi
c.gridy = 1; c.gridy = 1;
panel.add(comboLogbook, c); panel.add(comboLogbook, c);
c.gridy = 0; c.gridy = 0;
panel.add(new JLabel(Context.getInterpreter().getExecutionPars().getPath()), c); panel.add(new JLabel(Context.getSequencer().getExecutionPars().getPath()), c);
if (SwingUtils.showOption(getTopLevel(), "Success", panel, OptionType.OkCancel) == OptionResult.Yes) { if (SwingUtils.showOption(getTopLevel(), "Success", panel, OptionType.OkCancel) == OptionResult.Yes) {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("Camera: ").append(name).append("\n"); message.append("Camera: ").append(name).append("\n");
message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n"); message.append("Screen: ").append(String.valueOf(valueScreen.getLabel().getText())).append("\n");
message.append("Data file: ").append(Context.getInterpreter().getExecutionPars().getPath()).append("\n"); message.append("Data file: ").append(Context.getSequencer().getExecutionPars().getPath()).append("\n");
message.append("Comment: ").append(textComment.getText()).append("\n"); message.append("Comment: ").append(textComment.getText()).append("\n");
//Add slicing message //Add slicing message
Overlay[] fitOv = camServerViewer.getFitOverlays(); Overlay[] fitOv = camServerViewer.getFitOverlays();