Esempio n. 1
0
    def init_gui(self, container):
        gui.lineEdit(container,
                     self,
                     "phase_name",
                     "Phase Name (will appear in tabs and plots)",
                     labelWidth=260,
                     valueType=str,
                     callback=self.widget.dump_phase_name)

        self.cb_symmetry = orangegui.comboBox(container,
                                              self,
                                              "symmetry",
                                              label="Symmetry",
                                              items=Symmetry.tuple(),
                                              callback=self.set_symmetry,
                                              orientation="horizontal")

        OWGenericWidget.create_box_in_widget(self,
                                             container,
                                             "a",
                                             "a [nm]",
                                             add_callback=True,
                                             min_value=0.0,
                                             min_accepted=False,
                                             trim=5)
    def get_phase(self):
        phase = GSASIIPhase.init_cube(a0=OWGenericWidget.get_fit_parameter_from_widget(self, "a", self.get_parameters_prefix()),
                                      symmetry=self.cb_symmetry.currentText(),
                                      cif_file=self.cif_file,
                                      formula=congruence.checkEmptyString(self.formula, "Chemical Formula"),
                                      intensity_scale_factor=OWGenericWidget.get_fit_parameter_from_widget(self, "intensity_scale_factor", self.get_parameters_prefix()),
                                      name=self.phase_name,
                                      progressive=self.get_parameter_progressive())

        return phase
    def set_data(self, phase):
        OWGenericWidget.populate_fields_in_widget(self, "a", phase.a)
        OWGenericWidget.populate_fields_in_widget(self, "intensity_scale_factor", phase.intensity_scale_factor)
        self.cif_file = phase.cif_file
        self.formula = phase.formula

        simmetries = Symmetry.tuple()
        for index in range(0, len(simmetries)):
            if simmetries[index] == phase.symmetry:
                self.symmetry = index

        self.set_symmetry()

        self.phase_name = phase.name
Esempio n. 4
0
    def init_gui(self, container):
        gui.lineEdit(container,
                     self,
                     "phase_name",
                     "Phase Name (will appear in tabs and plots)",
                     labelWidth=260,
                     valueType=str,
                     callback=self.widget.dump_phase_name)

        self.cb_symmetry = orangegui.comboBox(container,
                                              self,
                                              "symmetry",
                                              label="Symmetry",
                                              items=Symmetry.tuple(),
                                              callback=self.set_symmetry,
                                              orientation="horizontal")

        OWGenericWidget.create_box_in_widget(self,
                                             container,
                                             "a",
                                             "a [nm]",
                                             add_callback=True,
                                             min_value=0.0,
                                             min_accepted=False,
                                             trim=5)

        orangegui.separator(container)

        structure_box = gui.widgetBox(container,
                                      "",
                                      orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH)

        gui.lineEdit(structure_box,
                     self,
                     "formula",
                     "Chemical Formula",
                     labelWidth=110,
                     valueType=str,
                     callback=self.widget.dump_formula)

        OWGenericWidget.create_box_in_widget(self,
                                             structure_box,
                                             "intensity_scale_factor",
                                             "I0",
                                             add_callback=True,
                                             min_value=0.0,
                                             min_accepted=False,
                                             trim=5)
Esempio n. 5
0
 def get_phase(self):
     return Phase.init_cube(
         a0=OWGenericWidget.get_fit_parameter_from_widget(
             self, "a", self.get_parameters_prefix()),
         symmetry=self.cb_symmetry.currentText(),
         name=self.phase_name,
         progressive=self.get_parameter_progressive())
Esempio n. 6
0
    def set_data(self, phase):
        if phase.use_structure:
            raise ValueError(
                "This Phase widget doesn't work with a Structural Model, data are incompatible"
            )

        OWGenericWidget.populate_fields_in_widget(self, "a", phase.a)

        simmetries = Symmetry.tuple()
        for index in range(0, len(simmetries)):
            if simmetries[index] == phase.symmetry:
                self.symmetry = index

        self.set_symmetry()

        self.phase_name = phase.name
Esempio n. 7
0
    def set_data(self, phase):
        if not phase.use_structure:
            raise ValueError(
                "This Phase widget works with a Structural Model, data are incompatible"
            )

        OWGenericWidget.populate_fields_in_widget(self, "a", phase.a)
        OWGenericWidget.populate_fields_in_widget(self,
                                                  "intensity_scale_factor",
                                                  phase.intensity_scale_factor)
        self.formula = phase.formula

        simmetries = Symmetry.tuple()
        for index in range(0, len(simmetries)):
            if simmetries[index] == phase.symmetry:
                self.symmetry = index

        self.set_symmetry()

        self.phase_name = phase.name
    def init_gui(self, container):
        gui.lineEdit(container, self, "phase_name", "Phase Name (will appear in tabs and plots)", labelWidth=260, valueType=str, callback=self.widget.dump_phase_name)

        self.cb_symmetry = orangegui.comboBox(container, self, "symmetry", label="Symmetry", items=Symmetry.tuple(),
                                              callback=self.set_symmetry, orientation="horizontal")

        OWGenericWidget.create_box_in_widget(self, container, "a", "a [nm]", add_callback=True, min_value=0.0,
                                             min_accepted=False, trim=5)

        orangegui.separator(container)

        structure_box = gui.widgetBox(container,
                                      "", orientation="vertical",
                                      width=self.CONTROL_AREA_WIDTH)

        self.structure_box_1 = gui.widgetBox(structure_box,
                                             "", orientation="vertical",
                                             width=self.CONTROL_AREA_WIDTH - 5, height=90)

        file_box = gui.widgetBox(self.structure_box_1, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH-10)

        self.le_cif_file = gui.lineEdit(file_box, self, value="cif_file", valueType=str, label="CIF File", labelWidth=50, callback=self.widget.dump_cif_file)
        orangegui.button(file_box, self, "...", callback=self.open_folders)

        gui.lineEdit(self.structure_box_1, self, "formula", "Chemical Formula", labelWidth=110, valueType=str,
                     callback=self.widget.dump_formula)

        OWGenericWidget.create_box_in_widget(self, self.structure_box_1, "intensity_scale_factor", "I0",
                                             add_callback=True, min_value=0.0, min_accepted=False, trim=5)

        text_area_box = gui.widgetBox(structure_box, "Calculation Result", orientation="vertical", height=165, width=self.CONTROL_AREA_WIDTH - 10)

        self.text_area = gui.textArea(height=125, width=self.CONTROL_AREA_WIDTH - 30, readOnly=True)
        self.text_area.setText("")

        text_area_box.layout().addWidget(self.text_area)

        self.is_on_init = False