V2
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
|
||||
import ch.psi.pshell.framework.Context;
|
||||
import ch.psi.pshell.scan.Scan;
|
||||
import ch.psi.pshell.ui.ScriptProcessor;
|
||||
import ch.psi.utils.EncoderJson;
|
||||
import ch.psi.utils.IO;
|
||||
import ch.psi.utils.State;
|
||||
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 java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
@@ -89,11 +91,11 @@ public class TimeResolved extends ScriptProcessor {
|
||||
public void onTimer() {
|
||||
try{
|
||||
if (isRunning()){
|
||||
Scan scan = getContext().getExecutionPars().getCurrentScan();
|
||||
Scan scan = Context.getExecutionPars().getScan();
|
||||
if (scan!=null){
|
||||
int index = scan.getRecordIndex();
|
||||
textCurScan.setText(String.valueOf(index));
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch(Exception ex){
|
||||
@@ -104,7 +106,7 @@ public class TimeResolved extends ScriptProcessor {
|
||||
|
||||
void updateSeq() {
|
||||
try {
|
||||
textFileId.setText(String.valueOf(getContext().getFileSequentialNumber()));
|
||||
textFileId.setText(String.valueOf(Context.getFileSequentialNumber()));
|
||||
} catch (Exception ex) {
|
||||
textFileId.setText("");
|
||||
}
|
||||
@@ -396,7 +398,7 @@ public class TimeResolved 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);
|
||||
@@ -413,7 +415,7 @@ public class TimeResolved 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 {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
|
||||
import ch.psi.pshell.scan.Scan;
|
||||
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.StandardDialog;
|
||||
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.StandardDialog;
|
||||
import ch.psi.pshell.swing.SwingUtils;
|
||||
import java.awt.Window;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
@@ -179,7 +180,7 @@ public class XPS extends ScriptProcessor {
|
||||
|
||||
void updateSeq() {
|
||||
try {
|
||||
textFileId.setText(String.valueOf(getContext().getFileSequentialNumber()));
|
||||
textFileId.setText(String.valueOf(Context.getFileSequentialNumber()));
|
||||
} catch (Exception ex) {
|
||||
textFileId.setText("");
|
||||
}
|
||||
@@ -268,7 +269,7 @@ public class XPS extends ScriptProcessor {
|
||||
|
||||
|
||||
Map<String, Object> showScientaParametersDialog(Map<String, Object> pars) throws Exception{
|
||||
Class cls = getContext().getClassByName("ScientaParametersDialog");
|
||||
Class cls = Context.getClassByName("ScientaParametersDialog");
|
||||
Constructor constructor= cls.getConstructor(Window.class, boolean.class, Map.class);
|
||||
StandardDialog dlg = (StandardDialog) constructor.newInstance(getWindow(),true, pars);
|
||||
dlg.setVisible(true);
|
||||
@@ -642,7 +643,7 @@ public class XPS 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);
|
||||
@@ -659,7 +660,7 @@ public class XPS 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 {
|
||||
|
||||
Reference in New Issue
Block a user