Exemple #1
0
    def ok(self):
        chemical_formula = str(self.ui.chemical_formula.text())
        molecular_mass, total_number_of_atoms = retrieving_molecular_mass_and_number_of_atoms_worked(
            chemical_formula)
        if molecular_mass and total_number_of_atoms:
            self.parent.material_ui = None

            if self.data_type == 'database':
                ui = self.database_window.list_ui[self.key]['value_label']
                ui.setText(chemical_formula)

            else:  # 'sample' or 'normalization'
                text_ui = self.parent.master_table_list_ui[self.key][
                    self.data_type]['material']['text']
                text_ui.setText(chemical_formula)
                o_table = TableRowHandler(main_window=self.parent)
                o_table.transfer_widget_states(from_key=self.key,
                                               data_type=self.data_type)
                self.parent.master_table_list_ui[self.key][self.data_type]['mass_density_infos']['molecular_mass'] \
                    = molecular_mass
                self.parent.master_table_list_ui[self.key][self.data_type]['mass_density_infos']['total_number_of_atoms'] \
                    = total_number_of_atoms

            self.parent.check_master_table_column_highlighting(
                column=self.column)
            self.close()
        else:
            self.ui.statusbar.setStyleSheet("color: red")
            self.ui.statusbar.showMessage(
                "Unable to calculate Molecular Mass! CHECK YOUR FORMULA!",
                self.parent.statusbar_display_time)
    def load(self):

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)

        o_table = TableRowHandler(main_window=self.parent)

        if self.parent.clear_master_table_before_loading:
            TableHandler.clear_table(self.table_ui)

        for _row, _key in enumerate(self.json.keys()):

            _entry = self.json[_key]

            run_number = _key
            title = _entry['title']
            chemical_formula = _entry['resolved_conflict']['chemical_formula']
            # geometry = _entry['resolved_conflict']['geometry']
            mass_density = _entry['resolved_conflict']['mass_density']
            # sample_env_device = _entry['resolved_conflict']['sample_env_device']

            o_table.insert_row(row=_row,
                               title=title,
                               sample_runs=run_number,
                               sample_mass_density=mass_density,
                               sample_chemical_formula=chemical_formula)

        QApplication.restoreOverrideCursor()
Exemple #3
0
    def accept(self):

        radius = str(self.ui.radius_value.text())
        radius2 = 'N/A'
        height = 'N/A'

        if self.shape_selected.lower() == 'cylinder':
            height = str(self.ui.height_value.text())
        elif self.shape_selected.lower() == 'sphere':
            pass
        else:
            radius2 = str(self.ui.radius2_value.text())
            height = str(self.ui.height_value.text())

        self.__set_label_value('radius', radius)
        self.__set_label_value('radius2', radius2)
        self.__set_label_value('height', height)

        o_table = TableRowHandler(main_window=self.parent)
        o_table.transfer_widget_states(
            from_key=self.key, data_type=self.data_type)

        self.parent.check_master_table_column_highlighting(column=self.column)

        self.close()
