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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 4
0
    def __init__(self):
        super().__init__()

        self.runaction = OWAction("Compute", self)
        self.runaction.triggered.connect(self.compute)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(QRect(round(geom.width()*0.05),
                               round(geom.height()*0.05),
                               round(min(geom.width()*0.98, self.MAX_WIDTH)),
                               round(min(geom.height()*0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        box0 = gui.widgetBox(self.controlArea, "", orientation="horizontal")
        #widget buttons: compute, set defaults, help
        gui.button(box0, self, "Compute", callback=self.compute)
        gui.button(box0, self, "Defaults", callback=self.defaults)
        gui.button(box0, self, "Help", callback=self.help1)

        gui.separator(self.controlArea, height=10)

        self.build_gui()

        self.process_showers()

        gui.rubber(self.controlArea)

        self.main_tabs = gui.tabWidget(self.mainArea)
        plot_tab = gui.createTabPage(self.main_tabs, "Results")
        out_tab = gui.createTabPage(self.main_tabs, "Output")

        view_box = oasysgui.widgetBox(plot_tab, "Results Options", addSpace=False, orientation="horizontal")
        view_box_1 = oasysgui.widgetBox(view_box, "", addSpace=False, orientation="vertical", width=350)

        self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="View Results",
                                            labelWidth=220,
                                            items=["No", "Yes"],
                                            callback=self.set_ViewType, sendSelectedValue=False, orientation="horizontal")

        self.tab = []
        self.tabs = gui.tabWidget(plot_tab)

        self.initializeTabs()

        self.xoppy_output = QtGui.QTextEdit()
        self.xoppy_output.setReadOnly(True)

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.xoppy_output)

        self.xoppy_output.setFixedHeight(600)
        self.xoppy_output.setFixedWidth(600)

        gui.rubber(self.mainArea)
    def __init__(self):
        super().__init__(show_automatic_box=True)

        self.setFixedHeight(310)

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

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

        gui.button(button_box,
                   self,
                   "Send Fit Initialization",
                   height=40,
                   callback=self.send_fit_initialization)

        fft_box = gui.widgetBox(main_box,
                                "FFT",
                                orientation="vertical",
                                width=self.CONTROL_AREA_WIDTH - 30)

        gui.lineEdit(fft_box,
                     self,
                     "s_max",
                     "S_max [nm-1]",
                     labelWidth=250,
                     valueType=float,
                     validator=QDoubleValidator())

        self.cb_n_step = orangegui.comboBox(
            fft_box,
            self,
            "n_step",
            label="FFT Steps",
            labelWidth=350,
            items=["1024", "2048", "4096", "8192", "16384", "32768", "65536"],
            sendSelectedValue=True,
            orientation="horizontal")
        orangegui.comboBox(fft_box,
                           self,
                           "fft_type",
                           label="FFT Type",
                           items=FFTTypes.tuple(),
                           orientation="horizontal")

        orangegui.rubber(self.controlArea)

        runaction = OWAction("Send Fit Initialization", self)
        runaction.triggered.connect(self.send_fit_initialization)
        self.addAction(runaction)
    def __init__(self):
        super(FluxCalculator, self).__init__()

        self.runaction = OWAction("Calculate Flux", self)
        self.runaction.triggered.connect(self.calculate_flux)
        self.addAction(self.runaction)

        self.setMaximumWidth(self.CONTROL_AREA_WIDTH + 10)
        self.setMaximumHeight(580)

        box0 = gui.widgetBox(self.controlArea, "", orientation="horizontal")
        gui.button(box0,
                   self,
                   "Calculate Flux",
                   callback=self.calculate_flux,
                   height=45)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(440)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 8)

        tab_out = oasysgui.createTabPage(tabs_setting,
                                         "Flux Calculation Results")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        self.text = oasysgui.textArea(width=self.CONTROL_AREA_WIDTH - 22,
                                      height=400)

        tab_out.layout().addWidget(self.text)

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.usage_path))

        usage_box.layout().addWidget(label)

        gui.rubber(self.controlArea)
Ejemplo n.º 7
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)
Ejemplo n.º 9
0
    def __init__(self):
        super().__init__()

        self.runaction = OWAction("Submit Request", self)
        self.runaction.triggered.connect(self.submit)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.leftWidgetPart.setSizePolicy(
            QSizePolicy(QSizePolicy.MinimumExpanding,
                        QSizePolicy.MinimumExpanding))
        self.leftWidgetPart.setMaximumWidth(self.getLeftPartWidth())
        self.leftWidgetPart.updateGeometry()
