This commit is contained in:
gac-ISS
2025-08-27 14:36:28 +02:00
parent 350f06090b
commit e9ba08ce4f
15 changed files with 181 additions and 94 deletions

View File

@@ -1,9 +1,11 @@
import ch.psi.pshell.epics.Positioner;
import ch.psi.pshell.ui.ScriptProcessor;
import ch.psi.utils.EncoderJson;
import ch.psi.utils.IO;
import ch.psi.utils.State;
import ch.psi.utils.swing.SwingUtils;
import ch.psi.pshell.framework.Context;
import ch.psi.pshell.framework.ScriptProcessor;
import ch.psi.pshell.framework.Setup;
import ch.psi.pshell.utils.EncoderJson;
import ch.psi.pshell.utils.IO;
import ch.psi.pshell.utils.State;
import ch.psi.pshell.swing.SwingUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -87,7 +89,7 @@ public class EnergyScan extends ScriptProcessor {
void updateSeq() {
try {
textFileId.setText(String.valueOf(getContext().getFileSequentialNumber()));
textFileId.setText(String.valueOf(Context.getFileSequentialNumber()));
} catch (Exception ex) {
textFileId.setText("");
}
@@ -163,14 +165,14 @@ public class EnergyScan extends ScriptProcessor {
@Override
protected void onStartingExecution(Map<String, Object> args){
getLogger().warning(this.getFileName());
lastOutput = getContext().getDataManager().getLastOutput();
lastOutput = Context.getDataManager().getLastOutput();
}
@Override
protected void onFinishedExecution(Map<String, Object> args, Object ret, Throwable t){
if (checkAutoSaveArgs.isSelected()) {
//Save scan attributes
String output = getContext().getDataManager().getLastOutput();
String output = Context.getDataManager().getLastOutput();
if ((output != null) && !output.isEmpty() && !output.equals(lastOutput)) {
try {
saveAs(output + "." + FILE_EXTENSION);
@@ -545,7 +547,7 @@ public class EnergyScan extends ScriptProcessor {
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
try {
JFileChooser chooser = new JFileChooser(getContext().getSetup().expandPath(getHomePath()));
JFileChooser chooser = new JFileChooser(Setup.expandPath(getHomePath()));
FileNameExtensionFilter filter = new FileNameExtensionFilter(getDescription(), getExtensions());
chooser.setFileFilter(filter);
try {
@@ -581,7 +583,7 @@ public class EnergyScan extends ScriptProcessor {
private void buttonResetIdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResetIdActionPerformed
try {
this.getContext().setFileSequentialNumber(0);
Context.setFileSequentialNumber(0);
updateSeq();
} catch (Exception ex) {
showException(ex);