def __init__(self):
        super().__init__(show_automatic_box=True)
        
        line_profiles_box = gui.widgetBox(self.controlArea,
                                 "Line Profiles", orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10, height=600)


        button_box = gui.widgetBox(line_profiles_box,
                                   "", orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH-25)

        gui.button(button_box, self, "Send Line Profiles", height=40, callback=self.send_line_profiles)

        self.line_profiles_tabs = gui.tabWidget(line_profiles_box)
        self.line_profiles_box_array = []

        for index in range(len(self.reflections_of_phases)):
            line_profiles_tab = gui.createTabPage(self.line_profiles_tabs, DiffractionPattern.get_default_name(index))

            line_profiles_box = LineProfileBox(widget=self,
                                               parent=line_profiles_tab,
                                               diffraction_pattern_index = index,
                                               reflections_of_phases = self.reflections_of_phases[index],
                                               limits                = self.limits[index],
                                               limit_types           = self.limit_types[index])

            self.line_profiles_box_array.append(line_profiles_box)

        runaction = OWAction("Send Line Profiles", self)
        runaction.triggered.connect(self.send_line_profiles)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
Пример #2
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.main_box = gui.widgetBox(self.controlArea,
                                      self.get_parameter_name(),
                                      orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH - 10,
                                      height=self.get_height())

        self.button_box = gui.widgetBox(self.main_box,
                                        "",
                                        orientation="horizontal",
                                        width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(self.button_box,
                   self,
                   "Send " + self.get_parameter_name(),
                   height=40,
                   callback=self.send_parameter)

        self.build_main_box()

        orangegui.separator(self.main_box)

        self.parameter_tabs = gui.tabWidget(self.main_box)
        self.parameter_box_array = []

        self.build_parameter_box_array()

        runaction = OWAction("Send " + self.get_parameter_name(), self)
        runaction.triggered.connect(self.send_parameter)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
Пример #3
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "Phases",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 5,
                                 height=self.get_height())

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Phases",
                   height=50,
                   callback=self.send_phases)

        tabs_button_box = gui.widgetBox(main_box,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        btns = [
            gui.button(tabs_button_box,
                       self,
                       "Insert Phase Before",
                       callback=self.insert_before),
            gui.button(tabs_button_box,
                       self,
                       "Insert Phase After",
                       callback=self.insert_after),
            gui.button(tabs_button_box,
                       self,
                       "Remove Phase",
                       callback=self.remove)
        ]

        for btn in btns:
            btn.setFixedHeight(35)

        self.phases_tabs = gui.tabWidget(main_box)
        self.phases_box_array = []

        for index in range(len(self.a)):
            phase_tab = gui.createTabPage(self.phases_tabs,
                                          "Phase " + str(index + 1))

            phase_box = self.get_phase_box_instance(index, phase_tab)

            self.phases_box_array.append(phase_box)

        runaction = OWAction("Send Phases", self)
        runaction.triggered.connect(self.send_phases)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
Пример #4
0
    def remove_all(self):
        if ConfirmDialog.confirmed(
                parent=self,
                message="Confirm Removal of ALL diffraction Pattern?"):
            self.diffraction_pattern_tabs.clear()
            self.diffraction_pattern_box_array = []

            diffraction_pattern_box = DiffractionPatternBox(
                widget=self,
                parent=gui.createTabPage(
                    self.diffraction_pattern_tabs,
                    DiffractionPattern.get_default_name(0)),
                index=0)

            self.diffraction_pattern_box_array.append(diffraction_pattern_box)

            self.tabs.clear()
            self.tab_diff = []
            self.tabs_data_plot = []
            self.tab_data = []
            self.tab_plot = []
            self.plot = []
            self.table_data = []

            self.tab_diff.append(
                gui.createTabPage(self.tabs,
                                  DiffractionPattern.get_default_name(0)))
            self.tabs_data_plot.append(gui.tabWidget(self.tab_diff[0]))
            self.tab_data.append(
                gui.createTabPage(self.tabs_data_plot[0], "Data"))
            self.tab_plot.append(
                gui.createTabPage(self.tabs_data_plot[0], "Plot"))

            self.plot.append(PlotWindow())
            self.plot[0].setDefaultPlotLines(True)
            self.plot[0].setActiveCurveColor(color="#00008B")
            self.plot[0].setGraphXLabel(r"2$\theta$")
            self.plot[0].setGraphYLabel("Intensity")

            self.tab_plot[0].layout().addWidget(self.plot[0])

            table_widget = self.create_table_widget()

            self.table_data.append(table_widget)

            self.tab_data[0].layout().addWidget(table_widget,
                                                alignment=Qt.AlignHCenter)

            self.dumpSettings()
Пример #5
0
    def __init__(self):
        super().__init__(show_automatic_box=True)

        main_box = gui.widgetBox(self.controlArea,
                                 "",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=500)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Send Free Input Parameters",
                   height=40,
                   callback=self.send_free_input_parameters)

        tabs = gui.tabWidget(main_box)
        tab_free_in = gui.createTabPage(tabs, "Free Input Parameters")

        self.scrollarea_free_in = QScrollArea(tab_free_in)
        self.scrollarea_free_in.setMinimumWidth(self.CONTROL_AREA_WIDTH - 45)
        self.scrollarea_free_in.setMinimumHeight(160)

        self.text_area_free_in = gui.textArea(height=400,
                                              width=self.CONTROL_AREA_WIDTH -
                                              65,
                                              readOnly=False)
        self.text_area_free_in.setText(self.free_input_parameters)

        self.scrollarea_free_in.setWidget(self.text_area_free_in)
        self.scrollarea_free_in.setWidgetResizable(1)

        tab_free_in.layout().addWidget(self.scrollarea_free_in,
                                       alignment=Qt.AlignHCenter)

        runaction = OWAction("Send Free Input Parameters", self)
        runaction.triggered.connect(self.send_free_input_parameters)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.setFixedHeight(410)

        main_box = gui.widgetBox(self.controlArea,
                                 "Line Profiles",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 10,
                                 height=300)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Debye-Waller Parameters",
                   height=40,
                   callback=self.send_debye_waller)

        orangegui.comboBox(main_box,
                           self,
                           "use_single_parameter_set",
                           label="Use single set of Parameters",
                           labelWidth=350,
                           orientation="horizontal",
                           items=["No", "Yes"],
                           callback=self.set_use_single_parameter_set,
                           sendSelectedValue=False)

        orangegui.separator(main_box)

        self.debye_wallers_tabs = gui.tabWidget(main_box)

        self.set_use_single_parameter_set(on_init=True)

        runaction = OWAction("Send Debye-Waller Parameters", self)
        runaction.triggered.connect(self.send_debye_waller)
        self.addAction(runaction)

        orangegui.rubber(self.controlArea)
    def __init__(self,
                 widget=None,
                 parent=None,
                 diffraction_pattern_index=0,
                 reflections_of_phases=[],
                 limits=[],
                 limit_types=[]):

        super(LineProfileBox, self).__init__()

        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 35)
        self.setFixedHeight(480)

        self.widget = widget
        self.diffraction_pattern_index = diffraction_pattern_index

        self.reflections_of_phases = reflections_of_phases
        self.limits = limits
        self.limit_types = limit_types

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH-45

        parent.layout().addWidget(self)
        container = self

        self.reflections_of_phases_tabs = gui.tabWidget(container)
        self.reflections_of_phases_box_array = []

        for phase_index in range(len(self.reflections_of_phases)):
            reflections_of_phase_tab = gui.createTabPage(self.reflections_of_phases_tabs, OWGenericWidget.phase_name(self.widget.fit_global_parameters, phase_index))

            reflections_of_phase_box = ReflectionsOfPhaseBox(widget=widget,
                                                             widget_container=self,
                                                             parent=reflections_of_phase_tab,
                                                             diffraction_pattern_index = diffraction_pattern_index,
                                                             phase_index=phase_index,
                                                             reflections_of_phase = self.reflections_of_phases[phase_index],
                                                             limit                = self.limits[phase_index],
                                                             limit_type           = self.limit_types[phase_index])

            self.reflections_of_phases_box_array.append(reflections_of_phase_box)
    def __init__(self,
                 widget=None,
                 parent=None,
                 diffraction_pattern_index=0,
                 use_debye_waller_factors=[],
                 debye_waller_factors=[],
                 debye_waller_factors_fixed=[],
                 debye_waller_factors_has_min=[],
                 debye_waller_factors_min=[],
                 debye_waller_factors_has_max=[],
                 debye_waller_factors_max=[],
                 debye_waller_factors_function=[],
                 debye_waller_factors_function_value=[]):
        super(DebyeWallerBox, self).__init__()

        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 35)
        self.setFixedHeight(140)

        self.widget = widget
        self.diffraction_pattern_index = diffraction_pattern_index

        self.use_debye_waller_factors = use_debye_waller_factors
        self.debye_waller_factors = debye_waller_factors
        self.debye_waller_factors_fixed = debye_waller_factors_fixed
        self.debye_waller_factors_has_min = debye_waller_factors_has_min
        self.debye_waller_factors_min = debye_waller_factors_min
        self.debye_waller_factors_has_max = debye_waller_factors_has_max
        self.debye_waller_factors_max = debye_waller_factors_max
        self.debye_waller_factors_function = debye_waller_factors_function
        self.debye_waller_factors_function_value = debye_waller_factors_function_value

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH - 45

        parent.layout().addWidget(self)
        container = self

        self.debye_waller_of_phases_tabs = gui.tabWidget(container)
        self.debye_waller_of_phases_box_array = []

        for phase_index in range(len(self.debye_waller_factors)):
            debye_waller_of_phase_tab = gui.createTabPage(
                self.debye_waller_of_phases_tabs,
                OWGenericWidget.phase_name(self.widget.fit_global_parameters,
                                           phase_index))

            debye_waller_of_phase_box = DebyeWallerOfPhaseBox(
                widget=widget,
                widget_container=self,
                parent=debye_waller_of_phase_tab,
                diffraction_pattern_index=diffraction_pattern_index,
                phase_index=phase_index,
                use_debye_waller_factor=self.
                use_debye_waller_factors[phase_index],
                debye_waller_factor=self.debye_waller_factors[phase_index],
                debye_waller_factor_fixed=self.
                debye_waller_factors_fixed[phase_index],
                debye_waller_factor_has_min=self.
                debye_waller_factors_has_min[phase_index],
                debye_waller_factor_min=self.
                debye_waller_factors_min[phase_index],
                debye_waller_factor_has_max=self.
                debye_waller_factors_has_max[phase_index],
                debye_waller_factor_max=self.
                debye_waller_factors_max[phase_index],
                debye_waller_factor_function=self.
                debye_waller_factors_function[phase_index],
                debye_waller_factor_function_value=self.
                debye_waller_factors_function_value[phase_index])

            self.debye_waller_of_phases_box_array.append(
                debye_waller_of_phase_box)
