User scripts

This commit is contained in:
gac-x11ma
2021-05-11 14:39:04 +02:00
parent 3c1cfd301b
commit d886999e06
21 changed files with 342 additions and 98 deletions

View File

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