This commit is contained in:
sfop
2016-12-16 08:33:18 +01:00
parent bab567fbfd
commit 4f1850787c
7 changed files with 40 additions and 29 deletions

View File

@@ -2,7 +2,7 @@
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
*/
import ch.psi.pshell.core.Controller;
import ch.psi.pshell.core.Context;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
@@ -104,7 +104,7 @@ public class ScreenPanel extends Panel {
public ScreenPanel() {
initComponents();
renderer.setPersistenceFile(Paths.get(getController().getSetup().getContextPath(), "Renderer_Cameras.bin"));
renderer.setPersistenceFile(Paths.get(getContext().getSetup().getContextPath(), "Renderer_Cameras.bin"));
setPersistedComponents(new Component[]{buttonCamtool, buttonDirect});
comboCameras.setEnabled(false);
if (App.hasArgument("poll")) {
@@ -943,7 +943,7 @@ public class ScreenPanel extends Panel {
}
double[] fitGaussianScript(int[] y, int[] x) {
ScriptManager sm = Controller.getInstance().getScriptManager();
ScriptManager sm = Context.getInstance().getScriptManager();
ArrayProperties pY = ArrayProperties.get(y);
sm.setVar("y", y);
sm.setVar("x", x);
@@ -2052,21 +2052,21 @@ public class ScreenPanel extends Panel {
private void buttonSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveActionPerformed
try {
String snapshotFile = getController().getSetup().expandPath("{images}/snapshot.png");
String snapshotFile = getContext().getSetup().expandPath("{images}/snapshot.png");
renderer.saveSnapshot(snapshotFile, "png", true);
getController().setExecutionContext("snapshot", null, null, null, null, null, null, null);
getController().getDataManager().setDataset("/data", renderer.getData().getMatrix(), renderer.getData().isUnsigned());
getController().getDataManager().closeOutput();
getContext().setExecutionContext("snapshot", null, null, null, null, null, null, null);
getContext().getDataManager().setDataset("/data", renderer.getData().getMatrix(), renderer.getData().isUnsigned());
getContext().getDataManager().closeOutput();
StringBuilder message = new StringBuilder();
message.append("Camera: ").append(cameraName).append(" (").
append((camera instanceof Camtool) ? "camtool" : "direct").append(")").append("\n");
message.append("Data file: ").append(getController().getExecutionContext().getPath()).append("\n");
message.append("Data file: ").append(getContext().getExecutionContext().getPath()).append("\n");
if ((fitOv != null) && (fitOv.length > 3)) {
Overlays.Text text = (Overlays.Text) fitOv[3];
message.append(text.getText()).append("\n");
}
elog("ScreenPanel Snapshot", message.toString(), new String[]{snapshotFile});
SwingUtils.showMessage(getTopLevel(), "Success", "Generated data file:\n" + getController().getExecutionContext().getPath(), 5000);
SwingUtils.showMessage(getTopLevel(), "Success", "Generated data file:\n" + getContext().getExecutionContext().getPath(), 5000);
} catch (Exception ex) {
ex.printStackTrace();