Ejemplo n.º 10
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(400)
        self.setFixedHeight(240)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        left_box_1 = oasysgui.widgetBox(self.controlArea,
                                        "Loop Management",
                                        addSpace=True,
                                        orientation="vertical",
                                        width=380,
                                        height=120)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "number_of_new_objects",
                          "Number of new " + self.get_object_name() + "s",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_new_object",
            "Current New " + self.get_object_name(),
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        gui.separator(left_box_1)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "seed_increment",
                          "Source Montecarlo Seed Increment",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        gui.rubber(self.controlArea)
    def __init__(self):
        super().__init__()

        #/ Make GUI ----------------------------------------------------------------------------------------------------
        self.runaction = OWAction("Import Simulated Array", self)
        self.runaction.triggered.connect(self.selectFile)
        self.addAction(self.runaction)

        self.runaction = OWAction("Generate Height Profile File", self)
        self.runaction.triggered.connect(self.interp_save)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        gui.separator(self.controlArea)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        button = gui.button(button_box,
                            self,
                            "Import Simulated\nArray",
                            callback=self.selectFile)
        button.setFixedHeight(45)

        button = gui.button(button_box,
                            self,
                            "Generate Height\nProfile File",
                            callback=self.interp_save)
        font = QFont(button.font())
        font.setBold(True)
        button.setFont(font)
        palette = QPalette(button.palette())  # make a copy of the palette
        button.setFixedHeight(45)
        button.setFixedWidth(150)

        button = gui.button(button_box,
                            self,
                            "Reset Fields",
                            callback=self.call_reset_settings)
        button.setFixedHeight(45)

        #/ Control area ------------------------------------------------------------------------------------------------

        gui.separator(self.controlArea)

        tabs_setting = oasysgui.tabWidget(self.controlArea)
        tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5)

        tab_input = oasysgui.createTabPage(tabs_setting, "Input Parameters")
        tab_out = oasysgui.createTabPage(tabs_setting, "Output")
        tab_usa = oasysgui.createTabPage(tabs_setting, "Use of the Widget")
        tab_usa.setStyleSheet("background-color: white;")

        usage_box = oasysgui.widgetBox(tab_usa,
                                       "",
                                       addSpace=True,
                                       orientation="horizontal")

        label = QLabel("")
        label.setAlignment(Qt.AlignCenter)
        label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        label.setPixmap(QPixmap(self.get_usage_path()))

        usage_box.layout().addWidget(label)

        #/ ---------------------------------------

        select_file_box_1 = oasysgui.widgetBox(tab_input,
                                               "",
                                               addSpace=True,
                                               orientation="horizontal")
        self.wi_simFE_fname = oasysgui.lineEdit(select_file_box_1,
                                                self,
                                                "simFE_fname",
                                                "Input Array Path",
                                                labelWidth=120,
                                                valueType=str,
                                                orientation="horizontal")

        input_box = oasysgui.widgetBox(tab_input,
                                       "Transformation settings",
                                       addSpace=True,
                                       orientation="vertical")

        gui.comboBox(input_box,
                     self,
                     "unit",
                     label="Unit",
                     labelWidth=260,
                     items=["m", "cm"],
                     callback=None,
                     sendSelectedValue=False,
                     orientation="horizontal")

        gui.separator(input_box)
        gui.separator(input_box)

        gui.comboBox(input_box,
                     self,
                     "method",
                     label="Select method",
                     labelWidth=260,
                     items=["Spacing", "Number of points"],
                     callback=self.set_Method,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.method_box_1 = oasysgui.widgetBox(input_box,
                                               "",
                                               addSpace=True,
                                               orientation="vertical",
                                               height=70)

        self.method_box_1_1 = oasysgui.widgetBox(self.method_box_1,
                                                 "",
                                                 addSpace=True,
                                                 orientation="vertical")
        self.wi_spacing_value = oasysgui.lineEdit(self.method_box_1_1,
                                                  self,
                                                  "spacing_value",
                                                  "Spacing size",
                                                  labelWidth=260,
                                                  valueType=float,
                                                  orientation="horizontal")

        self.method_box_1_2 = oasysgui.widgetBox(self.method_box_1,
                                                 "",
                                                 addSpace=True,
                                                 orientation="vertical")
        self.wi_noPts_x = oasysgui.lineEdit(self.method_box_1_2,
                                            self,
                                            "noPts_x",
                                            "X",
                                            labelWidth=260,
                                            valueType=int,
                                            orientation="horizontal")
        self.wi_noPts_y = oasysgui.lineEdit(self.method_box_1_2,
                                            self,
                                            "noPts_y",
                                            "Y",
                                            labelWidth=260,
                                            valueType=int,
                                            orientation="horizontal")

        self.set_Method()

        output_box = oasysgui.widgetBox(tab_input,
                                        "Output settings",
                                        addSpace=True,
                                        orientation="vertical")
        select_file_box_2 = oasysgui.widgetBox(output_box,
                                               "",
                                               addSpace=True,
                                               orientation="horizontal")
        self.wi_save_height_profile_file_name = oasysgui.lineEdit(
            select_file_box_2,
            self,
            "save_height_profile_file_name",
            "Output Array Path",
            labelWidth=120,
            valueType=str,
            orientation="horizontal")
        gui.button(select_file_box_2,
                   self,
                   "Browse",
                   callback=self.selectFile_save)

        gui.rubber(self.controlArea)

        self.shadow_output = oasysgui.textArea()

        out_box = oasysgui.widgetBox(tab_out,
                                     "System Output",
                                     addSpace=True,
                                     orientation="horizontal",
                                     height=580)
        out_box.layout().addWidget(self.shadow_output)

        gui.rubber(self.controlArea)

        self.figure, (self.axis, self.cax) = subplots(
            1, 2, gridspec_kw={'width_ratios': [95, 5]}, figsize=(600, 600))
        self.cax.grid()

        self.figure_canvas = FigureCanvasQTAgg(self.figure)
        self.mainArea.layout().addWidget(self.figure_canvas)

        gui.rubber(self.mainArea)
Ejemplo n.º 12
0
    def build_gui(self):
        runaction = OWAction("Find Best Focus Position", self)
        runaction.triggered.connect(self.do_best_focus_calculation)
        self.addAction(runaction)

        runaction = OWAction("Interrupt Best Focus Calculation", self)
        runaction.triggered.connect(self.stop_best_focus_calculation)
        self.addAction(runaction)

        self.view_type = 1
        self.button_box.setVisible(False)

        self.tabs_setting = oasysgui.tabWidget(self.controlArea)
        self.tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT)
        self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5)

        self.tab_bas = oasysgui.createTabPage(self.tabs_setting, "Detector Setting")
        self.tab_pro = oasysgui.createTabPage(self.tabs_setting, "Advanced Setting")

        main_box = oasysgui.widgetBox(self.tab_bas, "Detector Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-20)

        oasysgui.lineEdit(main_box, self, "detector_size", "Detector Size [" + u"\u03BC" + "m]", labelWidth=240, valueType=float, orientation="horizontal")

        gui.separator(main_box)

        gui.comboBox(main_box, self, "calculation_type", label="Numeric Integration",
                     items=["Automatic Number of Points", "User Defined Number of Points"], labelWidth=140,
                     callback=self.set_CalculationType, sendSelectedValue=False, orientation="horizontal")

        self.detector_box = oasysgui.widgetBox(main_box, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH-40, height=30)

        le_calculated_number_of_points = oasysgui.lineEdit(self.detector_box, self, "calculated_number_of_points", "Calculated Number of Points", labelWidth=240, valueType=float, orientation="horizontal")
        le_calculated_number_of_points.setReadOnly(True)
        font = QFont(le_calculated_number_of_points.font())
        font.setBold(True)
        le_calculated_number_of_points.setFont(font)
        palette = QPalette(le_calculated_number_of_points.palette())
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 140))
        le_calculated_number_of_points.setPalette(palette)

        self.number_box = oasysgui.widgetBox(main_box, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH-40, height=30)

        oasysgui.lineEdit(self.number_box, self, "number_of_points", "Number of Points", labelWidth=240, valueType=int, orientation="horizontal")

        self.set_CalculationType()

        self.le_oe_f2 = oasysgui.lineEdit(main_box, self, "oe_f2", "O.E. F2", labelWidth=240, valueType=float, orientation="horizontal")
        self.le_oe_f2.setReadOnly(True)
        font = QFont(self.le_oe_f2.font())
        font.setBold(True)
        self.le_oe_f2.setFont(font)
        palette = QPalette(self.le_oe_f2.palette())
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 140))
        self.le_oe_f2.setPalette(palette)

        self.le_defocus_sweep = oasysgui.lineEdit(main_box, self, "defocus_sweep", "Defocus sweep", labelWidth=240, valueType=float, orientation="horizontal")

        gui.button(main_box, self, "Compute", callback=self.compute, height=35)

        best_focus_box = oasysgui.widgetBox(self.tab_bas, "Best Focus Calculation", orientation="vertical", width=self.CONTROL_AREA_WIDTH-20)

        self.le_defocus_start = oasysgui.lineEdit(best_focus_box, self, "defocus_start", "Defocus sweep start", labelWidth=240, valueType=float, orientation="horizontal")
        self.le_defocus_stop  = oasysgui.lineEdit(best_focus_box, self, "defocus_stop", "Defocus sweep stop", labelWidth=240, valueType=float, orientation="horizontal")
        self.le_defocus_step  = oasysgui.lineEdit(best_focus_box, self, "defocus_step", "Defocus sweep step", labelWidth=240, valueType=float, orientation="horizontal")

        gui.separator(best_focus_box, height=5)

        gui.checkBox(best_focus_box, self, "show_animation", "Show animation during calculation")

        gui.separator(best_focus_box, height=5)


        button_box = oasysgui.widgetBox(best_focus_box, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH-40)

        gui.button(button_box, self, "Find Best Focus Position", callback=self.do_best_focus_calculation, height=35)
        stop_button = gui.button(button_box, self, "Interrupt", callback=self.stop_best_focus_calculation, height=35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette()) # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette) # assign new palette

        self.save_button = gui.button(best_focus_box, self, "Save Best Focus Calculation Complete Results", callback=self.save_best_focus_results, height=35)
        self.save_button.setEnabled(False)

        parallel_box = oasysgui.widgetBox(self.tab_pro, "Parallel Computing", orientation="vertical", width=self.CONTROL_AREA_WIDTH-20)

        gui.comboBox(parallel_box, self, "use_multipool", label="Use Parallel Processing",
                     items=["No", "Yes"], labelWidth=240,
                     callback=self.set_Multipool, sendSelectedValue=False, orientation="horizontal")

        self.use_multipool_box = oasysgui.widgetBox(parallel_box, "", addSpace=True, orientation="vertical", height=30, width=self.CONTROL_AREA_WIDTH-40)
        self.use_multipool_box_empty = oasysgui.widgetBox(parallel_box, "", addSpace=True, orientation="vertical", height=30, width=self.CONTROL_AREA_WIDTH-40)

        oasysgui.lineEdit(self.use_multipool_box, self, "n_pools", "Nr. Parallel Processes", labelWidth=240, valueType=int, orientation="horizontal")

        self.set_Multipool()

        self.best_focus_slider = None
