def get_state(self): """ Returns an object with the state of the interface """ m = Detector() # Mask m.x_position = util._check_and_get_float_line_edit(self._content.x_pos_edit) m.y_position = util._check_and_get_float_line_edit(self._content.y_pos_edit) m.beam_radius = util._check_and_get_float_line_edit(self._content.beam_radius_edit) m.use_finder = self._content.use_beam_finder_checkbox.isChecked() m.beam_file = unicode(self._content.beam_data_file_edit.text()) m.use_direct_beam = self._content.direct_beam.isChecked() # Sensitivity m.sensitivity_corr = self._content.sensitivity_chk.isChecked() m.sensitivity_data = unicode(self._content.sensitivity_file_edit.text()) m.min_sensitivity = util._check_and_get_float_line_edit(self._content.min_sensitivity_edit) m.max_sensitivity = util._check_and_get_float_line_edit(self._content.max_sensitivity_edit) if not self._use_sample_dc: m.sensitivity_dark = unicode(self._content.sensitivity_dark_file_edit.text()) m.use_sample_dark = self._use_sample_dc m.use_sample_beam_center = self._content.use_sample_center_checkbox.isChecked() m.flood_x_position = util._check_and_get_float_line_edit(self._content.x_pos_edit_2) m.flood_y_position = util._check_and_get_float_line_edit(self._content.y_pos_edit_2) m.flood_beam_radius = util._check_and_get_float_line_edit(self._content.beam_radius_edit_2) m.flood_use_finder = self._content.use_beam_finder_checkbox_2.isChecked() m.flood_beam_file = unicode(self._content.beam_data_file_edit_2.text()) m.flood_use_direct_beam = self._content.direct_beam_2.isChecked() self._settings.emit_key_value("FLOOD_FIELD", str(self._content.sensitivity_file_edit.text())) return m
def __init__(self, parent=None, state=None, settings=None, show_transmission=True, data_type=None, data_proxy=None, use_sample_dc=False, options_callback=None): super(DetectorWidget, self).__init__(parent, state, settings, data_type, data_proxy=data_proxy) class DetFrame(QtGui.QFrame, ui.sans.ui_hfir_detector.Ui_Frame): def __init__(self, parent=None): QtGui.QFrame.__init__(self, parent) self.setupUi(self) self._content = DetFrame(self) self._layout.addWidget(self._content) # Option to use the sample dark current instead of choosing it separately self._use_sample_dc = use_sample_dc self.patch_ws = "__patch" self.options_callback = options_callback self.initialize_content() if state is not None: self.set_state(state) else: m = Detector() self.set_state(m)