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
+16 -16
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;
}