Пример #9
0
    def __init__(self):
        super().__init__(show_automatic_box=False)

        main_box = gui.widgetBox(self.controlArea,
                                 "Load Diffraction Pattern",
                                 orientation="vertical",
                                 width=self.CONTROL_AREA_WIDTH - 5,
                                 height=600)

        button_box = gui.widgetBox(main_box,
                                   "",
                                   orientation="horizontal",
                                   width=self.CONTROL_AREA_WIDTH - 25)

        gui.button(button_box,
                   self,
                   "Load Data",
                   height=50,
                   callback=self.load_diffraction_patterns)

        tabs_button_box = gui.widgetBox(main_box,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        btns = [
            gui.button(tabs_button_box,
                       self,
                       "Insert Before",
                       callback=self.insert_before),
            gui.button(tabs_button_box,
                       self,
                       "Insert After",
                       callback=self.insert_after),
            gui.button(tabs_button_box, self, "Remove", callback=self.remove),
            gui.button(tabs_button_box,
                       self,
                       "Remove All",
                       callback=self.remove_all)
        ]

        for btn in btns:
            btn.setFixedHeight(40)

        btns[3].setStyleSheet("color: red")
        font = QFont(btns[3].font())
        font.setItalic(True)
        btns[3].setFont(font)

        self.diffraction_pattern_tabs = gui.tabWidget(main_box)
        self.diffraction_pattern_box_array = []

        for index in range(len(self.filename)):
            diffraction_pattern_tab = gui.createTabPage(
                self.diffraction_pattern_tabs,
                DiffractionPattern.get_default_name(index))

            diffraction_pattern_box = DiffractionPatternBox(
                widget=self,
                parent=diffraction_pattern_tab,
                index=index,
                filename=self.filename[index],
                twotheta_min=self.twotheta_min[index],
                twotheta_has_min=self.twotheta_has_min[index],
                twotheta_max=self.twotheta_max[index],
                twotheta_has_max=self.twotheta_has_max[index],
                diffraction_pattern_name=self.diffraction_pattern_name[index])

            self.diffraction_pattern_box_array.append(diffraction_pattern_box)

        self.tabs = gui.tabWidget(self.mainArea)
        self.tab_diff = []
        self.tabs_data_plot = []
        self.tab_data = []
        self.tab_plot = []
        self.plot = []
        self.table_data = []

        for index in range(len(self.filename)):
            self.tab_diff.append(
                gui.createTabPage(self.tabs,
                                  DiffractionPattern.get_default_name(index)))
            self.tabs_data_plot.append(gui.tabWidget(self.tab_diff[index]))
            self.tab_data.append(
                gui.createTabPage(self.tabs_data_plot[index], "Data"))
            self.tab_plot.append(
                gui.createTabPage(self.tabs_data_plot[index], "Plot"))

            self.plot.append(PlotWindow())
            self.plot[index].setDefaultPlotLines(True)
            self.plot[index].setActiveCurveColor(color="#00008B")
            self.plot[index].setGraphXLabel(r"2$\theta$")
            self.plot[index].setGraphYLabel("Intensity")

            self.tab_plot[index].layout().addWidget(self.plot[index])

            table_widget = self.create_table_widget()

            self.table_data.append(table_widget)

            self.tab_data[index].layout().addWidget(table_widget,
                                                    alignment=Qt.AlignHCenter)

        runaction = OWAction("Load Diffraction Patterns", self)
        runaction.triggered.connect(self.load_diffraction_patterns)
        self.addAction(runaction)
Пример #10
0
    def insert_after(self):
        current_index = self.diffraction_pattern_tabs.currentIndex()

        if ConfirmDialog.confirmed(
                parent=self,
                message="Confirm Insertion of a new element after " +
                self.diffraction_pattern_tabs.tabText(current_index) + "?"):
            diffraction_pattern_tab = gui.widgetBox(
                self.diffraction_pattern_tabs, addToLayout=0, margin=4)
            diffraction_pattern_box = DiffractionPatternBox(
                widget=self,
                parent=diffraction_pattern_tab,
                index=current_index + 1)
            diffraction_pattern_box.after_change_workspace_units()

            diffraction_pattern_pd_tab = gui.widgetBox(self.tabs,
                                                       addToLayout=0,
                                                       margin=4)

            if current_index == self.diffraction_pattern_tabs.count(
            ) - 1:  # LAST
                self.diffraction_pattern_tabs.addTab(diffraction_pattern_tab,
                                                     "TEMP")
                self.diffraction_pattern_box_array.append(
                    diffraction_pattern_box)

                self.tabs.addTab(diffraction_pattern_pd_tab, "TEMP")
                self.tab_diff.append(diffraction_pattern_pd_tab)

                self.tabs_data_plot.append(
                    gui.tabWidget(self.tab_diff[current_index + 1]))
                self.tab_data.append(
                    gui.createTabPage(self.tabs_data_plot[current_index + 1],
                                      "Data"))
                self.tab_plot.append(
                    gui.createTabPage(self.tabs_data_plot[current_index + 1],
                                      "Plot"))

                self.plot.append(PlotWindow())
                self.plot[current_index + 1].setDefaultPlotLines(True)
                self.plot[current_index +
                          1].setActiveCurveColor(color="#00008B")
                self.plot[current_index + 1].setGraphXLabel(r"2$\theta$")
                self.plot[current_index + 1].setGraphYLabel("Intensity")

                self.tab_plot[current_index + 1].layout().addWidget(
                    self.plot[current_index + 1])

                scrollarea = QScrollArea(self.tab_data[current_index])
                scrollarea.setMinimumWidth(805)
                scrollarea.setMinimumHeight(605)

                self.table_data.append(self.create_table_widget())

                scrollarea.setWidget(self.table_data[current_index + 1])
                scrollarea.setWidgetResizable(1)

                self.tab_data[current_index + 1].layout().addWidget(
                    scrollarea, alignment=Qt.AlignHCenter)
            else:
                self.diffraction_pattern_tabs.insertTab(
                    current_index + 1, diffraction_pattern_tab, "TEMP")
                self.diffraction_pattern_box_array.insert(
                    current_index + 1, diffraction_pattern_box)

                self.tabs.insertTab(current_index + 1,
                                    diffraction_pattern_pd_tab, "TEMP")
                self.tab_diff.insert(current_index + 1,
                                     diffraction_pattern_pd_tab)

                self.tabs_data_plot.insert(
                    current_index + 1,
                    gui.tabWidget(self.tab_diff[current_index + 1]))
                self.tab_data.insert(
                    current_index + 1,
                    gui.createTabPage(self.tabs_data_plot[current_index + 1],
                                      "Data"))
                self.tab_plot.insert(
                    current_index + 1,
                    gui.createTabPage(self.tabs_data_plot[current_index + 1],
                                      "Plot"))

                self.plot.insert(current_index + 1, PlotWindow())
                self.plot[current_index + 1].setDefaultPlotLines(True)
                self.plot[current_index +
                          1].setActiveCurveColor(color="#00008B")
                self.plot[current_index + 1].setGraphXLabel(r"2$\theta$")
                self.plot[current_index + 1].setGraphYLabel("Intensity")

                self.tab_plot[current_index + 1].layout().addWidget(
                    self.plot[current_index + 1])

                scrollarea = QScrollArea(self.tab_data[current_index + 1])
                scrollarea.setMinimumWidth(805)
                scrollarea.setMinimumHeight(605)

                self.table_data.insert(current_index + 1,
                                       self.create_table_widget())

                scrollarea.setWidget(self.table_data[current_index + 1])
                scrollarea.setWidgetResizable(1)

                self.tab_data[current_index + 1].layout().addWidget(
                    scrollarea, alignment=Qt.AlignHCenter)

            for index in range(current_index,
                               self.diffraction_pattern_tabs.count()):
                self.diffraction_pattern_tabs.setTabText(
                    index, DiffractionPattern.get_default_name(index))
                self.diffraction_pattern_box_array[index].index = index
                self.tabs.setTabText(
                    index, DiffractionPattern.get_default_name(index))

            self.dumpSettings()
            self.diffraction_pattern_tabs.setCurrentIndex(current_index + 1)
            self.tabs.setCurrentIndex(current_index + 1)