Ejemplo n.º 13
0
    def __init__(self):
        super(TotalFilterCalculator, self).__init__()

        self.runaction = OWAction("Calculate Total Filter", self)
        self.runaction.triggered.connect(self.calculate_total_filter)
        self.addAction(self.runaction)

        self.setFixedWidth(1200)
        self.setFixedHeight(710)

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        box0 = oasysgui.widgetBox(self.controlArea,
                                  "",
                                  orientation="horizontal",
                                  width=self.CONTROL_AREA_WIDTH - 5)
        gui.button(box0,
                   self,
                   "Calculate Total Filter",
                   callback=self.calculate_total_filter,
                   height=45)

        box1 = oasysgui.widgetBox(self.controlArea,
                                  "Energy Range",
                                  orientation="vertical",
                                  width=self.CONTROL_AREA_WIDTH - 5)

        oasysgui.lineEdit(box1,
                          self,
                          "energy_from",
                          "Energy From [eV]",
                          labelWidth=250,
                          orientation="horizontal",
                          valueType=float)
        oasysgui.lineEdit(box1,
                          self,
                          "energy_to",
                          "Energy to [eV]",
                          labelWidth=250,
                          orientation="horizontal",
                          valueType=float)
        oasysgui.lineEdit(box1,
                          self,
                          "energy_nr",
                          "Nr. of energies",
                          labelWidth=250,
                          orientation="horizontal",
                          valueType=int)

        box1 = oasysgui.widgetBox(self.controlArea,
                                  "Input Data",
                                  orientation="vertical",
                                  width=self.CONTROL_AREA_WIDTH - 5)

        items = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]

        def build_combo(container,
                        master,
                        field_name,
                        label,
                        has_combo=True,
                        combo_field_name=None,
                        cb_items=items):
            box = gui.widgetBox(container, "", orientation="horizontal")
            gui.checkBox(box,
                         master,
                         "check_" + field_name,
                         label="" if has_combo else label)
            if has_combo:
                gui.comboBox(
                    box,
                    master,
                    "n_" +
                    field_name if not combo_field_name else combo_field_name,
                    label=label,
                    items=cb_items,
                    labelWidth=350,
                    sendSelectedValue=False,
                    orientation="horizontal")
            box.setEnabled(False)

            return box

        self.cb_ref_1 = build_combo(box1,
                                    self,
                                    "ref_1",
                                    label="Nr. of Mirror Reflectivity #1")
        self.cb_ref_2 = build_combo(box1,
                                    self,
                                    "ref_2",
                                    label="Nr. of Mirror Reflectivity #2")
        self.cb_ref_3 = build_combo(box1,
                                    self,
                                    "ref_3",
                                    label="Nr. of Mirror Reflectivity #3")

        gui.separator(box1)

        self.cb_dif_1 = build_combo(box1,
                                    self,
                                    "dif_1",
                                    label="Nr. of Diffraction Profile #1")
        self.cb_dif_2 = build_combo(box1,
                                    self,
                                    "dif_2",
                                    label="Nr. of Diffraction Profile #2")

        gui.separator(box1)

        self.cb_mul_1 = build_combo(box1,
                                    self,
                                    "mul_1",
                                    label="Nr. of MultiLayer Reflectivity #1")
        self.cb_mul_2 = build_combo(box1,
                                    self,
                                    "mul_2",
                                    label="Nr. of MultiLayer Reflectivity #2")

        gui.separator(box1)

        self.cb_pow_1 = build_combo(box1,
                                    self,
                                    "pow_1",
                                    label="Power Widget Input",
                                    combo_field_name="abs_tran",
                                    cb_items=["Absorbed", "Transmitted"])

        gui.rubber(self.controlArea)

        tabs = oasysgui.tabWidget(self.mainArea)
        tabs.setFixedHeight(self.height() - 15)
        tabs.setFixedWidth(770)

        tab_fil = oasysgui.createTabPage(tabs, "Total Filter")

        self.filter_plot = oasysgui.plotWindow(tab_fil, position=True)
        self.filter_plot.setFixedHeight(self.height() - 60)
        self.filter_plot.setFixedWidth(760)
        self.filter_plot.setGraphXLabel("Energy [eV]")
        self.filter_plot.setGraphYLabel("Intensity Factor")
        self.filter_plot.setGraphTitle("Total Filter")
    def __init__(self):
        self.runaction = OWAction("Start Loop", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Interrupt", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(400)
        self.setFixedHeight(365)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start Loop",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(45)

        stop_button = gui.button(button_box,
                                 self,
                                 "Interrupt",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(45)
        font = QtGui.QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QtGui.QPalette(
            stop_button.palette())  # make a copy of the palette
        palette.setColor(QtGui.QPalette.ButtonText, QtGui.QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        left_box_1 = oasysgui.widgetBox(self.controlArea,
                                        "Loop Management",
                                        addSpace=True,
                                        orientation="vertical",
                                        width=380,
                                        height=280)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_name",
                          "Variable Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_display_name",
                          "Variable Display Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_um",
                          "Variable Units",
                          labelWidth=250,
                          valueType=str,
                          orientation="horizontal")

        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_value_from",
                          "Value From",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal",
                          callback=self.calculate_step)
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_value_to",
                          "Value to",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal",
                          callback=self.calculate_step)
        oasysgui.lineEdit(left_box_1,
                          self,
                          "number_of_new_objects",
                          "Number of Steps",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal",
                          callback=self.calculate_step)

        self.le_variable_value_step = oasysgui.lineEdit(
            left_box_1,
            self,
            "variable_value_step",
            "Step Value",
            labelWidth=250,
            valueType=float,
            orientation="horizontal")
        self.le_variable_value_step.setReadOnly(True)
        font = QtGui.QFont(self.le_variable_value_step.font())
        font.setBold(True)
        self.le_variable_value_step.setFont(font)
        palette = QtGui.QPalette(self.le_variable_value_step.palette()
                                 )  # make a copy of the palette
        palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue'))
        palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160))
        self.le_variable_value_step.setPalette(palette)

        gui.separator(left_box_1)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_new_object",
            "Current New " + self.get_object_name(),
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QtGui.QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QtGui.QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue'))
        palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_variable_value",
            "Current Variable Value",
            labelWidth=250,
            valueType=float,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QtGui.QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QtGui.QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue'))
        palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        gui.rubber(self.controlArea)