Exemple #4
0
    def ok(self):
        chemical_formula = str(self.ui.chemical_formula.text())
        if self.retrieving_molecular_mass_and_number_of_atoms_worked(chemical_formula):

            self.parent.material_ui = None

            if self.data_type == 'database':
                ui = self.database_window.list_ui[self.key]['value_label']
                ui.setText(chemical_formula)

            else: # 'sample' or 'normalization'
                text_ui = self.parent.master_table_list_ui[self.key][self.data_type]['material']['text']
                text_ui.setText(chemical_formula)
                # self.calculate_full_molecular_mass()
                o_table = TableRowHandler(main_window=self.parent)
                o_table.transfer_widget_states(from_key=self.key, data_type=self.data_type)
                self.parent.master_table_list_ui[self.key][self.data_type]['mass_density_infos']['molecular_mass'] \
                    = self.molecular_mass
                self.parent.master_table_list_ui[self.key][self.data_type]['mass_density_infos']['total_number_of_atoms'] \
                    = self.total_number_of_atoms

            self.parent.check_master_table_column_highlighting(column=self.column)
            self.close()
        else:
            self.ui.statusbar.setStyleSheet("color: red")
            self.ui.statusbar.showMessage("Unable to calculate Molecular Mass! CHECK YOUR FORMULA!",
                                          self.parent.statusbar_display_time)
    def fill(self, input_dictionary={}):

        if input_dictionary == {}:
            # # use for debugging
            # input_dictionary = _dictionary_test
            return

        o_table = TableRowHandler(main_window=self.parent)

        for _row_entry in input_dictionary.keys():

            # insert row but also initialize the hidden arguments such as
            # placzek settings
            o_table.insert_row(
                row=_row_entry,
                align_and_focus_args=input_dictionary[_row_entry]
                ['align_and_focus_args'],
                normalization_placzek_arguments=input_dictionary[_row_entry]
                ['normalization']['placzek'],
                sample_placzek_arguments=input_dictionary[_row_entry]['sample']
                ['placzek'])

            self.populate_row(row=_row_entry,
                              entry=input_dictionary[_row_entry],
                              key=o_table.key)
 def accept(self):
     self.save()
     o_table = TableRowHandler(main_window=self.parent)
     o_table.transfer_widget_states(from_key=self.key,
                                    data_type=self.data_type)
     self.parent.check_master_table_column_highlighting(column=self.column)
     self.close()
    def load(self):

        QApplication.setOverrideCursor(QtCore.Qt.WaitCursor)

        o_table = TableRowHandler(main_window=self.parent)

        if self.parent.clear_master_table_before_loading:
            TableHandler.clear_table(self.table_ui)

        for _row, _key in enumerate(self.json.keys()):

            _entry = self.json[_key]

            run_number = _key
            title = _entry['title']
            chemical_formula = _entry['resolved_conflict']['chemical_formula']
            # geometry = _entry['resolved_conflict']['geometry']
            mass_density = _entry['resolved_conflict']['mass_density']
            # sample_env_device = _entry['resolved_conflict']['sample_env_device']

            o_table.insert_row(row=_row,
                               title=title,
                               sample_runs=run_number,
                               sample_mass_density=mass_density,
                               sample_chemical_formula=chemical_formula)

        QApplication.restoreOverrideCursor()
    def insert_in_master_table(self, nexus_json=[]):
        if nexus_json == []:
            return

        runs_dict = self.build_result_dictionary(nexus_json=nexus_json)

        o_row = TableRowHandler(parent=self.parent)
        for _run in runs_dict.keys():
            _chemical_formula = runs_dict[_run]['chemical_formula']
            _mass_density = runs_dict[_run]['mass_density']
            _run = "{}".format(_run)

            o_row.fill_row(sample_runs=_run,
                           sample_chemical_formula=_chemical_formula,
                           sample_mass_density=_mass_density)
Exemple #9
0
    def accept(self):

        radius = str(self.ui.radius_value.text())
        radius2 = 'N/A'
        height = 'N/A'

        if self.shape_selected.lower() == 'cylindrical':
            height = str(self.ui.height_value.text())
        elif self.shape_selected.lower() == 'spherical':
            pass
        else:
            radius2 = str(self.ui.radius2_value.text())
            height = str(self.ui.height_value.text())

        self.__set_label_value('radius', radius)
        self.__set_label_value('radius2', radius2)
        self.__set_label_value('height', height)

        o_table = TableRowHandler(main_window=self.parent)
        o_table.transfer_widget_states(from_key=self.key, data_type=self.data_type)

        self.parent.check_master_table_column_highlighting(column=self.column)

        self.close()
Exemple #10
0
def normalization_inelastic_correction_changed(main_window, text, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.inelastic_correction_changed(value=text,
                                         key=key,
                                         data_type='normalization')
Exemple #11
0
def normalization_multi_scattering_correction_changed(main_window, text, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.multi_scattering_correction(value=text,
                                        key=key,
                                        data_type='normalization')
Exemple #12
0
def normalization_shape_changed(main_window, text, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.shape_changed(shape_index=text, key=key, data_type='normalization')
Exemple #13
0
def normalization_mass_density_line_edit_entered(main_window, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.transfer_widget_states(from_key=key, data_type='normalization')
    main_window.check_master_table_column_highlighting(
        column=INDEX_OF_COLUMNS_WITH_MASS_DENSITY[1])
Exemple #14
0
def normalization_material_line_edit_entered(main_window, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.transfer_widget_states(from_key=key, data_type='normalization')
Exemple #15
0
def sample_placzek_button_pressed(main_window, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.placzek_button_pressed(key=key, data_type='sample')
Exemple #16
0
def sample_shape_changed(main_window, index, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.shape_changed(shape_index=index, key=key, data_type='sample')
Exemple #17
0
def master_table_select_state_changed(main_window, state, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.activated_row_changed(key=key, state=state)
 def accept(self):
     self.save()
     o_table = TableRowHandler(main_window=self.parent)
     o_table.transfer_widget_states(from_key=self.key, data_type=self.data_type)
     self.parent.check_master_table_column_highlighting(column=self.column)
     self.close()
Exemple #19
0
def normalization_placzek_button_pressed(main_window, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.placzek_button_pressed(key=key, data_type='normalization')
Exemple #20
0
def sample_material_line_edit_entered(main_window, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.transfer_widget_states(from_key=key, data_type='sample')
Exemple #21
0
def sample_inelastic_correction_changed(main_window, text, key):
    o_table = TableRowHandler(main_window=main_window)
    o_table.inelastic_correction_changed(value=text,
                                         key=key,
                                         data_type='sample')