From 0031959230e9a6db39742472ac6bf1bf6e7f5975 Mon Sep 17 00:00:00 2001 From: gac-S_Changer Date: Fri, 12 Sep 2025 16:15:40 +0200 Subject: [PATCH] Update PShell --- pom.xml | 7 ++++- src/main/java/ch/psi/mxsc/Controller.java | 32 +++++++++++------------ src/main/java/ch/psi/mxsc/MainPanel.java | 18 ++++++------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 00b4ce4..319e3c1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ ${project.groupId} - workbench + pshell-workbench ${project.version} @@ -55,6 +55,11 @@ scijava https://maven.scijava.org/ + + jetbrains + jetbrains + https://packages.jetbrains.team/maven/p/ij/intellij-dependencies/ + releases releases diff --git a/src/main/java/ch/psi/mxsc/Controller.java b/src/main/java/ch/psi/mxsc/Controller.java index 7bce386..0667538 100644 --- a/src/main/java/ch/psi/mxsc/Controller.java +++ b/src/main/java/ch/psi/mxsc/Controller.java @@ -16,7 +16,7 @@ import ch.psi.pshell.device.GenericDevice; import ch.psi.pshell.app.App; import ch.psi.pshell.framework.Panel; import ch.psi.pshell.framework.Setup; -import ch.psi.pshell.sequencer.Interpreter; +import ch.psi.pshell.sequencer.Sequencer; import ch.psi.pshell.utils.Arr; import ch.psi.pshell.utils.Audio; import ch.psi.pshell.utils.Chrono; @@ -249,7 +249,7 @@ public class Controller { } public Sample getMountedSample() throws Exception{ - String mountedSample = (String) Context.getInterpreter().evalLineBackground("get_setting('mounted_sample_position')"); + String mountedSample = (String) Context.getSequencer().evalLineBackground("get_setting('mounted_sample_position')"); checkMountedSampleChange(currentMountedSample, mountedSample); currentMountedSample = mountedSample; Sample sample = basePlate.getSampleByName(currentMountedSample); @@ -257,9 +257,9 @@ public class Controller { } public void resetMountedSample() throws Exception{ - String mountedSample = (String) Context.getInterpreter().evalLineBackground("get_setting('mounted_sample_position')"); + String mountedSample = (String) Context.getSequencer().evalLineBackground("get_setting('mounted_sample_position')"); checkMountedSampleChange(currentMountedSample, null); - Context.getInterpreter().evalLineBackground("set_setting('mounted_sample_position', None)"); + Context.getSequencer().evalLineBackground("set_setting('mounted_sample_position', None)"); } void checkMountedSampleChange(String former, String current){ @@ -538,11 +538,11 @@ public class Controller { } } - public void imageDetectPucks() throws Interpreter.InterpreterStateException { + public void imageDetectPucks() throws Sequencer.StateException { imageDetectPucks(null, null, null); } - public void imageDetectPucks(JComponent plot, JComponent renderer, JComponent text) throws Interpreter.InterpreterStateException { + public void imageDetectPucks(JComponent plot, JComponent renderer, JComponent text) throws Sequencer.StateException { Map args = new HashMap(); args.put("PLOT", plot); args.put("RENDERER", renderer); @@ -559,7 +559,7 @@ public class Controller { updateView(); } - public void clearImageDetection() throws Interpreter.InterpreterStateException, ScriptException, IOException, InterruptedException { + public void clearImageDetection() throws Sequencer.StateException, ScriptException, IOException, InterruptedException { Map> map = (Map>) getMainFrame().eval("clear_detection(None)"); setImageDetection(map); } @@ -665,8 +665,8 @@ public class Controller { //synchronized(samplesTableLock){ SwingUtilities.invokeLater(() -> { try { - if (Context.getInterpreter().getState().isInitialized()) { - String json = (String) Context.getInterpreter().evalLineBackground("get_samples_info()"); + if (Context.getSequencer().getState().isInitialized()) { + String json = (String) Context.getSequencer().evalLineBackground("get_samples_info()"); if (!json.equals(samplesTableJson)) { samplesTableJson = json; @@ -775,7 +775,7 @@ public class Controller { try { getMainFrame().evalAsync("set_laser_pos(" + ((pos==null) ? "" : ("'" + pos + "'") ) + ")" ,true); getMainFrame().basePlatePanel.pointPuck((pos==null) ? null : basePlate.getPuckByName(pos)); - } catch (Interpreter.InterpreterStateException ex) { + } catch (Sequencer.StateException ex) { Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex); } } @@ -844,7 +844,7 @@ public class Controller { System.out.println("Setting datamatrix '" + datamatrix + "' to puck: " + puckName); try { - Context.getInterpreter().evalLineBackground("set_puck_datamatrix('" + puckName + "','" + datamatrix + "')"); + Context.getSequencer().evalLineBackground("set_puck_datamatrix('" + puckName + "','" + datamatrix + "')"); if (puck != null) { puck.setId(datamatrix); } else { @@ -867,7 +867,7 @@ public class Controller { Map getPuckDatamatrix() { try { - return (Map) Context.getInterpreter().evalLineBackground("get_puck_datamatrix()"); + return (Map) Context.getSequencer().evalLineBackground("get_puck_datamatrix()"); } catch (Exception ex) { return null; } @@ -875,7 +875,7 @@ public class Controller { Map getPuckDatamatrixInfo() { try { - return (Map) Context.getInterpreter().evalLineBackground("get_puck_datamatrix_info()"); + return (Map) Context.getSequencer().evalLineBackground("get_puck_datamatrix_info()"); } catch (Exception ex) { return null; } @@ -883,7 +883,7 @@ public class Controller { String getPuckFromDatamatrix(String dm){ try { - return (String) Context.getInterpreter().evalLineBackground("get_puck_from_datamatrix('" + dm + "')"); + return (String) Context.getSequencer().evalLineBackground("get_puck_from_datamatrix('" + dm + "')"); } catch (Exception ex) { return null; } @@ -1040,7 +1040,7 @@ public class Controller { try { List puckInfo = (List) getMainFrame().eval("get_puck_info()", true); - Context.getInterpreter().sendEvent("DewarContentUpdate", puckInfo); + Context.getSequencer().sendEvent("DewarContentUpdate", puckInfo); } catch (Exception ex) { Logger.getLogger(Controller.class.getName()).log(Level.SEVERE, null, ex); } @@ -1141,7 +1141,7 @@ public class Controller { void logStateChange(State state){ String command = ""; if (state==State.Busy){ - CommandInfo info = Context.getInterpreter().getCommandManager().getCurrentCommand(true); + CommandInfo info = Context.getCommandBus().getCurrentCommand(true); if (info != null){ command = (info.script != null) ? info.script : info.command; } diff --git a/src/main/java/ch/psi/mxsc/MainPanel.java b/src/main/java/ch/psi/mxsc/MainPanel.java index 72edcef..3e38fbe 100644 --- a/src/main/java/ch/psi/mxsc/MainPanel.java +++ b/src/main/java/ch/psi/mxsc/MainPanel.java @@ -5,12 +5,12 @@ package ch.psi.mxsc; import ch.psi.mxsc.BasePlatePanel.SelectionMode; import ch.psi.pshell.framework.Context; -import ch.psi.pshell.plugin.Plugin; import ch.psi.pshell.device.Device; import ch.psi.pshell.device.DeviceListener; import ch.psi.pshell.device.DeviceBase; import ch.psi.pshell.device.DeviceListener; import ch.psi.pshell.device.GenericDevice; +import ch.psi.pshell.extension.Plugin; import ch.psi.pshell.imaging.PointDouble; import ch.psi.pshell.imaging.Renderer; import ch.psi.pshell.imaging.RendererMode; @@ -101,7 +101,7 @@ public class MainPanel extends Panel { public MainPanel() { initComponents(); - Context.getPluginManager().addDynamicClass(PuckDetection.class); + Context.getExtensions().addDynamicClass(PuckDetection.class); Controller.createInstance(this); basePlatePanel.setMode(BasePlatePanel.Mode.single); setExpertMode(false); @@ -519,7 +519,7 @@ public class MainPanel extends Panel { void setStatus(String status) { String current = current = (statusBar==null) ? this.status : statusBar.getStatusLabel().getText(); if (!status.equals(current)) { - Context.getInterpreter().setPreference(ViewPreference.STATUS, status); + Context.getSequencer().setPreference(ViewPreference.STATUS, status); } this.status = status; } @@ -867,11 +867,11 @@ public class MainPanel extends Panel { Panel showCommandsPanel() { if (commandsPlugin != null) { - Context.getPluginManager().unloadPlugin(commandsPlugin); + Context.getExtensions().unloadPlugin(commandsPlugin); } - commandsPlugin = Context.getPluginManager().loadPlugin(Setup.expandPath("{plugins}/Commands.java")); + commandsPlugin = Context.getExtensions().loadPlugin(Setup.expandPath("{plugins}/Commands.java")); ((Panel) commandsPlugin).setDetached(true, getTopLevel()); - Context.getPluginManager().initializePlugin(commandsPlugin); + Context.getExtensions().initializePlugin(commandsPlugin); return ((Panel) commandsPlugin); } @@ -879,11 +879,11 @@ public class MainPanel extends Panel { Panel showRecoveryPanel() { if (recoveryPlugin != null) { - Context.getPluginManager().unloadPlugin(recoveryPlugin); + Context.getExtensions().unloadPlugin(recoveryPlugin); } - recoveryPlugin = Context.getPluginManager().loadPlugin(Setup.expandPath("{plugins}/Recovery.java")); + recoveryPlugin = Context.getExtensions().loadPlugin(Setup.expandPath("{plugins}/Recovery.java")); ((Panel) recoveryPlugin).setDetached(true, getTopLevel()); - Context.getPluginManager().initializePlugin(recoveryPlugin); + Context.getExtensions().initializePlugin(recoveryPlugin); return ((Panel) recoveryPlugin); }