Beispiel #1
0
    def get_state(self):
        """
            Returns an object with the state of the interface
        """
        m = DataSets()
        if self._settings.api2: m.PYTHON_API=2

        m.transmission = util._check_and_get_float_line_edit(self._content.transmission_edit)
        m.transmission_spread = util._check_and_get_float_line_edit(self._content.dtransmission_edit)
        m.sample_thickness = util._check_and_get_float_line_edit(self._content.sample_thickness_edit)
        
        m.calculate_transmission = self._content.calculate_radio.isChecked()
        m.theta_dependent = self._content.theta_dep_chk.isChecked()
        m.combine_transmission_frames = self._content.fit_together_check.isChecked()
        
        d = m.calculation_method
        d.beam_radius = util._check_and_get_float_line_edit(self._content.beam_radius_edit)
        d.sample_file = unicode(self._content.sample_edit.text())
        d.direct_beam = unicode(self._content.empty_edit.text())
        
        # Data file
        m.data_files = self._get_data_files()
        
        # Background
        b = m.background
        b.background_corr = self._content.background_chk.isChecked()
        b.background_file = str(self._content.background_edit.text())
        
        b.bck_transmission_enabled = True
        b.bck_transmission = util._check_and_get_float_line_edit(self._content.bck_transmission_edit)
        b.bck_transmission_spread = util._check_and_get_float_line_edit(self._content.bck_dtransmission_edit)
        #b.sample_thickness = util._check_and_get_float_line_edit(self._content.bck_thickness_edit)
        b.calculate_transmission = self._content.bck_calculate_radio.isChecked()
        b.theta_dependent = self._content.bck_theta_dep_chk.isChecked()
        b.combine_transmission_frames = self._content.bck_fit_together_check.isChecked()
    
        d = b.trans_calculation_method
        d.beam_radius = util._check_and_get_float_line_edit(self._content.bck_beam_radius_edit)
        d.sample_file = unicode(self._content.bck_sample_edit.text())
        d.direct_beam = unicode(self._content.bck_empty_edit.text())

        self._settings.emit_key_value("TRANS_SAMPLE", QtCore.QString(str(self._content.sample_edit.text())))
        self._settings.emit_key_value("TRANS_DIRECT", QtCore.QString(str(self._content.empty_edit.text())))
        self._settings.emit_key_value("TRANS_BCK", QtCore.QString(str(self._content.bck_sample_edit.text())))
        self._settings.emit_key_value("TRANS_DIRECT", QtCore.QString(str(self._content.bck_empty_edit.text())))
        return m
Beispiel #2
0
    def __init__(self, parent=None, state=None, settings=None, data_type=None, data_proxy=None):
        super(DataSetsWidget, self).__init__(parent, state, settings, data_type, data_proxy=data_proxy) 

        class DataFrame(QtGui.QFrame, ui.sans.ui_eqsans_sample_data.Ui_Frame): 
            def __init__(self, parent=None):
                QtGui.QFrame.__init__(self, parent)
                self.setupUi(self)
                
        self._content = DataFrame(self)
        self._layout.addWidget(self._content)
        self.initialize_content()
        
        if state is not None:
            self.set_state(state)
        else:
            m = DataSets()
            if self._settings.api2: m.PYTHON_API=2
            self.set_state(m)