Ejemplo n.º 15
0
    def __init__(self):
        super().__init__()

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(
            QRect(round(geom.width() * 0.05), round(geom.height() * 0.05),
                  round(min(geom.width() * 0.98, self.MAX_WIDTH)),
                  round(min(geom.height() * 0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.runaction = OWAction("Run Action", self)
        self.runaction.triggered.connect(self.run_action)
        self.addAction(self.runaction)

        # CONTROL AREA
        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        general_options_box = oasysgui.widgetBox(self.controlArea,
                                                 "General Options",
                                                 addSpace=True,
                                                 orientation="vertical",
                                                 width=400)

        oasysgui.lineEdit(general_options_box,
                          self,
                          "field_1",
                          label="Field 1",
                          labelWidth=250,
                          addSpace=False,
                          valueType=float,
                          orientation="horizontal")

        oasysgui.lineEdit(general_options_box,
                          self,
                          "field_2",
                          label="Field 2",
                          labelWidth=250,
                          addSpace=False,
                          valueType=str,
                          orientation="horizontal")

        gui.comboBox(general_options_box,
                     self,
                     "field_3",
                     label="Field 3",
                     items=["Option 1", "Option 2", "Option 3", "Option 4"],
                     sendSelectedValue=False,
                     orientation="horizontal",
                     callback=self.set_field_3)

        gui.radioButtons(general_options_box,
                         self,
                         "field_4",
                         ["Option 1", "Option 2", "Option 3", "Option 4"],
                         callback=self.set_field_4)

        gui.checkBox(general_options_box, self, 'field_5', 'Field 5')

        file_box = oasysgui.widgetBox(general_options_box,
                                      "",
                                      addSpace=False,
                                      orientation="horizontal",
                                      height=25)

        self.le_file = oasysgui.lineEdit(file_box,
                                         self,
                                         "file",
                                         label="some file",
                                         addSpace=False,
                                         orientation="horizontal")

        gui.button(file_box, self, "...", callback=self.select_file)

        text_area_box = oasysgui.widgetBox(general_options_box,
                                           "",
                                           addSpace=False,
                                           orientation="vertical",
                                           width=390,
                                           height=330)

        self.text_area = oasysgui.textArea(height=320,
                                           width=380,
                                           readOnly=False)
        self.text_area.setText(self.notes)
        self.text_area.textChanged.connect(self.set_text_area)

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

        gui.separator(general_options_box)

        gui.button(general_options_box,
                   self,
                   "Run Action",
                   callback=self.run_action,
                   height=45)

        self.call_callbacks()

        # MAIN AREA
        self.main_tabs = oasysgui.tabWidget(self.mainArea)

        plot_tab = oasysgui.createTabPage(self.main_tabs, "Plots")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")
Ejemplo n.º 16
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(400)
        self.setFixedHeight(440)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        left_box_1 = oasysgui.widgetBox(self.controlArea,
                                        "Loop Management",
                                        addSpace=True,
                                        orientation="vertical",
                                        width=385,
                                        height=320)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_name",
                          "Variable Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_display_name",
                          "Variable Display Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_um",
                          "Variable Units",
                          labelWidth=250,
                          valueType=str,
                          orientation="horizontal")

        gui.separator(left_box_1)

        gui.comboBox(left_box_1,
                     self,
                     "kind_of_loop",
                     label="Kind of Loop",
                     labelWidth=350,
                     items=["From Range", "From List"],
                     callback=self.set_KindOfLoop,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.left_box_1_1 = oasysgui.widgetBox(left_box_1,
                                               "",
                                               addSpace=False,
                                               orientation="vertical",
                                               width=365,
                                               height=100)
        self.left_box_1_2 = oasysgui.widgetBox(left_box_1,
                                               "",
                                               addSpace=False,
                                               orientation="vertical",
                                               width=365,
                                               height=100)

        oasysgui.lineEdit(self.left_box_1_1,
                          self,
                          "variable_value_from",
                          "Value From",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal",
                          callback=self.calculate_step)
        oasysgui.lineEdit(self.left_box_1_1,
                          self,
                          "variable_value_to",
                          "Value to",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal",
                          callback=self.calculate_step)
        oasysgui.lineEdit(self.left_box_1_1,
                          self,
                          "number_of_new_objects",
                          "Number of Steps",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal",
                          callback=self.calculate_step)

        self.list_of_values_ta = oasysgui.textArea(height=100,
                                                   width=365,
                                                   readOnly=False)
        self.list_of_values_ta.textChanged.connect(
            self.list_of_values_ta_changed)

        text = ""
        for value in self.list_of_values:
            text += value + "\n"

        self.list_of_values_ta.setText(text[:-1])
        self.left_box_1_2.layout().addWidget(self.list_of_values_ta)

        self.le_variable_value_step = oasysgui.lineEdit(
            self.left_box_1_1,
            self,
            "variable_value_step",
            "Step Value",
            labelWidth=250,
            valueType=float,
            orientation="horizontal")
        self.le_variable_value_step.setReadOnly(True)
        font = QFont(self.le_variable_value_step.font())
        font.setBold(True)
        self.le_variable_value_step.setFont(font)
        palette = QPalette(self.le_variable_value_step.palette()
                           )  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_variable_value_step.setPalette(palette)

        self.set_KindOfLoop()
        self.calculate_step()

        gui.separator(left_box_1)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_new_object",
            "Current New " + self.get_object_name(),
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_variable_value",
            "Current Variable Value",
            labelWidth=250,
            valueType=float,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        gui.rubber(self.controlArea)
Ejemplo n.º 17
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(400)
        self.setFixedHeight(500)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        left_box_1 = oasysgui.widgetBox(self.controlArea,
                                        "Loop Management",
                                        addSpace=True,
                                        orientation="vertical",
                                        width=380,
                                        height=380)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_name",
                          "Variable Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")
        oasysgui.lineEdit(left_box_1,
                          self,
                          "variable_display_name",
                          "Variable Display Name",
                          labelWidth=100,
                          valueType=str,
                          orientation="horizontal")

        box_files = oasysgui.widgetBox(left_box_1,
                                       "",
                                       addSpace=False,
                                       orientation="vertical",
                                       height=170)

        gui.button(box_files,
                   self,
                   "Select Height Error Profile Data Files",
                   callback=self.select_files)

        self.files_area = oasysgui.textArea(height=120, width=360)

        self.refresh_files_text_area()

        box_files.layout().addWidget(self.files_area)

        gui.separator(left_box_1)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_new_object",
            "Current New " + self.get_object_name(),
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        self.le_current_new_object = oasysgui.lineEdit(
            left_box_1,
            self,
            "current_variable_value",
            "Current Variable Value",
            labelWidth=250,
            valueType=str,
            orientation="horizontal")
        self.le_current_new_object.setReadOnly(True)
        font = QFont(self.le_current_new_object.font())
        font.setBold(True)
        self.le_current_new_object.setFont(font)
        palette = QPalette(
            self.le_current_new_object.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_current_new_object.setPalette(palette)

        gui.rubber(self.controlArea)
Ejemplo n.º 18
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)
Ejemplo n.º 19
0
    def __init__(self):
        super().__init__()

        self.runaction = OWAction("Compute", self)
        self.runaction.triggered.connect(self.compute)
        self.addAction(self.runaction)

        geom = QApplication.desktop().availableGeometry()
        self.setGeometry(QRect(round(geom.width()*0.05),
                               round(geom.height()*0.05),
                               round(min(geom.width()*0.98, self.MAX_WIDTH)),
                               round(min(geom.height()*0.95, self.MAX_HEIGHT))))

        self.setMaximumHeight(self.geometry().height())
        self.setMaximumWidth(self.geometry().width())

        self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH)

        self.general_options_box = gui.widgetBox(self.controlArea, "General Options", addSpace=True, orientation="horizontal")
        gui.checkBox(self.general_options_box, self, 'is_automatic_run', 'Automatic Execution')

        self.button_box = gui.widgetBox(self.controlArea, "", orientation="horizontal")
        #widget buttons: compute, set defaults, help
        gui.button(self.button_box, self, "Compute", callback=self.compute, height=35)
        gui.button(self.button_box, self, "Defaults", callback=self.defaults, height=35)

        gui.separator(self.controlArea, height=10)

        self.build_gui()

        gui.rubber(self.controlArea)

        self.main_tabs = oasysgui.tabWidget(self.mainArea)
        plot_tab = oasysgui.createTabPage(self.main_tabs, "Results")
        out_tab = oasysgui.createTabPage(self.main_tabs, "Output")

        self.view_box = oasysgui.widgetBox(plot_tab, "Results Options", addSpace=False, orientation="horizontal")
        view_box_1 = oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical", width=350)

        self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="View Results",
                                            labelWidth=220,
                                            items=["No", "Yes"],
                                            callback=self.set_ViewType, sendSelectedValue=False, orientation="horizontal")

        oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical", width=100)


        #* -------------------------------------------------------------------------------------------------------------
        propagation_box = oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical")

        self.le_wise_live_propagation_mode = gui.lineEdit(propagation_box, self, "wise_live_propagation_mode", "Propagation Mode", labelWidth=150, valueType=str, orientation="horizontal")
        self.le_wise_live_propagation_mode.setAlignment(Qt.AlignCenter)
        self.le_wise_live_propagation_mode.setReadOnly(True)
        font = QFont(self.le_wise_live_propagation_mode.font())
        font.setBold(True)
        self.le_wise_live_propagation_mode.setFont(font)

        self.set_wise_live_propagation_mode()

        #* -------------------------------------------------------------------------------------------------------------

        self.tab = []
        self.tabs = oasysgui.tabWidget(plot_tab)

        self.initializeTabs()

        self.wise_output = QtWidgets.QTextEdit()
        self.wise_output.setReadOnly(True)
        self.wise_output.setStyleSheet("background-color: white;")

        out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal")
        out_box.layout().addWidget(self.wise_output)

        self.wise_output.setFixedHeight(590)
        self.wise_output.setFixedWidth(700)

        gui.rubber(self.mainArea)
Ejemplo n.º 20
0
    def __init__(self):
        self.runaction = OWAction("Start", self)
        self.runaction.triggered.connect(self.startLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Stop", self)
        self.runaction.triggered.connect(self.stopLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Suspend", self)
        self.runaction.triggered.connect(self.suspendLoop)
        self.addAction(self.runaction)

        self.runaction = OWAction("Restart", self)
        self.runaction.triggered.connect(self.restartLoop)
        self.addAction(self.runaction)

        self.setFixedWidth(1200)
        self.setFixedHeight(710)

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        self.start_button = gui.button(button_box,
                                       self,
                                       "Start",
                                       callback=self.startLoop)
        self.start_button.setFixedHeight(35)

        stop_button = gui.button(button_box,
                                 self,
                                 "Stop",
                                 callback=self.stopLoop)
        stop_button.setFixedHeight(35)
        font = QFont(stop_button.font())
        font.setBold(True)
        stop_button.setFont(font)
        palette = QPalette(stop_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('red'))
        stop_button.setPalette(palette)  # assign new palette

        self.stop_button = stop_button

        button_box = oasysgui.widgetBox(self.controlArea,
                                        "",
                                        addSpace=True,
                                        orientation="horizontal")

        suspend_button = gui.button(button_box,
                                    self,
                                    "Suspend",
                                    callback=self.suspendLoop)
        suspend_button.setFixedHeight(35)
        font = QFont(suspend_button.font())
        font.setBold(True)
        suspend_button.setFont(font)
        palette = QPalette(
            suspend_button.palette())  # make a copy of the palette
        palette.setColor(QPalette.ButtonText, QColor('orange'))
        suspend_button.setPalette(palette)  # assign new palette

        self.re_start_button = gui.button(button_box,
                                          self,
                                          "Restart",
                                          callback=self.restartLoop)
        self.re_start_button.setFixedHeight(35)
        self.re_start_button.setEnabled(False)

        tabs = oasysgui.tabWidget(self.controlArea)
        tab_loop = oasysgui.createTabPage(tabs, "Loop Management")
        tab_und = oasysgui.createTabPage(tabs, "Undulator")

        left_box_2 = oasysgui.widgetBox(tab_und,
                                        "Parameters From Syned",
                                        addSpace=False,
                                        orientation="vertical",
                                        width=385,
                                        height=560)

        oasysgui.lineEdit(left_box_2,
                          self,
                          "electron_energy",
                          "Ring Energy [GeV]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "number_of_periods",
                          "Number of Periods",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "period_length",
                          "Undulator Period [m]",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "K_vertical",
                          "K Vertical",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)
        oasysgui.lineEdit(left_box_2,
                          self,
                          "K_horizontal",
                          "K Horizontal",
                          labelWidth=260,
                          valueType=float,
                          orientation="horizontal").setReadOnly(True)

        left_box_1 = oasysgui.widgetBox(tab_loop,
                                        "",
                                        addSpace=False,
                                        orientation="vertical",
                                        width=385,
                                        height=560)

        oasysgui.lineEdit(left_box_1,
                          self,
                          "seed_increment",
                          "Source Montecarlo Seed Increment",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")

        gui.separator(left_box_1)

        gui.comboBox(left_box_1,
                     self,
                     "autobinning",
                     label="Energy Binning",
                     items=[
                         "Manual", "Automatic (Constant Power)",
                         "Automatic (Constant Energy)"
                     ],
                     labelWidth=150,
                     callback=self.set_Autobinning,
                     sendSelectedValue=False,
                     orientation="horizontal")

        self.autobinning_box_1 = oasysgui.widgetBox(left_box_1,
                                                    "",
                                                    addSpace=False,
                                                    orientation="vertical",
                                                    height=50)
        self.autobinning_box_2 = oasysgui.widgetBox(left_box_1,
                                                    "",
                                                    addSpace=False,
                                                    orientation="vertical",
                                                    height=140)

        # ----------------------------------------------

        gui.button(self.autobinning_box_1,
                   self,
                   "Compute Bins",
                   callback=self.calculate_energy_binnings)

        oasysgui.widgetLabel(self.autobinning_box_1,
                             "Energy From, Energy To, Energy Step [eV]")

        # ----------------------------------------------

        oasysgui.lineEdit(self.autobinning_box_2,
                          self,
                          "auto_n_step",
                          "Number of Steps",
                          labelWidth=250,
                          valueType=int,
                          orientation="horizontal")
        oasysgui.lineEdit(self.autobinning_box_2,
                          self,
                          "auto_perc_total_power",
                          "% Total Power",
                          labelWidth=250,
                          valueType=float,
                          orientation="horizontal")
        gui.comboBox(self.autobinning_box_2,
                     self,
                     "send_power_step",
                     label="Send Power Step",
                     items=["No", "Yes"],
                     labelWidth=350,
                     sendSelectedValue=False,
                     orientation="horizontal")

        button_box = oasysgui.widgetBox(self.autobinning_box_2,
                                        "",
                                        addSpace=False,
                                        orientation="horizontal")

        gui.button(button_box,
                   self,
                   "Reload Spectrum and Filters",
                   callback=self.read_spectrum_and_filters_file)
        gui.button(button_box,
                   self,
                   "Reload Spectrum Only",
                   callback=self.read_spectrum_file_only)

        oasysgui.widgetLabel(
            self.autobinning_box_2,
            "Energy Value [eV], Energy Step [eV], Power Step [W]")

        def write_text():
            self.energies = self.text_area.toPlainText()

        self.text_area = oasysgui.textArea(height=95,
                                           width=385,
                                           readOnly=False)
        self.text_area.setText(self.energies)
        self.text_area.setStyleSheet(
            "background-color: white; font-family: Courier, monospace;")
        self.text_area.textChanged.connect(write_text)

        left_box_1.layout().addWidget(self.text_area)

        gui.separator(left_box_1)

        self.le_number_of_new_objects = oasysgui.lineEdit(
            left_box_1,
            self,
            "total_new_objects",
            "Total Energy Values",
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_number_of_new_objects.setReadOnly(True)
        font = QFont(self.le_number_of_new_objects.font())
        font.setBold(True)
        self.le_number_of_new_objects.setFont(font)
        palette = QPalette(self.le_number_of_new_objects.palette()
                           )  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_number_of_new_objects.setPalette(palette)

        self.le_number_of_new_objects = oasysgui.lineEdit(
            left_box_1,
            self,
            "number_of_new_objects",
            "Current Binning Energy Values",
            labelWidth=250,
            valueType=int,
            orientation="horizontal")
        self.le_number_of_new_objects.setReadOnly(True)
        font = QFont(self.le_number_of_new_objects.font())
        font.setBold(True)
        self.le_number_of_new_objects.setFont(font)
        palette = QPalette(self.le_number_of_new_objects.palette()
                           )  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        self.le_number_of_new_objects.setPalette(palette)

        gui.separator(left_box_1)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "total_current_new_object",
                                             "Total New " +
                                             self.get_object_name(),
                                             labelWidth=250,
                                             valueType=int,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "current_new_object",
                                             "Current Binning New " +
                                             self.get_object_name(),
                                             labelWidth=250,
                                             valueType=int,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        le_current_value = oasysgui.lineEdit(left_box_1,
                                             self,
                                             "current_energy_value",
                                             "Current Energy Value",
                                             labelWidth=250,
                                             valueType=float,
                                             orientation="horizontal")
        le_current_value.setReadOnly(True)
        font = QFont(le_current_value.font())
        font.setBold(True)
        le_current_value.setFont(font)
        palette = QPalette(
            le_current_value.palette())  # make a copy of the palette
        palette.setColor(QPalette.Text, QColor('dark blue'))
        palette.setColor(QPalette.Base, QColor(243, 240, 160))
        le_current_value.setPalette(palette)

        gui.rubber(self.controlArea)

        tabs = oasysgui.tabWidget(self.mainArea)
        tabs.setFixedHeight(self.height() - 15)
        tabs.setFixedWidth(775)

        tab_plot = oasysgui.createTabPage(tabs, "Cumulated Power")
        tab_flux = oasysgui.createTabPage(tabs, "Spectral Flux")
        tab_fil = oasysgui.createTabPage(tabs, "Filter")

        self.cumulated_power_plot = oasysgui.plotWindow(tab_plot,
                                                        position=True)
        self.cumulated_power_plot.setFixedHeight(self.height() - 20)
        self.cumulated_power_plot.setFixedWidth(775)
        self.cumulated_power_plot.setGraphXLabel("Energy [eV]")
        self.cumulated_power_plot.setGraphYLabel("Cumulated Power [W]")
        self.cumulated_power_plot.setGraphTitle("Cumulated Power")

        self.spectral_flux_plot = oasysgui.plotWindow(tab_flux, position=True)
        self.spectral_flux_plot.setFixedHeight(self.height() - 20)
        self.spectral_flux_plot.setFixedWidth(775)
        self.spectral_flux_plot.setGraphXLabel("Energy [eV]")
        self.spectral_flux_plot.setGraphYLabel("Flux [ph/s/.1%bw]")
        self.spectral_flux_plot.setGraphTitle("Spectral Flux")

        self.filter_plot = oasysgui.plotWindow(tab_fil, position=True)
        self.filter_plot.setFixedHeight(self.height() - 20)
        self.filter_plot.setFixedWidth(775)
        self.filter_plot.setGraphXLabel("Energy [eV]")
        self.filter_plot.setGraphYLabel("Intensity Factor")
        self.filter_plot.setGraphTitle("Filter on Flux")

        self.set_Autobinning()