AutoFocus
This commit is contained in:
@@ -5,6 +5,7 @@ import ch.psi.pshell.ui.Panel;
|
||||
import ch.psi.utils.State;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -66,12 +67,12 @@ public class Eiger extends Panel {
|
||||
} catch (Exception ex){
|
||||
}
|
||||
try{
|
||||
spinnerExpusure.setValue(exposure.take());
|
||||
spinnerExposure.setValue(exposure.take());
|
||||
} catch (Exception ex){
|
||||
}
|
||||
comboDepth.setEnabled(bitDepth.isInitialized());
|
||||
comboMode.setEnabled(mode.isInitialized());
|
||||
spinnerExpusure.setEnabled(exposure.isInitialized());
|
||||
spinnerExposure.setEnabled(exposure.isInitialized());
|
||||
|
||||
} finally{
|
||||
updatingControls=false;
|
||||
@@ -95,7 +96,7 @@ public class Eiger extends Panel {
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
comboMode = new javax.swing.JComboBox<>();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
spinnerExpusure = new javax.swing.JSpinner();
|
||||
spinnerExposure = new javax.swing.JSpinner();
|
||||
deviceValuePanel1 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel2 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
deviceValuePanel3 = new ch.psi.pshell.swing.DeviceValuePanel();
|
||||
@@ -119,7 +120,7 @@ public class Eiger extends Panel {
|
||||
|
||||
jLabel1.setText("Bit Depth:");
|
||||
|
||||
comboDepth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "4", "8", "16", "32", "Unknown" }));
|
||||
comboDepth.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "4", "8", "16", "32" }));
|
||||
comboDepth.setEnabled(false);
|
||||
comboDepth.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
@@ -127,7 +128,7 @@ public class Eiger extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
buttonStartDetector.setText("Start Eiger");
|
||||
buttonStartDetector.setText("Start EIGER");
|
||||
buttonStartDetector.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonStartDetectorActionPerformed(evt);
|
||||
@@ -146,11 +147,11 @@ public class Eiger extends Panel {
|
||||
|
||||
jLabel3.setText("Exposure [s]:");
|
||||
|
||||
spinnerExpusure.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 300.0d, 1.0d));
|
||||
spinnerExpusure.setEnabled(false);
|
||||
spinnerExpusure.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
spinnerExposure.setModel(new javax.swing.SpinnerNumberModel(1.0d, 0.001d, 300.0d, 1.0d));
|
||||
spinnerExposure.setEnabled(false);
|
||||
spinnerExposure.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
spinnerExpusureStateChanged(evt);
|
||||
spinnerExposureStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -160,7 +161,7 @@ public class Eiger extends Panel {
|
||||
|
||||
deviceValuePanel3.setDeviceName("eiger_exposure_rbv");
|
||||
|
||||
buttonStopDetector.setText("Stop Eiger");
|
||||
buttonStopDetector.setText("Stop EIGER");
|
||||
buttonStopDetector.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonStopDetectorActionPerformed(evt);
|
||||
@@ -183,14 +184,14 @@ public class Eiger extends Panel {
|
||||
}
|
||||
});
|
||||
|
||||
buttonAquire.setText("Aquire");
|
||||
buttonAquire.setText("Start");
|
||||
buttonAquire.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonAquireActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
buttonDone.setText("Done");
|
||||
buttonDone.setText("Stop");
|
||||
buttonDone.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
buttonDoneActionPerformed(evt);
|
||||
@@ -259,35 +260,32 @@ public class Eiger extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonCloseVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonStopDetector, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap(68, Short.MAX_VALUE))
|
||||
.addComponent(buttonStopDetector, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spinnerExpusure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(comboMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(comboDepth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonStartDetector)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
.addComponent(deviceValuePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonAquire, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonOpenVG10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(buttonStartDetector)))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
@@ -303,7 +301,7 @@ public class Eiger extends Panel {
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExpusure});
|
||||
layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, spinnerExposure});
|
||||
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@@ -329,7 +327,7 @@ public class Eiger extends Panel {
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
||||
.addComponent(jLabel3)
|
||||
.addComponent(spinnerExpusure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(spinnerExposure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(deviceValuePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(buttonShowDetectorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
@@ -355,14 +353,16 @@ public class Eiger extends Panel {
|
||||
.addComponent(renderer, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE))))
|
||||
);
|
||||
|
||||
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExpusure});
|
||||
layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {buttonStartDetector, buttonStopDetector, comboDepth, comboMode, deviceValuePanel1, deviceValuePanel2, deviceValuePanel3, deviceValuePanel4, spinnerExposure});
|
||||
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void comboDepthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboDepthActionPerformed
|
||||
try{
|
||||
if (!updatingControls){
|
||||
if (comboDepth.getSelectedIndex()!=comboDepth.getItemCount()-1) {
|
||||
((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);
|
||||
}
|
||||
@@ -392,6 +392,8 @@ public class Eiger extends Panel {
|
||||
if (value==1){
|
||||
value++;
|
||||
}
|
||||
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
mode.write(value);
|
||||
}
|
||||
} catch (Exception ex){
|
||||
@@ -399,15 +401,17 @@ public class Eiger extends Panel {
|
||||
}
|
||||
}//GEN-LAST:event_comboModeActionPerformed
|
||||
|
||||
private void spinnerExpusureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExpusureStateChanged
|
||||
private void spinnerExposureStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerExposureStateChanged
|
||||
try{
|
||||
if (!updatingControls){
|
||||
exposure.write((Double)spinnerExpusure.getValue());
|
||||
((ch.psi.pshell.device.Camera) getDevice("eiger")).stop();
|
||||
TimeUnit.SECONDS.sleep(1);
|
||||
exposure.write((Double)spinnerExposure.getValue());
|
||||
}
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
}//GEN-LAST:event_spinnerExpusureStateChanged
|
||||
}//GEN-LAST:event_spinnerExposureStateChanged
|
||||
|
||||
private void buttonStopDetectorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonStopDetectorActionPerformed
|
||||
try {
|
||||
@@ -506,9 +510,9 @@ public class Eiger extends Panel {
|
||||
|
||||
private void spinnerMaxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMaxStateChanged
|
||||
ColormapSource source = (ColormapSource) renderer.getOrigin();
|
||||
source.getConfig().colormapMax = (Double)spinnerMax.getValue();
|
||||
|
||||
try {
|
||||
source.getConfig().colormapMax = ((Integer)spinnerMax.getValue());
|
||||
source.getConfig().save();
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
@@ -518,9 +522,9 @@ public class Eiger extends Panel {
|
||||
|
||||
private void spinnerMinStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerMinStateChanged
|
||||
ColormapSource source = (ColormapSource) renderer.getOrigin();
|
||||
source.getConfig().colormapMax = (Double)spinnerMin.getValue();
|
||||
|
||||
|
||||
try {
|
||||
source.getConfig().colormapMin = ((Integer)spinnerMin.getValue());
|
||||
source.getConfig().save();
|
||||
} catch (Exception ex) {
|
||||
getLogger().log(Level.WARNING, null, ex);
|
||||
@@ -551,7 +555,7 @@ public class Eiger extends Panel {
|
||||
private javax.swing.JLabel jLabel5;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private ch.psi.pshell.imaging.Renderer renderer;
|
||||
private javax.swing.JSpinner spinnerExpusure;
|
||||
private javax.swing.JSpinner spinnerExposure;
|
||||
private javax.swing.JSpinner spinnerMax;
|
||||
private javax.swing.JSpinner spinnerMin;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
Reference in New Issue
Block a user