Closedown
This commit is contained in:
@@ -271,7 +271,45 @@ public class Eiger extends Panel {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void buttonConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigActionPerformed
|
||||
|
||||
try{
|
||||
if (stddaq!=null){
|
||||
String title = "Std Daq Config";
|
||||
this.evalAsync("std_daq.get_config()").handle((ret,ex)->{
|
||||
if (ex!=null){
|
||||
showException((Exception) ex);
|
||||
} else {
|
||||
try{
|
||||
Map cfg = (Map) ret;
|
||||
String json = EncoderJson.encode(cfg, true);
|
||||
ScriptDialog dlg = new ScriptDialog(getWindow(), true, title, json, "json");
|
||||
dlg.setVisible(true);
|
||||
if (dlg.getResult()){
|
||||
json = dlg.getText();
|
||||
cfg = (Map) EncoderJson.decode(json, Map.class);
|
||||
setGlobalVar("_daq_config", cfg);
|
||||
evalAsync("std_daq.set_config(_daq_config)").handle((r,e)->{
|
||||
if (e!=null){
|
||||
showException((Exception) e);
|
||||
} else {
|
||||
showMessage(title, "Success updating config");
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
} catch (Exception e){
|
||||
showException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
} catch (Exception ex){
|
||||
showException(ex);
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_buttonConfigActionPerformed
|
||||
|
||||
private void buttonConfigDetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonConfigDetActionPerformed
|
||||
@@ -294,12 +332,12 @@ public class Eiger extends Panel {
|
||||
if (dlg.getResult()){
|
||||
json = dlg.getText();
|
||||
cfg = (Map) EncoderJson.decode(json, Map.class);
|
||||
setGlobalVar("_detector_config", cfg);
|
||||
evalAsync("detector.set_pars(_detector_config)").handle((r,e)->{
|
||||
setGlobalVar("_detector_pars", cfg);
|
||||
evalAsync("detector.set_pars(_detector_pars)").handle((r,e)->{
|
||||
if (e!=null){
|
||||
showException((Exception) e);
|
||||
} else {
|
||||
showMessage(title, "Success");
|
||||
showMessage(title, "Success updating parameters");
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
@@ -1,23 +1,32 @@
|
||||
class Detector(DeviceBase):
|
||||
def __init__(self, name):
|
||||
DeviceBase.__init__(self, name)
|
||||
self.simulated=True
|
||||
self.simulated_pars = {}
|
||||
|
||||
def doInitialize(self):
|
||||
pass
|
||||
|
||||
def start(self):
|
||||
self.state.assertIs(State.Ready)
|
||||
if not self.simulated:
|
||||
pass
|
||||
self.setState(State.Busy)
|
||||
|
||||
def stop(self):
|
||||
self.state.assertIs(State.Busy)
|
||||
if not self.simulated:
|
||||
pass
|
||||
self.setState(State.Ready)
|
||||
|
||||
def get_pars(self):
|
||||
return self.simulated_pars
|
||||
if self.simulated:
|
||||
return self.simulated_pars
|
||||
|
||||
def set_pars(self, pars):
|
||||
if type(pars) == dict or isinstance(pars, java.util.Map) :
|
||||
self.simulated_pars=pars
|
||||
if self.simulated:
|
||||
self.simulated_pars=pars
|
||||
|
||||
def doClose(self):
|
||||
pass
|
||||
@@ -1,16 +1,42 @@
|
||||
class StdDaq(DeviceBase):
|
||||
def __init__(self, name):
|
||||
DeviceBase.__init__(self, name)
|
||||
self.simulated=True
|
||||
self.simulated_config = {
|
||||
"detector_name": "eg",
|
||||
"detector_type": "eiger",
|
||||
"n_modules": 2,
|
||||
"bit_depth": 32,
|
||||
"image_pixel_height": 514,
|
||||
"image_pixel_width": 1030,
|
||||
"start_udp_port": 50000
|
||||
}
|
||||
|
||||
|
||||
def doInitialize(self):
|
||||
pass
|
||||
|
||||
def start(self):
|
||||
self.state.assertIs(State.Ready)
|
||||
if not self.simulated:
|
||||
pass
|
||||
self.setState(State.Busy)
|
||||
|
||||
def stop(self):
|
||||
self.state.assertIs(State.Busy)
|
||||
if not self.simulated:
|
||||
pass
|
||||
self.setState(State.Ready)
|
||||
|
||||
def get_config(self):
|
||||
if self.simulated:
|
||||
return self.simulated_config
|
||||
|
||||
def get_config(self, config):
|
||||
if type(config) == dict or isinstance(config, java.util.Map) :
|
||||
if self.simulated:
|
||||
self.simulated_config=config
|
||||
|
||||
def doClose(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user