Closedown
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import ch.psi.pshell.device.Motor;
|
||||
import ch.psi.pshell.epics.Scienta;
|
||||
import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.pshell.ui.ScriptProcessor;
|
||||
import ch.psi.utils.State;
|
||||
import ch.psi.utils.swing.SwingUtils;
|
||||
import java.awt.Component;
|
||||
@@ -12,6 +12,7 @@ import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JSpinner;
|
||||
@@ -21,7 +22,7 @@ import javax.swing.SpinnerNumberModel;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ManipulatorScan extends Panel {
|
||||
public class ManipulatorScan extends ScriptProcessor {
|
||||
|
||||
public ManipulatorScan() {
|
||||
initComponents();
|
||||
@@ -91,7 +92,13 @@ public class ManipulatorScan extends Panel {
|
||||
buttonScientaSetup.setEnabled(value);
|
||||
}
|
||||
|
||||
void startScan() throws Exception {
|
||||
@Override
|
||||
public String getScript() {
|
||||
return "ManipulatorScan";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getArgs() {
|
||||
HashMap<String, Object> args = new HashMap<>();
|
||||
args.put("MOTOR", comboMotor.getSelectedItem().toString());
|
||||
ArrayList<String> sensors = new ArrayList();
|
||||
@@ -117,44 +124,8 @@ public class ManipulatorScan extends Panel {
|
||||
args.put("RELATIVE", radioRelative.isSelected());
|
||||
args.put("ENDSCAN", checkEndScan.isSelected());
|
||||
args.put("FLY_SCAN", checkFlyScan.isSelected());
|
||||
|
||||
runAsync("ManipulatorScan", args);
|
||||
|
||||
/*
|
||||
getContext().setExecutionPars("manip_scan");
|
||||
String scan ="lscan(" + comboMotor.getSelectedItem().toString() + ", ( " ;
|
||||
for (Component c : panelSensors.getComponents()) {
|
||||
if ((c instanceof JCheckBox) && ((JCheckBox)c).isSelected())
|
||||
scan += c.getName() + ", ";
|
||||
}
|
||||
scan+="), ";
|
||||
if (radioRelative.isSelected()){
|
||||
double halfRange = (Double)spinnerRange.getValue()/2;
|
||||
scan+= (-halfRange) + ", " + (halfRange)+ ", ";
|
||||
} else {
|
||||
Double from = (Double)spinnerFrom.getValue();
|
||||
Double to = (Double)spinnerTo.getValue();
|
||||
|
||||
if (to <= from){
|
||||
throw new Exception ("Invalid range");
|
||||
}
|
||||
scan+= from + ", " + to + ", ";
|
||||
}
|
||||
|
||||
scan+= (radioStepSize.isSelected()) ? "(" +((Double)spinnerStepSize.getValue())+",)" :((Integer)spinnerSteps.getValue());
|
||||
scan+=", " + (Double)spinnerLatency.getValue() + ", ";
|
||||
if (radioRelative.isSelected()){
|
||||
scan+="True, "; //Relative
|
||||
}
|
||||
scan+="before_read=trig_scienta)"; //Relative
|
||||
|
||||
if (checkImageIntegration.isSelected()){
|
||||
scan = "set_preference(Preference.PLOT_TYPES,{'integration':1}); " + scan;
|
||||
}
|
||||
|
||||
evalAsync(scan);
|
||||
*/
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
@@ -207,6 +178,7 @@ public class ManipulatorScan extends Panel {
|
||||
labelTotalTime = new javax.swing.JLabel();
|
||||
labelAcqTime = new javax.swing.JLabel();
|
||||
dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
buttonQueue = new javax.swing.JButton();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(792, 567));
|
||||
|
||||
@@ -381,7 +353,7 @@ public class ManipulatorScan extends Panel {
|
||||
.addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(spinnerLatency, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE)
|
||||
.addComponent(checkFlyScan)
|
||||
.addGap(26, 26, 26))
|
||||
);
|
||||
@@ -527,6 +499,13 @@ public class ManipulatorScan extends Panel {
|
||||
labelAcqTime.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
|
||||
labelAcqTime.setText("Acquisition time(s):");
|
||||
|
||||
buttonQueue.setText("Queue");
|
||||
buttonQueue.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonQueueActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
|
||||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
@@ -548,7 +527,8 @@ public class ManipulatorScan extends Panel {
|
||||
.addGap(1, 1, 1))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
|
||||
.addComponent(checkEndScan)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
@@ -563,7 +543,9 @@ public class ManipulatorScan extends Panel {
|
||||
.addComponent(buttonStart)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(buttonAbort)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(buttonQueue)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(labelAcqTime)
|
||||
.addComponent(dvpAcqTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
@@ -571,7 +553,7 @@ public class ManipulatorScan extends Panel {
|
||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(labelTotalTime)
|
||||
.addComponent(textTotalTime))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(checkEndScan)
|
||||
.addGap(26, 26, 26))
|
||||
);
|
||||
@@ -616,7 +598,7 @@ public class ManipulatorScan extends Panel {
|
||||
|
||||
private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed
|
||||
try {
|
||||
startScan();
|
||||
execute();
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
@@ -660,10 +642,19 @@ public class ManipulatorScan extends Panel {
|
||||
setEnabled(isEnabled());
|
||||
}//GEN-LAST:event_radioAbsoluteActionPerformed
|
||||
|
||||
private void buttonQueueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonQueueActionPerformed
|
||||
try {
|
||||
queue();
|
||||
} catch (Exception ex) {
|
||||
SwingUtils.showException(this, ex);
|
||||
}
|
||||
}//GEN-LAST:event_buttonQueueActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton buttonAbort;
|
||||
private javax.swing.ButtonGroup buttonGroup1;
|
||||
private javax.swing.ButtonGroup buttonGroup2;
|
||||
private javax.swing.JButton buttonQueue;
|
||||
private javax.swing.JButton buttonScientaSetup;
|
||||
private javax.swing.JButton buttonStart;
|
||||
private javax.swing.JCheckBox checkAngleDistribution;
|
||||
|
||||
Reference in New Issue
Block a user