diff --git a/config/variables.properties b/config/variables.properties index ebe26161..b354c4b0 100644 --- a/config/variables.properties +++ b/config/variables.properties @@ -1,4 +1,4 @@ -#Wed Jul 13 05:17:27 CEST 2022 -LastRunDate=220713 -FileSequentialNumber=13533 +#Thu Aug 04 16:14:10 CEST 2022 +LastRunDate=220804 +FileSequentialNumber=13546 DaySequentialNumber=13 diff --git a/plugins/HoloScan.form b/plugins/HoloScan.form index 6b555c44..2ce702e5 100644 --- a/plugins/HoloScan.form +++ b/plugins/HoloScan.form @@ -72,7 +72,7 @@ - + @@ -189,7 +189,7 @@ - + @@ -357,7 +357,7 @@ - + @@ -541,12 +541,13 @@ - + + @@ -559,7 +560,9 @@ - + + + @@ -569,7 +572,7 @@ - + @@ -622,6 +625,14 @@ + + + + + + + + diff --git a/plugins/HoloScan.java b/plugins/HoloScan.java index e07c0a03..fe30a5b0 100644 --- a/plugins/HoloScan.java +++ b/plugins/HoloScan.java @@ -7,6 +7,7 @@ import ch.psi.pshell.device.DeviceAdapter; 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; @@ -14,6 +15,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.JSpinner; import javax.swing.JToggleButton; @@ -22,7 +24,7 @@ import javax.swing.SpinnerNumberModel; /** * */ -public class HoloScan extends Panel { +public class HoloScan extends ScriptProcessor { public HoloScan() { initComponents(); @@ -115,8 +117,14 @@ public class HoloScan extends Panel { buttonScientaSetup.setEnabled(value); } + + @Override + public String getScript() { + return "HoloScan"; + } - void startScan() throws Exception{ + @Override + public Map getArgs() { HashMap args = new HashMap<>(); ArrayList sensors = new ArrayList(); for (Component c : panelSensors.getComponents()) { @@ -139,10 +147,9 @@ public class HoloScan extends Panel { args.put("LATENCY", (Double) 0.0); args.put("RELATIVE", false); args.put("ZIGZAG", checkZigzag.isSelected()); - args.put("ENDSCAN", checkEndScan.isSelected()); - - runAsync("HoloScan", args); - } + args.put("ENDSCAN", checkEndScan.isSelected()); + return args; + } @SuppressWarnings("unchecked") @@ -198,6 +205,7 @@ public class HoloScan extends Panel { dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel(); labelTotalTime = new javax.swing.JLabel(); textTotalTime = new javax.swing.JLabel(); + buttonQueue = new javax.swing.JButton(); panelPositioners.setBorder(javax.swing.BorderFactory.createTitledBorder("Positioners")); panelPositioners.setPreferredSize(new java.awt.Dimension(248, 543)); @@ -273,7 +281,7 @@ public class HoloScan extends Panel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(motorPanelPhi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup() - .addGap(0, 32, Short.MAX_VALUE) + .addGap(0, 36, Short.MAX_VALUE) .addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionersLayout.createSequentialGroup() .addGroup(panelPositionersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -371,7 +379,7 @@ public class HoloScan extends Panel { .addComponent(jLabel14)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(checkZigzag) - .addContainerGap(103, Short.MAX_VALUE)) + .addContainerGap(99, Short.MAX_VALUE)) ); panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors")); @@ -440,7 +448,7 @@ public class HoloScan extends Panel { .addGroup(panelSensorsLayout.createSequentialGroup() .addContainerGap() .addGroup(panelSensorsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(buttonScientaSetup, javax.swing.GroupLayout.DEFAULT_SIZE, 212, Short.MAX_VALUE) + .addComponent(buttonScientaSetup, javax.swing.GroupLayout.DEFAULT_SIZE, 208, Short.MAX_VALUE) .addComponent(checkImage) .addComponent(checkImageIntegration) .addComponent(checkSpectrum) @@ -518,6 +526,13 @@ public class HoloScan extends Panel { textTotalTime.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); textTotalTime.setBorder(javax.swing.BorderFactory.createTitledBorder("")); + buttonQueue.setText("Queue"); + buttonQueue.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + buttonQueueActionPerformed(evt); + } + }); + javax.swing.GroupLayout panelScanLayout = new javax.swing.GroupLayout(panelScan); panelScan.setLayout(panelScanLayout); panelScanLayout.setHorizontalGroup( @@ -535,10 +550,11 @@ public class HoloScan extends Panel { .addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textTotalTime, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(0, 1, Short.MAX_VALUE)) + .addGap(0, 6, Short.MAX_VALUE)) .addGroup(panelScanLayout.createSequentialGroup() .addComponent(checkEndScan) - .addGap(53, 53, 53))) + .addGap(53, 53, 53)) + .addComponent(buttonQueue, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -553,7 +569,9 @@ public class HoloScan extends Panel { .addComponent(buttonStart) .addGap(18, 18, 18) .addComponent(buttonAbort) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 170, 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(panelScanLayout.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)) @@ -561,7 +579,7 @@ public class HoloScan extends Panel { .addGroup(panelScanLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) .addComponent(textTotalTime) .addComponent(labelTotalTime)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 168, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(checkEndScan) .addGap(26, 26, 26)) ); @@ -606,7 +624,7 @@ public class HoloScan extends Panel { private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed try{ - startScan(); + execute(); } catch (Exception ex){ SwingUtils.showException(this, ex); } @@ -625,10 +643,19 @@ public class HoloScan extends Panel { setEnabled(isEnabled()); }//GEN-LAST:event_radioStepSizeActionPerformed + 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; diff --git a/plugins/ManipulatorScan.form b/plugins/ManipulatorScan.form index 5ff6c684..bc64b7bf 100644 --- a/plugins/ManipulatorScan.form +++ b/plugins/ManipulatorScan.form @@ -178,7 +178,7 @@ - + @@ -545,6 +545,7 @@ + @@ -557,7 +558,9 @@ - + + + @@ -567,7 +570,7 @@ - + @@ -620,6 +623,14 @@ + + + + + + + + diff --git a/plugins/ManipulatorScan.java b/plugins/ManipulatorScan.java index f9cb58da..d83ea879 100644 --- a/plugins/ManipulatorScan.java +++ b/plugins/ManipulatorScan.java @@ -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 getArgs() { HashMap args = new HashMap<>(); args.put("MOTOR", comboMotor.getSelectedItem().toString()); ArrayList 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") // //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; diff --git a/plugins/OTF.form b/plugins/OTF.form index 4bb36862..07adc7e9 100644 --- a/plugins/OTF.form +++ b/plugins/OTF.form @@ -230,7 +230,7 @@ - + @@ -239,6 +239,7 @@ + @@ -251,6 +252,8 @@ + + @@ -280,6 +283,14 @@ + + + + + + + + diff --git a/plugins/OTF.java b/plugins/OTF.java index bf8df1e6..20d4065c 100644 --- a/plugins/OTF.java +++ b/plugins/OTF.java @@ -1,15 +1,17 @@ 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; import java.util.HashMap; +import java.util.Map; import javax.swing.JSpinner; /** * */ -public class OTF extends Panel { +public class OTF extends ScriptProcessor { public OTF() { initComponents(); @@ -48,17 +50,19 @@ public class OTF extends Panel { } - @Override - protected void onUnloaded() { - - } //Invoked by 'update()' to update components in the event thread @Override protected void doUpdate() { - } + } - void startScan() throws Exception { + @Override + public String getScript() { + return "otf"; + } + + @Override + public Map getArgs() { HashMap args = new HashMap<>(); /* ArrayList sensors = new ArrayList(); @@ -74,9 +78,10 @@ public class OTF extends Panel { args.put("E2", spinnerE2.getValue()); args.put("TIME", spinnerTime.getValue()); args.put("MODULO", spinnerModulo.getValue()); - args.put("ENDSCAN", checkEndScan.isSelected()); - runAsync("otf", args); - } + args.put("ENDSCAN", checkEndScan.isSelected()); + return args; + } + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -98,6 +103,7 @@ public class OTF extends Panel { buttonStart = new javax.swing.JButton(); buttonAbort = new javax.swing.JButton(); checkEndScan = new javax.swing.JCheckBox(); + buttonQueue = new javax.swing.JButton(); panelSensors.setBorder(javax.swing.BorderFactory.createTitledBorder("Sensors")); @@ -222,6 +228,13 @@ public class OTF extends Panel { checkEndScan.setText("Turn off beam at end"); + 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( @@ -233,7 +246,8 @@ public class OTF extends Panel { .addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(checkEndScan) - .addGap(0, 62, Short.MAX_VALUE))) + .addGap(0, 62, Short.MAX_VALUE)) + .addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( @@ -243,6 +257,8 @@ public class OTF extends Panel { .addComponent(buttonStart) .addGap(18, 18, 18) .addComponent(buttonAbort) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonQueue) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(checkEndScan) .addGap(26, 26, 26)) @@ -278,7 +294,7 @@ public class OTF extends Panel { private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed try { - startScan(); + execute(); } catch (Exception ex) { showException(ex); } @@ -292,8 +308,17 @@ public class OTF extends Panel { } }//GEN-LAST:event_buttonAbortActionPerformed + 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.JButton buttonQueue; private javax.swing.JButton buttonStart; private javax.swing.JCheckBox checkCur1; private javax.swing.JCheckBox checkCur2; diff --git a/plugins/PhotonEnergy.form b/plugins/PhotonEnergy.form index e3c4a543..9e4b8a07 100644 --- a/plugins/PhotonEnergy.form +++ b/plugins/PhotonEnergy.form @@ -97,7 +97,7 @@ - + @@ -530,7 +530,7 @@ - + @@ -541,6 +541,7 @@ + @@ -553,7 +554,9 @@ - + + + @@ -563,7 +566,7 @@ - + @@ -616,6 +619,14 @@ + + + + + + + + diff --git a/plugins/PhotonEnergy.java b/plugins/PhotonEnergy.java index 31984839..bc8c1fe2 100644 --- a/plugins/PhotonEnergy.java +++ b/plugins/PhotonEnergy.java @@ -7,6 +7,7 @@ import ch.psi.pshell.scan.Scan; import ch.psi.pshell.scan.ScanListener; import ch.psi.pshell.scan.ScanRecord; import ch.psi.pshell.ui.Panel; +import ch.psi.pshell.ui.ScriptProcessor; import ch.psi.utils.Convert; import ch.psi.utils.State; import ch.psi.utils.swing.SwingUtils; @@ -15,6 +16,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.JSpinner; import javax.swing.JToggleButton; @@ -22,7 +24,7 @@ import javax.swing.JToggleButton; /** * */ -public class PhotonEnergy extends Panel { +public class PhotonEnergy extends ScriptProcessor { public PhotonEnergy() { initComponents(); @@ -177,7 +179,19 @@ public class PhotonEnergy extends Panel { }); } - void startScan() throws Exception { + @Override + public void execute() throws Exception { + super.execute(); + running = true; + } + + @Override + public String getScript() { + return "PhotonEnergy"; + } + + @Override + public Map getArgs() { HashMap args = new HashMap<>(); ArrayList sensors = new ArrayList(); for (Component c : panelSensors.getComponents()) { @@ -193,9 +207,9 @@ public class PhotonEnergy extends Panel { args.put("STEP", (Double) spinnerStep.getValue()); args.put("ENDSCAN", checkEndScan.isSelected()); - runAsync("PhotonEnergy", args); - running = true; - } + return args; + } + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents @@ -247,6 +261,7 @@ public class PhotonEnergy extends Panel { dvpAcqTime = new ch.psi.pshell.swing.DeviceValuePanel(); textTotalTime = new javax.swing.JLabel(); labelTotalTime = new javax.swing.JLabel(); + buttonQueue = new javax.swing.JButton(); panelPositioner.setBorder(javax.swing.BorderFactory.createTitledBorder("Acquisition")); @@ -386,7 +401,7 @@ public class PhotonEnergy extends Panel { .addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(radioCis) .addComponent(radioSwept)) - .addGap(0, 0, Short.MAX_VALUE)) + .addGap(0, 58, Short.MAX_VALUE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPositionerLayout.createSequentialGroup() .addGroup(panelPositionerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) @@ -584,6 +599,13 @@ public class PhotonEnergy extends Panel { labelTotalTime.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); labelTotalTime.setText("Total time:"); + 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( @@ -597,14 +619,15 @@ public class PhotonEnergy extends Panel { .addComponent(buttonStart, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonAbort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() - .addGap(0, 1, Short.MAX_VALUE) + .addGap(0, 10, Short.MAX_VALUE) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(labelAcqTime) .addComponent(labelTotalTime)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textTotalTime, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addComponent(dvpAcqTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(buttonQueue, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); @@ -619,7 +642,9 @@ public class PhotonEnergy 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(dvpAcqTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(labelAcqTime)) @@ -627,7 +652,7 @@ public class PhotonEnergy 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)) ); @@ -672,7 +697,7 @@ public class PhotonEnergy extends Panel { private void buttonStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartActionPerformed try { - startScan(); + execute(); } catch (Exception ex) { SwingUtils.showException(this, ex); } @@ -700,10 +725,19 @@ public class PhotonEnergy extends Panel { updateTable(); }//GEN-LAST:event_spinnerEnergyChanged + 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; diff --git a/script/ManipulatorScan.py b/script/ManipulatorScan.py index b15c3749..9d5027be 100644 --- a/script/ManipulatorScan.py +++ b/script/ManipulatorScan.py @@ -13,7 +13,7 @@ ENDSCAN (BOOLEAN) #set_preference(Preference.PLOT_TYPES,{'ImageIntegrator':1}) adjust_sensors() -#set_adc_averaging() +set_adc_averaging() set_preference(Preference.PLOT_TYPES, {'Scienta spectrum':1}) set_exec_pars(compression=True)