This commit is contained in:
sfop
2016-09-01 09:56:43 +02:00
parent dc44cd44cc
commit 8b5feb09de
2 changed files with 28 additions and 10 deletions

View File

@@ -1,13 +1,13 @@
#Thu Sep 01 08:42:35 CEST 2016
colormap=Grayscale
colormapAutomatic=false
colormapMax=104.529
colormapMin=93.74
#Thu Sep 01 09:55:14 CEST 2016
colormap=Temperature
colormapAutomatic=true
colormapMax=4281.715
colormapMin=0.0
flipHorizontally=false
flipVertically=false
grayscale=false
imageHeight=1200
imageWidth=1246
imageHeight=0
imageWidth=0
invert=false
rescaleFactor=1.0
rescaleOffset=0.0

View File

@@ -47,6 +47,7 @@ public class Cameras extends Panel {
initComponents();
renderer.setPersistenceFile(Paths.get(getController().getSetup().getContextPath(), "Renderer_Cameras.bin"));
setPersistedComponents(new Component[]{checkCamtool});
comboCameras.setEnabled(false);
}
final String configFolder = "/afs/psi.ch/intranet/SF/Applications/config/camtool";
@@ -59,6 +60,7 @@ public class Cameras extends Panel {
//Overridable callbacks
@Override
public void onInitialize(int runCount) {
comboCameras.setEnabled(false);
cameraConfigFiles = IO.listFiles(configFolder, new String[]{"json"});
Arrays.sort(cameraConfigFiles, (a, b) -> a.compareTo(b));
DefaultComboBoxModel model = new DefaultComboBoxModel();
@@ -69,14 +71,17 @@ public class Cameras extends Panel {
}
}
comboCameras.setModel(model);
comboCameras.setEnabled(true);
comboCameras.setSelectedItem(-1);
if (model.getSize() > 0) {
try {
//setCamera((String)comboCameras.getSelectedItem());
if (App.hasArgument("cam")) {
setCamera(App.getArgumentValue("cam"));
System.out.println("Setting camera:" + App.getArgumentValue("cam"));
comboCameras.setSelectedItem(App.getArgumentValue("cam"));
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
startTimer(1000);
@@ -163,6 +168,7 @@ public class Cameras extends Panel {
}
void setCamera(String cameraName) throws IOException, InterruptedException {
System.out.println("Setting camera:" + cameraName);
if (camera != null) {
camera.close();
camera = null;
@@ -176,7 +182,7 @@ public class Cameras extends Panel {
//SwingUtils.showMessage(null, "", json);
try {
if (checkCamtool.isSelected()) {
camera = new Camtool("CurrentCamera", cameraName, false, true);
camera = new Camtool("CurrentCamera", cameraName, true, true);
} else {
camera = new PsiCamera("CurrentCamera", cameraName);
config = (CameraConfig) JsonSerializer.decode(cameraConfigJson, CameraConfig.class);
@@ -504,7 +510,19 @@ public class Cameras extends Panel {
private void comboCamerasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboCamerasActionPerformed
try {
setCamera((String) comboCameras.getSelectedItem());
comboCameras.setEnabled(false);
new Thread(new Runnable() {
@Override
public void run() {
try{
setCamera((String) comboCameras.getSelectedItem());
} catch(Exception ex){
ex.printStackTrace();
} finally{
comboCameras.setEnabled(true);
}
}
}).start();
} catch (Exception ex) {
showException(ex);
}