Script Tests

This commit is contained in:
gac-x11ma
2021-05-12 09:55:11 +02:00
parent d886999e06
commit fee5f5ffba
4 changed files with 75 additions and 43 deletions

View File

@@ -358,25 +358,23 @@ public class Eiger extends Panel {
}// </editor-fold>//GEN-END:initComponents
private void comboDepthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboDepthActionPerformed
comboDepth.setEnabled(false);
new Thread( ()-> {
try{
try{
if (!updatingControls){
ch.psi.pshell.device.Camera eiger = (ch.psi.pshell.device.Camera) getDevice("eiger");
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()) {
if (eiger.isStarted()){
buttonStopDetectorActionPerformed(null);
eiger.waitState(State.Ready, 10000); //Timeout of 10s
}
if (eiger.isStarted()){
buttonDoneActionPerformed(null);
eiger.waitState(State.Ready, 10000); //Timeout of 10s
}
//((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
//TimeUnit.SECONDS.sleep(1);
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()) {
Integer value = Integer.valueOf((String)comboDepth.getSelectedItem());
bitDepth.write(value);
bitDepth.write(value);
}
} catch (Exception ex){
showException(ex);
}
finally{
comboDepth.setEnabled(true);
}
}).start();
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_comboDepthActionPerformed
private void buttonStartDetectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStartDetectorActionPerformed
@@ -393,45 +391,41 @@ public class Eiger extends Panel {
}//GEN-LAST:event_buttonStartDetectorActionPerformed
private void comboModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboModeActionPerformed
comboMode.setEnabled(false);
new Thread( ()-> {
try{
try{
if (!updatingControls){
ch.psi.pshell.device.Camera eiger = (ch.psi.pshell.device.Camera) getDevice("eiger");
if (eiger.isStarted()){
buttonStopDetectorActionPerformed(null);
buttonDoneActionPerformed(null);
eiger.waitState(State.Ready, 10000); //Timeout of 10s
}
//((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
//TimeUnit.SECONDS.sleep(1);
Integer value = comboMode.getSelectedIndex();
if (value==1){
value++;
}
mode.write(value);
} catch (Exception ex){
showException(ex);
}
finally{
comboMode.setEnabled(true);
}
}).start();
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_comboModeActionPerformed
private void spinnerExposureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExposureStateChanged
spinnerExposure.setEnabled(false);
new Thread( ()-> {
try{
try{
if (!updatingControls){
ch.psi.pshell.device.Camera eiger = (ch.psi.pshell.device.Camera) getDevice("eiger");
if (eiger.isStarted()){
buttonStopDetectorActionPerformed(null);
buttonDoneActionPerformed(null);
eiger.waitState(State.Ready, 10000); //Timeout of 10s
}
//((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
//TimeUnit.SECONDS.sleep(1);
exposure.write((Double)spinnerExposure.getValue());
} catch (Exception ex){
showException(ex);
}
finally{
spinnerExposure.setEnabled(true);
}
}).start();
} catch (Exception ex){
showException(ex);
}
}//GEN-LAST:event_spinnerExposureStateChanged
private void buttonStopDetectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopDetectorActionPerformed