Update
This commit is contained in:
@@ -46,7 +46,15 @@
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace pref="12" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="168" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="buttonExecShellCmd" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="225" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -71,7 +79,11 @@
|
||||
<Component id="jRadioButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jRadioButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="62" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="buttonExecShellCmd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="35" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
@@ -141,5 +153,18 @@
|
||||
<Property name="text" type="java.lang.String" value="jRadioButton2"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="buttonExecShellCmd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Exec Async"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonExecShellCmdActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Exec Sync"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
* Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
|
||||
*/
|
||||
|
||||
import ch.psi.pshell.core.Context;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import java.awt.Component;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JButton;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -35,6 +39,7 @@ public class PanelPlugin extends Panel {
|
||||
public void setEnabled(boolean value) {
|
||||
super.setEnabled(value);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -49,6 +54,8 @@ public class PanelPlugin extends Panel {
|
||||
jSpinner3 = new javax.swing.JSpinner();
|
||||
jRadioButton1 = new javax.swing.JRadioButton();
|
||||
jRadioButton2 = new javax.swing.JRadioButton();
|
||||
buttonExecShellCmd = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
|
||||
motorPanel2.setDeviceName("m1");
|
||||
|
||||
@@ -74,6 +81,15 @@ public class PanelPlugin extends Panel {
|
||||
buttonGroup1.add(jRadioButton2);
|
||||
jRadioButton2.setText("jRadioButton2");
|
||||
|
||||
buttonExecShellCmd.setText("Exec Async");
|
||||
buttonExecShellCmd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonExecShellCmdActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButton2.setText("Exec Sync");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@@ -97,7 +113,13 @@ public class PanelPlugin extends Panel {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jRadioButton2)
|
||||
.addComponent(jRadioButton1))))
|
||||
.addContainerGap(12, Short.MAX_VALUE))
|
||||
.addContainerGap(168, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButton2)
|
||||
.addComponent(buttonExecShellCmd))
|
||||
.addGap(225, 225, 225))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -118,12 +140,39 @@ public class PanelPlugin extends Panel {
|
||||
.addComponent(jRadioButton1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jRadioButton2)
|
||||
.addContainerGap(62, Short.MAX_VALUE))
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(buttonExecShellCmd)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jButton2)
|
||||
.addContainerGap(35, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonExecShellCmdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExecShellCmdActionPerformed
|
||||
try {
|
||||
String shellCommand="sleep 5; uname";
|
||||
boolean background = false;
|
||||
|
||||
evalAsync("exec_cmd('" + shellCommand + "')", background).handle((ret,ex)->{
|
||||
((JButton)evt.getSource()).setEnabled(true);
|
||||
if (ex!=null){
|
||||
showException((Exception)ex);
|
||||
} else {
|
||||
getContext().scriptingLog(String.format("Shell command '%s' return value: %s", shellCommand, String.valueOf(ret)));
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
((JButton)evt.getSource()).setEnabled(false);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonExecShellCmdActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonExecShellCmd;
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JRadioButton jRadioButton1;
|
||||
private javax.swing.JRadioButton jRadioButton2;
|
||||
private javax.swing.JSpinner jSpinner1;
|
||||
|
||||
@@ -623,7 +623,7 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="checkAveraging" min="-2" max="-2" attributes="0"/>
|
||||
@@ -658,23 +658,24 @@
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="2" pref="2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="spinnerGrThreshold" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerGrScale" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerThreshold" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationOrder" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationMode" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationAngle" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationConstant" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerAvFrames" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="spinnerAvMode" linkSize="8" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="checkBackground" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="spinnerGrThreshold" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerGrScale" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerThreshold" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationOrder" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationMode" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationAngle" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerRotationConstant" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerAvFrames" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerAvMode" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="spinnerBackground" linkSize="8" alignment="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
@@ -683,7 +684,10 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="checkBackground" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="checkBackground" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerBackground" linkSize="11" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="checkThreshold" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@@ -692,12 +696,12 @@
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="checkAveraging" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerAvFrames" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerAvFrames" linkSize="11" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelAvFrames" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="spinnerAvMode" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spinnerAvMode" linkSize="11" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="labelAvMode" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
@@ -987,6 +991,7 @@
|
||||
<ListItem value="nearest"/>
|
||||
<ListItem value="mirror"/>
|
||||
<ListItem value="wrap"/>
|
||||
<ListItem value="ortho"/>
|
||||
</SpinnerModel>
|
||||
</Property>
|
||||
</Properties>
|
||||
@@ -1059,6 +1064,20 @@
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerAvModeonChange"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spinnerBackground">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel type="list">
|
||||
<ListItem value="normal"/>
|
||||
<ListItem value="signed"/>
|
||||
<ListItem value="passive"/>
|
||||
</SpinnerModel>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="spinnerBackgroundStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
|
||||
@@ -93,13 +93,10 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
@@ -107,6 +104,7 @@ import javax.swing.JSpinner;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
@@ -154,11 +152,13 @@ public class ScreenPanel7 extends Panel {
|
||||
String camServerUrl;
|
||||
String instanceName;
|
||||
Overlay titleOv = null;
|
||||
Overlay backgOv = null;
|
||||
//int integration = 0;
|
||||
boolean persistCameraState;
|
||||
Map<String, List<String>> groups;
|
||||
Map<String, String> aliases;
|
||||
final Logger logger;
|
||||
List<String> types;
|
||||
|
||||
public class CameraState extends Config {
|
||||
|
||||
@@ -392,6 +392,7 @@ public class ScreenPanel7 extends Panel {
|
||||
logger = Logger.getLogger(getClass().getName());
|
||||
try {
|
||||
initComponents();
|
||||
spinnerBackground.setVisible(false);
|
||||
spinnerThreshold.setVisible(false);
|
||||
btFixColormapRange.setVisible(false);
|
||||
setGoodRegionOptionsVisible(false);
|
||||
@@ -407,10 +408,18 @@ public class ScreenPanel7 extends Panel {
|
||||
setPersistedComponents(new Component[]{buttonTitle});
|
||||
comboCameras.setEnabled(false);
|
||||
comboType.setEnabled(false);
|
||||
if (App.hasArgument(ARG_LIST) || App.hasArgument(ARG_TYPE)){
|
||||
if (App.hasArgument(ARG_LIST)){
|
||||
comboType.setVisible(false);
|
||||
labelType.setVisible(false);
|
||||
}
|
||||
if (App.hasArgument(ARG_TYPE)){
|
||||
types = new ArrayList<>();
|
||||
for (String token : App.getArgumentValue(ARG_TYPE).split(",")){
|
||||
if (!token.isBlank()){
|
||||
types.add(token.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SwingUtils.setEnumCombo(comboColormap, Colormap.class);
|
||||
if (App.hasArgument("poll")) {
|
||||
@@ -821,21 +830,28 @@ public class ScreenPanel7 extends Panel {
|
||||
);
|
||||
|
||||
} else {
|
||||
String[] types = new String[]{"All"};
|
||||
try (CameraServer srv = newCameraServer()) {
|
||||
groups = srv.getCameraGroups();
|
||||
comboType.setModel(new javax.swing.DefaultComboBoxModel(Arr.insert(Arr.sort(groups.keySet().toArray(new String[0])), "All", 0)));
|
||||
groups = srv.getCameraGroups();
|
||||
types = Arr.insert(Arr.sort(groups.keySet().toArray(new String[0])), "All", 0);
|
||||
aliases = srv.getCameraAliases();
|
||||
} catch (Exception ex){
|
||||
groups = null;
|
||||
aliases = null;
|
||||
}
|
||||
if (this.types!=null){
|
||||
types = this.types.toArray(new String[0]);
|
||||
}
|
||||
comboType.setModel(new javax.swing.DefaultComboBoxModel(types));
|
||||
|
||||
usingServer = buttonServer.isSelected();
|
||||
updateCameraList();
|
||||
comboCameras.setEnabled(true);
|
||||
comboType.setEnabled(true);
|
||||
setComboCameraSelection(null);
|
||||
setComboTypeSelection("All");
|
||||
if (Arr.containsEqual(types, "All")){
|
||||
setComboTypeSelection("All");
|
||||
}
|
||||
updateCameraList();
|
||||
|
||||
if (comboCameras.getModel().getSize() > 0) {
|
||||
try {
|
||||
@@ -853,10 +869,7 @@ public class ScreenPanel7 extends Panel {
|
||||
}
|
||||
|
||||
boolean isVisible(String camera) {
|
||||
if (App.hasArgument(ARG_TYPE)){
|
||||
return getCameraTypes(camera).contains(App.getArgumentValue(ARG_TYPE));
|
||||
}
|
||||
return ((comboType.getSelectedIndex() == 0) || (getCameraTypes(camera).contains(comboType.getSelectedItem())));
|
||||
return ((comboType.getSelectedItem().toString().toLowerCase().equals("all")) || (getCameraTypes(camera).contains(comboType.getSelectedItem())));
|
||||
}
|
||||
|
||||
DefaultComboBoxModel getCameraList(boolean fromServer) throws Exception {
|
||||
@@ -1006,11 +1019,31 @@ public class ScreenPanel7 extends Panel {
|
||||
}
|
||||
|
||||
synchronized (lockOverlays) {
|
||||
renderer.updateOverlays(to, titleOv);
|
||||
renderer.updateOverlays(to, titleOv);
|
||||
titleOv = to;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void manageOverlayErrorOverlay(boolean error) {
|
||||
if ((error) != (backgOv != null)){
|
||||
|
||||
Overlay bo = null;
|
||||
if (error){
|
||||
String text = "Invalid image background";
|
||||
Font font = new Font("Arial", Font.PLAIN, 14);
|
||||
bo = new Text(renderer.getPenErrorText(), text, font, new Point(-SwingUtils.getTextSize(text, renderer.getGraphics().getFontMetrics(font)).width - 14, 46));
|
||||
bo.setFixed(true);
|
||||
bo.setAnchor(Overlay.ANCHOR_VIEWPORT_OR_IMAGE_TOP_RIGHT);
|
||||
}
|
||||
synchronized (lockOverlays) {
|
||||
renderer.updateOverlays(bo,backgOv);
|
||||
backgOv = bo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStateChange(State state, State former) {
|
||||
|
||||
@@ -1076,6 +1109,7 @@ public class ScreenPanel7 extends Panel {
|
||||
this.cameraName = cameraName;
|
||||
|
||||
if (changed || buttonDirect.isSelected()) {
|
||||
spinnerBackground.setVisible(false);
|
||||
spinnerThreshold.setVisible(false);
|
||||
checkThreshold.setEnabled(false);
|
||||
checkRotation.setEnabled(false);
|
||||
@@ -1524,11 +1558,31 @@ public class ScreenPanel7 extends Panel {
|
||||
btFixColormapRange.setVisible(buttonAutomatic.isSelected());
|
||||
spinnerMin.setEnabled(buttonManual.isSelected());
|
||||
spinnerMax.setEnabled(buttonManual.isSelected());
|
||||
|
||||
boolean signed = spinnerBackground.isVisible() && "signed".equals(spinnerBackground.getValue());
|
||||
Integer min = signed ? -65535: 0;
|
||||
if (!min.equals(((SpinnerNumberModel)spinnerMin.getModel()).getMinimum())){
|
||||
spinnerMin.setModel(new SpinnerNumberModel(0, min.intValue(), 65535, 1));
|
||||
spinnerMax.setModel(new SpinnerNumberModel(255, min.intValue(), 65535, 1));
|
||||
if ((Integer)((SpinnerNumberModel)spinnerMin.getModel()).getValue() < min){
|
||||
spinnerMin.setValue(min);
|
||||
}
|
||||
if ((Integer)((SpinnerNumberModel)spinnerMax.getModel()).getValue() < min){
|
||||
spinnerMax.setValue(min);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Double.isNaN(config.colormapMin)) {
|
||||
spinnerMin.setValue(Math.min(Math.max((int) config.colormapMin, 0), 65535));
|
||||
Integer value = Math.min(Math.max((int) config.colormapMin, min), 65535);
|
||||
if (spinnerMin.getModel().getValue()!= value){
|
||||
spinnerMin.setValue(value);
|
||||
}
|
||||
}
|
||||
if (!Double.isNaN(config.colormapMax)) {
|
||||
spinnerMax.setValue(Math.min(Math.max((int) config.colormapMax, 0), 65535));
|
||||
Integer value = Math.min(Math.max((int) config.colormapMax, min), 65535);
|
||||
if (spinnerMax.getModel().getValue()!= value){
|
||||
spinnerMax.setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -1539,6 +1593,7 @@ public class ScreenPanel7 extends Panel {
|
||||
|
||||
void updatePipelineProperties() {
|
||||
goodRegion = checkGoodRegion.isSelected();
|
||||
spinnerBackground.setVisible(checkBackground.isSelected());
|
||||
spinnerThreshold.setVisible(checkThreshold.isSelected());
|
||||
setGoodRegionOptionsVisible(goodRegion);
|
||||
slicing = goodRegion && checkSlicing.isSelected();
|
||||
@@ -1557,7 +1612,14 @@ public class ScreenPanel7 extends Panel {
|
||||
updatingServerControls = true;
|
||||
if (server.isStarted()) {
|
||||
try {
|
||||
checkBackground.setSelected(server.getBackgroundSubtraction());
|
||||
checkBackground.setSelected(server.isBackgroundSubtractionEnabled());
|
||||
setBackgoundControl(server.getBackgroundSubtraction());
|
||||
Object bg = server.getBackgroundSubtraction();
|
||||
if (bg.equals("signed") || bg.equals("passive")){
|
||||
spinnerBackground.setValue(bg);
|
||||
} else {
|
||||
spinnerBackground.setValue("normal");
|
||||
}
|
||||
Double threshold = (server.getThreshold());
|
||||
checkThreshold.setSelected(threshold != null);
|
||||
spinnerThreshold.setValue((threshold == null) ? 0 : threshold);
|
||||
@@ -1607,7 +1669,7 @@ public class ScreenPanel7 extends Panel {
|
||||
|
||||
boolean changedPipelinePars(Map pars1, Map pars2) {
|
||||
String[] keys = new String[]{"image_background_enable", "image_threshold", "image_good_region",
|
||||
"threshold", "gfscale", "image_slices", "number_of_slices", "scale", "orientation"};
|
||||
"threshold", "gfscale", "image_slices", "number_of_slices", "scale", "orientation", "image_background_ok"};
|
||||
for (String key : keys) {
|
||||
Object o1 = pars1.get(key);
|
||||
Object o2 = pars2.get(key);
|
||||
@@ -1621,13 +1683,21 @@ public class ScreenPanel7 extends Panel {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void setBackgoundControl(Object background){
|
||||
spinnerBackground.setValue((background.equals("signed") || background.equals("passive")) ? background : "normal");
|
||||
}
|
||||
|
||||
void updatePipelineControls(Map pars) {
|
||||
if (pars != null) {
|
||||
updatingServerControls = true;
|
||||
try {
|
||||
boolean background = (boolean) pars.get("image_background_enable");
|
||||
checkBackground.setSelected(background);
|
||||
Object background = pars.get("image_background_enable");
|
||||
checkBackground.setSelected(!background.equals("") && !background.equals(false) && !background.equals("false"));
|
||||
setBackgoundControl(background);
|
||||
|
||||
manageOverlayErrorOverlay(Boolean.FALSE.equals(pars.get("image_background_ok")));
|
||||
|
||||
Double threshold = (Double) (pars.get("image_threshold"));
|
||||
checkThreshold.setSelected(threshold != null);
|
||||
spinnerThreshold.setValue((threshold == null) ? 0 : threshold);
|
||||
@@ -2357,13 +2427,17 @@ public class ScreenPanel7 extends Panel {
|
||||
|
||||
boolean getLaserState(int bunch) throws Exception {
|
||||
//return (Epics.get("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", Integer.class) == 0);
|
||||
if (bunch<=0){
|
||||
return getLaserState(1) && getLaserState(2);
|
||||
try{
|
||||
if (bunch<=0){
|
||||
return getLaserState(1) && getLaserState(2);
|
||||
}
|
||||
if (bunch==2){
|
||||
return (Epics.get("SWISSFEL-STATUS:Bunch-2-OnDelay-Sel", Integer.class) == 0);
|
||||
}
|
||||
return (Epics.get("SWISSFEL-STATUS:Bunch-1-OnDelay-Sel", Integer.class) == 0);
|
||||
} catch (Exception ex){
|
||||
return false;
|
||||
}
|
||||
if (bunch==2){
|
||||
return (Epics.get("SWISSFEL-STATUS:Bunch-2-OnDelay-Sel", Integer.class) == 0);
|
||||
}
|
||||
return (Epics.get("SWISSFEL-STATUS:Bunch-1-OnDelay-Sel", Integer.class) == 0);
|
||||
}
|
||||
|
||||
void elog(String logbook, String title, String message, String[] attachments) throws Exception {
|
||||
@@ -3016,6 +3090,7 @@ public class ScreenPanel7 extends Panel {
|
||||
labelAvFrames = new javax.swing.JLabel();
|
||||
labelAvMode = new javax.swing.JLabel();
|
||||
spinnerAvMode = new javax.swing.JSpinner();
|
||||
spinnerBackground = new javax.swing.JSpinner();
|
||||
topPanel = new javax.swing.JPanel();
|
||||
toolBar = new javax.swing.JToolBar();
|
||||
buttonSidePanel = new javax.swing.JToggleButton();
|
||||
@@ -3542,7 +3617,7 @@ public class ScreenPanel7 extends Panel {
|
||||
labelMode.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
labelMode.setText("Mode:");
|
||||
|
||||
spinnerRotationMode.setModel(new javax.swing.SpinnerListModel(new String[] {"constant", "reflect", "nearest", "mirror", "wrap"}));
|
||||
spinnerRotationMode.setModel(new javax.swing.SpinnerListModel(new String[] {"constant", "reflect", "nearest", "mirror", "wrap", "ortho"}));
|
||||
spinnerRotationMode.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerRotationAngleStateChanged(evt);
|
||||
@@ -3589,6 +3664,13 @@ public class ScreenPanel7 extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
spinnerBackground.setModel(new javax.swing.SpinnerListModel(new String[] {"normal", "signed", "passive"}));
|
||||
spinnerBackground.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerBackgroundStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout panelScreen2Layout = new javax.swing.GroupLayout(panelScreen2);
|
||||
panelScreen2.setLayout(panelScreen2Layout);
|
||||
panelScreen2Layout.setHorizontalGroup(
|
||||
@@ -3622,30 +3704,33 @@ public class ScreenPanel7 extends Panel {
|
||||
.addComponent(labelConstant, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(labelMode, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(labelGrThreshold, javax.swing.GroupLayout.Alignment.TRAILING))))
|
||||
.addGap(2, 2, 2)
|
||||
.addGroup(panelScreen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(spinnerGrThreshold, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerGrScale)
|
||||
.addComponent(spinnerThreshold)
|
||||
.addComponent(spinnerRotationOrder)
|
||||
.addComponent(spinnerRotationMode)
|
||||
.addComponent(spinnerRotationAngle)
|
||||
.addComponent(spinnerRotationConstant)
|
||||
.addComponent(spinnerAvFrames)
|
||||
.addComponent(spinnerAvMode)))
|
||||
.addGap(2, 2, 2))
|
||||
.addGroup(panelScreen2Layout.createSequentialGroup()
|
||||
.addComponent(checkBackground)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(panelScreen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(spinnerGrThreshold, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(spinnerGrScale, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerThreshold, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerRotationOrder, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerRotationMode, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerRotationAngle, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerRotationConstant, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerAvFrames, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerAvMode, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(spinnerBackground, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelScreen2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerAvFrames, spinnerAvMode, spinnerGrScale, spinnerGrThreshold, spinnerRotationAngle, spinnerRotationConstant, spinnerRotationMode, spinnerRotationOrder, spinnerThreshold});
|
||||
panelScreen2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {spinnerAvFrames, spinnerAvMode, spinnerBackground, spinnerGrScale, spinnerGrThreshold, spinnerRotationAngle, spinnerRotationConstant, spinnerRotationMode, spinnerRotationOrder, spinnerThreshold});
|
||||
|
||||
panelScreen2Layout.setVerticalGroup(
|
||||
panelScreen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelScreen2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(checkBackground)
|
||||
.addGroup(panelScreen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(checkBackground)
|
||||
.addComponent(spinnerBackground, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(2, 2, 2)
|
||||
.addGroup(panelScreen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(checkThreshold)
|
||||
@@ -3690,7 +3775,7 @@ public class ScreenPanel7 extends Panel {
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
panelScreen2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerGrScale, spinnerGrThreshold, spinnerRotationAngle, spinnerRotationConstant, spinnerRotationMode, spinnerRotationOrder, spinnerThreshold});
|
||||
panelScreen2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {spinnerAvFrames, spinnerAvMode, spinnerBackground, spinnerGrScale, spinnerGrThreshold, spinnerRotationAngle, spinnerRotationConstant, spinnerRotationMode, spinnerRotationOrder, spinnerThreshold});
|
||||
|
||||
javax.swing.GroupLayout sidePanelLayout = new javax.swing.GroupLayout(sidePanel);
|
||||
sidePanel.setLayout(sidePanelLayout);
|
||||
@@ -4161,7 +4246,9 @@ public class ScreenPanel7 extends Panel {
|
||||
if (!updatingServerControls) {
|
||||
try {
|
||||
if (server.isStarted()) {
|
||||
server.setBackgroundSubtraction(checkBackground.isSelected());
|
||||
spinnerBackground.setVisible(checkBackground.isSelected());
|
||||
Object bg_mode = checkBackground.isSelected() ? String.valueOf(spinnerBackground.getValue()) : false;
|
||||
server.setBackgroundSubtraction(bg_mode.equals("normal") ? true : bg_mode);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
@@ -4531,6 +4618,18 @@ public class ScreenPanel7 extends Panel {
|
||||
checkAveragingActionPerformed(null);
|
||||
}//GEN-LAST:event_spinnerAvFramesStateChanged
|
||||
|
||||
private void spinnerBackgroundStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerBackgroundStateChanged
|
||||
if (!updatingServerControls) {
|
||||
try {
|
||||
Object bg_mode = String.valueOf(spinnerBackground.getValue());
|
||||
server.setBackgroundSubtraction((bg_mode=="normal") ? true : bg_mode);
|
||||
} catch (Exception ex) {
|
||||
showException(ex);
|
||||
updatePipelineControls();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_spinnerBackgroundStateChanged
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btFixColormapRange;
|
||||
private javax.swing.JRadioButton buttonAutomatic;
|
||||
@@ -4604,6 +4703,7 @@ public class ScreenPanel7 extends Panel {
|
||||
private javax.swing.JPanel sidePanel;
|
||||
private javax.swing.JSpinner spinnerAvFrames;
|
||||
private javax.swing.JSpinner spinnerAvMode;
|
||||
private javax.swing.JSpinner spinnerBackground;
|
||||
private javax.swing.JSpinner spinnerGrScale;
|
||||
private javax.swing.JSpinner spinnerGrThreshold;
|
||||
private javax.swing.JSpinner spinnerMax;
|
||||
|
||||
1380
plugins/ScreenPanel8.form
Normal file
1380
plugins/ScreenPanel8.form
Normal file
File diff suppressed because it is too large
Load Diff
4737
plugins/ScreenPanel8.java
Normal file
4737
plugins/ScreenPanel8.java
Normal file
File diff suppressed because it is too large
Load Diff
1444
plugins/ScreenPanel9.form
Normal file
1444
plugins/ScreenPanel9.form
Normal file
File diff suppressed because it is too large
Load Diff
4898
plugins/ScreenPanel9.java
Normal file
4898
plugins/ScreenPanel9.java
Normal file
File diff suppressed because it is too large
Load Diff
2
plugins/filelisting.txt
Normal file
2
plugins/filelisting.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
gobbo_a/0067_unnamed/20210126/20210126_101140_TestAddSession.h5
|
||||
test/out.h5
|
||||
1
plugins/metadata.json
Normal file
1
plugins/metadata.json
Normal file
@@ -0,0 +1 @@
|
||||
{"sourceFolder":"/Users/gobbo_a/dev/pshell/config/home/data","isPublished":true,"dataFormat":"h5","ownerGroup":"p0001","datasetName":"67_unnamed","description":"unnamed","endTime":"2021-01-26T10:15:08.272Z","scientificMetadata":{"detectorParameters":{"Objective":20,"Scintillator":"LAG 20um","Exposure time":{"u":"s","v":0.4}},"scanParameters":{"Number of flats":120,"Rot Y min position":{"u":"deg","v":0},"Angular step":{"u":"deg","v":0.1},"Number of projections":1801,"File Prefix":"817b_B2_","Rot Y max position":{"u":"deg","v":180},"Flat frequency":0,"Number of darks":10,"Number of inter-flats":0,"Sample In":{"u":"m","v":0},"Inner scan flag":0,"Sample Out":{"u":"m","v":-0.005}},"beamlineParameters":{"Beam energy":{"u":"eV","v":22595},"Ring current":{"u":"A","v":0.402246},"Monostripe":"Ru/C"},"Bool":true,"Sample":"MySample","Authors":[],"Proposer":"Alex","Real":3.14,"beamlineState":{"inp":0.0,"sin":0.0},"beamlineState2":"{inp=0.0, sin=0.0}","scientificMetadata2":"{detectorParameters={Objective=20, Scintillator=LAG 20um, Exposure time={u=s, v=0.4}}, scanParameters={Number of flats=120, Rot Y min position={u=deg, v=0}, Angular step={u=deg, v=0.1}, Number of projections=1801, File Prefix=817b_B2_, Rot Y max position={u=deg, v=180}, Flat frequency=0, Number of darks=10, Number of inter-flats=0, Sample In={u=m, v=0}, Inner scan flag=0, Sample Out={u=m, v=-0.005}}, beamlineParameters={Beam energy={u=eV, v=22595}, Ring current={u=A, v=0.402246}, Monostripe=Ru/C}}","Map":{},"Int":3,"Proposal":"Test","P-group":"P001"},"type":"raw","creationLocation":"/PSI/SLS/SIM","principalInvestigator":"alexgobbo@gmail.com"}
|
||||
Reference in New Issue
Block a user