Update PShell

This commit is contained in:
gac-S_Changer
2025-09-12 16:15:40 +02:00
parent 114c800ac2
commit 0031959230
3 changed files with 31 additions and 26 deletions

View File

@@ -8,7 +8,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>workbench</artifactId>
<artifactId>pshell-workbench</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -55,6 +55,11 @@
<name>scijava</name>
<url>https://maven.scijava.org/</url>
</repository>
<repository>
<id>jetbrains</id>
<name>jetbrains</name>
<url>https://packages.jetbrains.team/maven/p/ij/intellij-dependencies/</url>
</repository>
<repository>
<id>releases</id>
<name>releases</name>

View File

@@ -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<String, List<String>> map = (Map<String, List<String>>) 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;
}

View File

@@ -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);
}