def __init__(self): self.setFixedWidth(300) self.setFixedHeight(100) gui.separator(self.controlArea, height=20) gui.label(self.controlArea, self, " SIMPLE PASSAGE POINT", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.corpus = None self.nyt_api = None self.output_info = '' self.num_retrieved = 0 self.num_all = 0 # API key self.api_dlg = self.APICredentialsDialog(self) self.api_dlg.accept(silent=True) gui.button(self.controlArea, self, 'Article API Key', callback=self.api_dlg.exec_, focusPolicy=Qt.NoFocus) # Query query_box = gui.widgetBox(self.controlArea, 'Query', addSpace=True) self.query_box = QueryBox(query_box, self, self.recent_queries, callback=self.new_query_input) # Year box date_box = gui.hBox(query_box) DatePickerInterval(date_box, self, 'date_from', 'date_to', min_date=MIN_DATE, max_date=date.today(), margin=(0, 3, 0, 0)) # Text includes features self.controlArea.layout().addWidget( CheckListLayout('Text includes', self, 'text_includes', self.attributes, cols=2, callback=self.set_text_features)) # Output info_box = gui.hBox(self.controlArea, 'Output') gui.label(info_box, self, 'Articles: %(output_info)s') # Buttons self.button_box = gui.hBox(self.controlArea) self.search_button = gui.button(self.button_box, self, 'Search', self.start_stop, focusPolicy=Qt.NoFocus)
def __init__(self): self.setFixedWidth(300) self.setFixedHeight(100) gui.separator(self.controlArea, height=20) gui.label(self.controlArea, self, " LOST RAYS REMOVER", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self): self.setFixedWidth(300) self.setFixedHeight(100) gui.separator(self.controlArea, height=20) gui.label(self.controlArea, self, " Spectrum Saver", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self): self.setFixedWidth(300) self.setFixedHeight(100) gui.separator(self.controlArea, height=20) gui.label(self.controlArea, self, " Preprocessor Data Adapter", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self): self.setFixedWidth(600) self.setFixedHeight(100) gui.separator(self.controlArea, height=20) gui.label( self.controlArea, self, " CONVERSION POINT: PolarizedPhotonBunch <-> ShadowOuiBeam", orientation="horizontal") gui.rubber(self.controlArea)
def __init__(self, image_url): super(FigureWidget, self).__init__() self.setFixedWidth(600) self.setFixedHeight(600) box_general = oasysgui.widgetBox(self, "", addSpace=False, orientation="vertical", width=600, height=600) gui.separator(box_general, height=30) box_top = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="vertical", width=600, height=50) title = gui.label(box_top, self, " Standing Waves plot") font = QFont(title.font()) font.setBold(True) font.setPointSize(36) palette = QPalette(title.palette()) palette.setColor(QPalette.Foreground, QColor('blue')) title.setFont(font) title.setPalette(palette) gui.separator(box_general, height=10) box_center = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="horizontal", width=600) box_label = oasysgui.widgetBox(box_center, "", addSpace=False, orientation="vertical", width=50) oasysgui.widgetBox(box_label, "", addSpace=False, orientation="vertical", height=50) label_y_axis = VerticalLabel("Incidence Angle", 200, 50) font = QFont(label_y_axis.font()) font.setBold(True) font.setPointSize(24) label_y_axis.setFont(font) #label_y_axis.setFixedHeight(200) #label_y_axis.setFixedWidth(50) box_label.layout().addWidget(label_y_axis) image_label = QLabel(box_center) image = QImage() image.loadFromData(HttpManager.send_xray_server_direct_request("/" + image_url, decode=False)) image_label.setPixmap(QPixmap(image)) box_center.layout().addWidget(image_label) box_bottom = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="horizontal", width=600) label_x_axis = gui.label(box_bottom, self, " Offset [Å]") font = QFont(label_x_axis.font()) font.setBold(True) font.setPointSize(24) label_x_axis.setFont(font)
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.CONTROL_AREA_WIDTH+10)), round(min(geom.height()*0.95, 100)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) label = gui.label(self.controlArea, self, "From Oasys Surface To Shadow Surface") font = QFont(label.font()) font.setBold(True) font.setItalic(True) font.setPixelSize(14) label.setFont(font) palette = QPalette(label.palette()) # make a copy of the palette palette.setColor(QPalette.Foreground, QColor('Dark Blue')) label.setPalette(palette) # assign new palette gui.separator(self.controlArea, 10) gui.button(self.controlArea, self, "Convert", callback=self.convert_surface, height=45)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Run Simulation", self) self.runaction.triggered.connect(self.run_simulation) 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.5, self.MAX_WIDTH)), round(min(geom.height()*0.5, self.MAX_HEIGHT)))) label_box = ShadowGui.widgetBox(self.controlArea, "", orientation="horizontal") gui.separator(label_box, height=50) gui.label(label_box, self, " JUST A DEMO WIDGET!!!!!") gui.separator(label_box, height=50) self.left_box_1 = ShadowGui.widgetBox(self.controlArea, "Electron Beam", addSpace=True, orientation="vertical") ShadowGui.lineEdit(self.left_box_1, self, "lens_position", "Position on beamline", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_1, self, "focal_x", "Focal length (horizontal) [m]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_1, self, "focal_y", "Focal length (vertical) [m]", labelWidth=300, valueType=float, orientation="horizontal") button_box = ShadowGui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Simulation", callback=self.run_simulation) font = QFont(button.font()) font.setBold(True) button.setFont(font) palette = QPalette(button.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Blue')) button.setPalette(palette) # assign new palette button.setFixedHeight(45) button = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings) font = QFont(button.font()) font.setItalic(True) button.setFont(font) palette = QPalette(button.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Red')) button.setPalette(palette) # assign new palette button.setFixedHeight(45) button.setFixedWidth(100) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.first = self.second = None self.product = None self.result = gui.label(self.controlArea, self, "%(first)s times %(second)s is %(product)s", box="Result") self.result.hide()
def draw_specific_box(self): self.crystal_box = oasysgui.widgetBox(self.tab_bas, "Crystal Setting", addSpace=False, orientation="vertical") oasysgui.lineEdit(self.crystal_box, self, "d_spacing", "d-spacing [Å]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.crystal_box, self, "asymmetry_angle", "Asymmetry Angle [rad]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.crystal_box, self, "thickness", "Crystal Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal") polarization_box = oasysgui.widgetBox(self.crystal_box, "Crystal Polarizability", addSpace=False, orientation="horizontal") polarization_box_l = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vertical", width=200) polarization_box_r = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vartical") gui.label(polarization_box_l, self, " Real Part") oasysgui.lineEdit(polarization_box_l, self, "psi_0r" , "X0", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_l, self, "psi_hr" , "Xh \u03c3", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_l, self, "psi_hbr", "Xh \u03c0", labelWidth=50, valueType=float, orientation="horizontal") gui.label(polarization_box_r, self, "Imaginary Part") oasysgui.lineEdit(polarization_box_r, self, "psi_0i", "", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_r, self, "psi_hi", "", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_r, self, "psi_hbi", "", labelWidth=50, valueType=float, orientation="horizontal") self.notes_area = oasysgui.textArea(height=40, width=370) self.notes_area.setText(self.notes) self.crystal_box.layout().addWidget(self.notes_area) tab_usa = oasysgui.createTabPage(self.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.usage_path)) usage_box.layout().addWidget(label)
def __init__(self): super().__init__() self.n = None self.product = 0 gui.radioButtonsInBox(self.controlArea, self, "factor", ("None", "Double", "Triple", "Quadruple"), box="Multiply", callback=self.do_multiply) self.result = gui.label(self.controlArea, self, "The product is %(product)i", box="Result") self.result.hide() gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.in_data = None self.in_distance = None self.in_learner = None self.in_classifier = None self.in_object = None # MODIFIED BY LUCA REBUFFI 14/10/2014 #self.auto_execute = False for s in self.libraryListSource: s.flags = 0 self._cachedDocuments = {} self.infoBox = gui.widgetBox(self.controlArea, 'Info') gui.label( self.infoBox, self, "<p>Execute python script.</p><p>Input variables:<ul><li> " + \ "<li>".join(t.name for t in self.inputs) + \ "</ul></p><p>Output variables:<ul><li>" + \ "<li>".join(t.name for t in self.outputs) + \ "</ul></p>" ) self.libraryList = itemmodels.PyListModel( [], self, flags=Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable) self.libraryList.wrap(self.libraryListSource) self.controlBox = gui.widgetBox(self.controlArea, 'Library') self.controlBox.layout().setSpacing(1) self.libraryView = QListView( editTriggers=QListView.DoubleClicked | QListView.EditKeyPressed, sizePolicy=QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) ) self.libraryView.setItemDelegate(ScriptItemDelegate(self)) self.libraryView.setModel(self.libraryList) self.libraryView.selectionModel().selectionChanged.connect( self.onSelectedScriptChanged ) self.controlBox.layout().addWidget(self.libraryView) w = itemmodels.ModelActionsWidget() self.addNewScriptAction = action = QAction("+", self) action.setToolTip("Add a new script to the library") action.triggered.connect(self.onAddScript) w.addAction(action) action = QAction(unicodedata.lookup("MINUS SIGN"), self) action.setToolTip("Remove script from library") action.triggered.connect(self.onRemoveScript) w.addAction(action) action = QAction("Update", self) action.setToolTip("Save changes in the editor to library") action.setShortcut(QKeySequence(QKeySequence.Save)) action.triggered.connect(self.commitChangesToLibrary) w.addAction(action) action = QAction("More", self, toolTip="More actions") new_from_file = QAction("Import a script from a file", self) save_to_file = QAction("Save selected script to a file", self) save_to_file.setShortcut(QKeySequence(QKeySequence.SaveAs)) new_from_file.triggered.connect(self.onAddScriptFromFile) save_to_file.triggered.connect(self.saveScript) menu = QMenu(w) menu.addAction(new_from_file) menu.addAction(save_to_file) action.setMenu(menu) button = w.addAction(action) button.setPopupMode(QToolButton.InstantPopup) w.layout().setSpacing(1) self.controlBox.layout().addWidget(w) self.runBox = gui.widgetBox(self.controlArea, 'Run') gui.button(self.runBox, self, "Execute", callback=self.execute) gui.checkBox(self.runBox, self, "auto_execute", "Auto execute", tooltip="Run the script automatically whenever " + "the inputs to the widget change.") self.splitCanvas = QSplitter(Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(self.splitCanvas) self.defaultFont = defaultFont = \ "Monaco" if sys.platform == "darwin" else "Courier" self.textBox = gui.widgetBox(self, 'Python script') self.splitCanvas.addWidget(self.textBox) self.text = PythonScriptEditor(self) self.textBox.layout().addWidget(self.text) self.textBox.setAlignment(Qt.AlignVCenter) self.text.setTabStopWidth(4) self.text.modificationChanged[bool].connect(self.onModificationChanged) self.saveAction = action = QAction("&Save", self.text) action.setToolTip("Save script to file") action.setShortcut(QKeySequence(QKeySequence.Save)) action.setShortcutContext(Qt.WidgetWithChildrenShortcut) action.triggered.connect(self.saveScript) self.consoleBox = gui.widgetBox(self, 'Console') self.splitCanvas.addWidget(self.consoleBox) self.console = PythonConsole(self.__dict__, self) self.consoleBox.layout().addWidget(self.console) self.console.document().setDefaultFont(QFont(defaultFont)) self.consoleBox.setAlignment(Qt.AlignBottom) self.console.setTabStopWidth(4) select_row(self.libraryView, self.currentScriptIndex) self.splitCanvas.setSizes([2, 1]) if self.splitterState is not None: self.splitCanvas.restoreState(QByteArray(self.splitterState)) self.splitCanvas.splitterMoved[int, int].connect(self.onSpliterMoved) self.controlArea.layout().addStretch(1) self.resize(800, 600)
def draw_specific_box(self): self.filter_box = oasysgui.widgetBox(self.tab_bas, "Zone Plate Setting", addSpace=True, orientation="vertical") oasysgui.lineEdit(self.filter_box, self, "total_number_of_zones", "Total Number of Zones", labelWidth=260, valueType=int, orientation="horizontal") oasysgui.lineEdit(self.filter_box, self, "outer_zone_radius", "Outer Zone Radius [m]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.filter_box, self, "thickness", "Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.filter_box) oasysgui.lineEdit(self.filter_box, self, "x", "Horizontal coordinate of center [m]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.filter_box, self, "y", "Vertical coordinate of center [m]", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.filter_box) material_box = oasysgui.widgetBox(self.filter_box, "Materials", addSpace=True, orientation="vertical") gui.label(material_box, self, "\"Main\":") oasysgui.lineEdit(material_box, self, "delta_main_material", "Refractive index decrement", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(material_box, self, "attenuation_length_main_material", "Attenuation length [m]", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(material_box) gui.label(material_box, self, "\"Complementary\":") oasysgui.lineEdit(material_box, self, "delta_complementary_material", "Refractive index decrement", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(material_box, self, "attenuation_length_complementary_material", "Attenuation length [m]", labelWidth=260, valueType=float, orientation="horizontal")
def __init__(self, widget=None, widget_container=None, parent=None, diffraction_pattern_index = 0, phase_index = 0, reflections_of_phase = "", limit = 0.0, limit_type = 0): super(ReflectionsOfPhaseBox, self).__init__() self.setLayout(QVBoxLayout()) self.layout().setAlignment(Qt.AlignTop) self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 55) self.setFixedHeight(430) self.widget = widget self.diffraction_pattern_index = diffraction_pattern_index self.phase_index = phase_index self.reflections_of_phase = reflections_of_phase self.limit = limit self.limit_type = limit_type self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH-65 parent.layout().addWidget(self) container = self gen_box = gui.widgetBox(container, "Generate Reflections", orientation="horizontal") le_limit = gui.lineEdit(gen_box, self, "limit", "Limit", labelWidth=90, valueType=float, validator=QDoubleValidator(), callback=widget_container.dump_limits) cb_limit = orangegui.comboBox(gen_box, self, "limit_type", label="Kind", items=["None", "Nr. Peaks", "2Theta Max"], orientation="horizontal") def set_limit(limit_type): if limit_type == 0: le_limit.setText("-1") le_limit.setEnabled(False) else: le_limit.setEnabled(True) if not self.is_on_init: widget_container.dump_limits() widget_container.dump_limit_types() cb_limit.currentIndexChanged.connect(set_limit) set_limit(self.limit_type) gui.button(gen_box, self, "Generate Reflections", callback=self.generate_reflections) reflection_box = gui.widgetBox(container, "Reflections", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 10) orangegui.label(reflection_box, self, "h, k, l, <name> value <min minimum> <max maximum> or < fixed> or <name := function>") scrollarea = QScrollArea(reflection_box) scrollarea.setMaximumWidth(self.CONTROL_AREA_WIDTH - 40) scrollarea.setMinimumWidth(self.CONTROL_AREA_WIDTH - 40) def write_text(): self.reflections_of_phase = self.text_area.toPlainText() if not self.is_on_init: widget_container.dump_reflections_of_phases() self.text_area = gui.textArea(height=500, width=5000, readOnly=False) self.text_area.setText(self.reflections_of_phase) self.text_area.textChanged.connect(write_text) scrollarea.setWidget(self.text_area) scrollarea.setWidgetResizable(1) reflection_box.layout().addWidget(scrollarea, alignment=Qt.AlignHCenter) self.is_on_init = False
def __init__(self): super().__init__() gui.label(self.controlArea, self, "PUT YOUR INPUT FORM HERE") self.figure_canvas = None
def __init__(self): super().__init__() left_box_1 = oasysgui.widgetBox(self.controlArea, "GID_SL Request Form", addSpace=False, orientation="vertical", width=500, height=680) self.central_tabs = oasysgui.tabWidget(left_box_1) tab_template = oasysgui.createTabPage(self.central_tabs, "Template Options") tab_input = oasysgui.createTabPage(self.central_tabs, "Input Options") left_box_1_1 = oasysgui.widgetBox(tab_template, "", addSpace=False, orientation="vertical", width=480, height=670) gui.separator(left_box_1_1) gui.comboBox(left_box_1_1, self, "template_type", label="Template Type", labelWidth=100, items=["Simplified (coplanar geometries only)", "Full"], callback=self.set_TemplateType, sendSelectedValue=False, orientation="horizontal") self.simplified_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons(self.simplified_box, self, "simplified_form", ["Symmetric Bragg diffraction from perfect crystals", "Symmetric Bragg diffraction from multilayers and superlattices", "Symmetric Bragg diffraction at Bragg angle of 90 degrees (\"back diffraction\")", "Energy scanning of symmetric Bragg diffraction peaks"], callback=self.set_SimplifiedForm) self.full_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons(self.full_box, self, "full_form", ["Symmetric Bragg diffraction from perfect crystals", "Symmetric Bragg diffraction from multilayers and superlattices", "Coplanar extremely asymmetric diffraction of synchrotron radiation", "Grazing incidence (\"surface\") diffraction from perfect crystals", "Grazing incidence (\"surface\") diffraction from multilayers in the scheme\nwith position sensitive detector (PSD)", "Non-coplanar Bragg-Laue diffraction from crystals with a few degrees\nsurface miscut"], callback=self.set_FullForm) # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- gui.separator(tab_input) left_box_2 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_2_1 = oasysgui.widgetBox(left_box_2, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(left_box_2_1, self, "xway", label="X-rays specified by", items=["Wavelength (Å)", "Energy (keV)", "Bragg angle (deg)", "X-ray line"], callback=self.set_xway, sendSelectedValue=False, orientation="horizontal") self.box_wave = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) gui.lineEdit(self.box_wave, self, "wave", label="", labelWidth=0, addSpace=False, valueType=float, orientation="horizontal") self.box_line = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) XRayServerGui.combobox_text(self.box_line, self, "line", label="", labelWidth=0, items=self.get_lines(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.line) button = gui.button(self.box_line, self, "?", callback=self.help_lines) button.setFixedWidth(15) self.set_xway() gui.comboBox(left_box_2_1, self, "ipol", label="Polarization", items=["Sigma", "Pi", "Mixed"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- left_box_3 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_3_1 = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) XRayServerGui.combobox_text(left_box_3_1, self, "code", label="Crystal", labelWidth=40, items=self.get_crystals(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.code) button = gui.button(left_box_3_1, self, "?", callback=self.help_crystals) button.setFixedWidth(15) gui.comboBox(left_box_3_1, self, "df1df2", label=" ", labelWidth=20, items=["Auto DB for f\', f\'\'", "X0h data (0.5-2.5 A)", "Henke (0.4-1200 A)", "Brennan (0.02-400 A)"], sendSelectedValue=False, orientation="horizontal") left_box_3_2 = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) gui.lineEdit(left_box_3_2, self, "sigma", label="Sigma", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") gui.lineEdit(left_box_3_2, self, "w0", label="A W0", labelWidth=50, addSpace=False, valueType=float, orientation="horizontal") gui.lineEdit(left_box_3_2, self, "wh", label=" Wh", labelWidth=50, addSpace=False, valueType=float, orientation="horizontal") # ------------------------------------------------------------- left_box_4 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=470) left_box_4_1 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="horizontal", width=240) gui.lineEdit(left_box_4_1, self, "i1", label="Bragg Reflection", labelWidth=97, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(left_box_4_1, self, "i2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(left_box_4_1, self, "i3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") left_box_4_2 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="horizontal", width=228) gui.lineEdit(left_box_4_2, self, "daa", label=" Substrate da/a", labelWidth=135, addSpace=False, valueType=float, orientation="horizontal") # ------------------------------------------------------------- # ------------------------------------------------------------- self.simplified_input_box = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470, height=290) gui.comboBox(self.simplified_input_box, self, "igie", label="Geometry specified by", items=["angle of Bragg planes to surface ('+' for g0>gh)", "incidence angle of K0", "exit angle of Kh", "asymmetry factor beta=g0/gh"], callback=self.set_igie_s, sendSelectedValue=False, orientation="horizontal") simplified_input_box_1 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) gui.lineEdit(simplified_input_box_1, self, "fcentre", label="Value", labelWidth=280, addSpace=False, valueType=float, orientation="horizontal") self.unic_combo_s = gui.comboBox(simplified_input_box_1, self, "unic", label=" ", labelWidth=1, items=[" ", "degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") self.set_igie_s() simplified_input_box_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) gui.lineEdit(simplified_input_box_2, self, "scanmin", label="Scan: From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") gui.lineEdit(simplified_input_box_2, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") self.simplified_input_box_scan_1_1 = oasysgui.widgetBox(simplified_input_box_2, "", addSpace=False, orientation="horizontal") gui.comboBox(self.simplified_input_box_scan_1_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") gui.lineEdit(self.simplified_input_box_scan_1_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") self.simplified_input_box_scan_1_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) gui.checkBox(self.simplified_input_box_scan_1_2, self, "invert", "Invert axis", labelWidth=190) gui.comboBox(self.simplified_input_box_scan_1_2, self, "column", label="Plot argument", labelWidth=100, items=["scan angle", "incidence angle", "exit angle"], sendSelectedValue=False, orientation="horizontal") self.simplified_input_box_scan_2_1 = oasysgui.widgetBox(simplified_input_box_2, "", addSpace=False, orientation="horizontal") self.unis_combo_s = gui.comboBox(self.simplified_input_box_scan_2_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad", "eV"], sendSelectedValue=False, orientation="horizontal") gui.lineEdit(self.simplified_input_box_scan_2_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") self.simplified_input_box_scan_2_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal") gui.comboBox(self.simplified_input_box_scan_2_2, self, "axis", label="Scan Type", labelWidth=290, items=["[k0 x h]", "Energy (eV)", "Energy (eV), no X0h recalc"], sendSelectedValue=False, orientation="horizontal", callback=self.set_scan_type_s) self.set_scan_type_s() # ------------------------------------------------------------- # ------------------------------------------------------------- self.full_input_box = oasysgui.widgetBox(tab_input, "", addSpace=True, orientation="vertical", width=470, height=290) gui.comboBox(self.full_input_box, self, "igie", label="Geom. by", labelWidth=60, items=["[1]. Surface orientation & incidence angle of K0", "[2]. Surface orientation & exit angle of Kh", "[3]. Surface orientation & condition of coplanar grazing incidence", "[4]. Surface orientation & condition of coplanar grazing exit", "[5]. Surface orientation & condition of symmetric Bragg case", "[6]. Condition of coplanar reflection & angle of Bragg planes to surface", "[7]. Condition of coplanar reflection & incidence angle of K0", "[8]. Condition of coplanar reflection & exit angle of Kh", "[9]. Condition of coplanar reflection & asymmetry factor beta=g0/gh"], callback=self.set_igie_f, sendSelectedValue=False, orientation="horizontal") gui.label(self.full_input_box, self, "-- Geom. parameter ([1,7]=incidence angle, [2,8]=exit angle, [6]=Bragg planes") full_input_box_1 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_1_1 = oasysgui.widgetBox(full_input_box_1, "", addSpace=False, orientation="horizontal", width=470) self.le_fcentre = gui.lineEdit(full_input_box_1_1, self, "fcentre", label=" angle, [9]=g0/gh)", labelWidth=250, addSpace=False, valueType=float, orientation="horizontal") self.unic_combo_f = gui.comboBox(full_input_box_1_1, self, "unic", label=" ", labelWidth=1, items=[" ", "degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") self.set_igie_f() full_input_box_1_2 = oasysgui.widgetBox(full_input_box_1, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(full_input_box_1_2, self, "n1", label="-- Surface plane ([1-5])", labelWidth=135, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(full_input_box_1_2, self, "n2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(full_input_box_1_2, self, "n3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") full_input_box_2 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="horizontal", width=470) full_input_box_2_1 = oasysgui.widgetBox(full_input_box_2, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(full_input_box_2_1, self, "m1", label="Miscut direction", labelWidth=135, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(full_input_box_2_1, self, "m2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") gui.lineEdit(full_input_box_2_1, self, "m3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") full_input_box_2_2 = oasysgui.widgetBox(full_input_box_2, "", addSpace=False, orientation="horizontal") gui.lineEdit(full_input_box_2_2, self, "miscut", label="Miscut angle", addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(full_input_box_2_2, self, "unim", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") full_input_box_3 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_3_1 = oasysgui.widgetBox(full_input_box_3, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(full_input_box_3_1, self, "axis", label="Scan Type", labelWidth=190, items=["Surface normal (N_surface)", "[k0 x N_surface]", "Reciprocal latt.vector (h)", "[k0 x h]", "Other axis", "Takeoff spectrum (PSD)"], sendSelectedValue=False, orientation="horizontal", callback=self.set_scan_type_f) gui.checkBox(full_input_box_3_1, self, "invert", "Invert axis", labelWidth=90) full_input_box_3_2 = oasysgui.widgetBox(full_input_box_3, "", addSpace=False, orientation="horizontal", width=470) self.le_a1 = gui.lineEdit(full_input_box_3_2, self, "a1", label="Indices, if other scan axis", labelWidth=290, addSpace=False, valueType=int, orientation="horizontal") self.le_a2 = gui.lineEdit(full_input_box_3_2, self, "a2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") self.le_a3 = gui.lineEdit(full_input_box_3_2, self, "a3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") self.set_scan_type_f() full_input_box_5 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_5_1 = oasysgui.widgetBox(full_input_box_5, "", addSpace=False, orientation="horizontal", width=470) gui.lineEdit(full_input_box_5_1, self, "scanmin", label="Scan: From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") gui.lineEdit(full_input_box_5_1, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(full_input_box_5_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") gui.lineEdit(full_input_box_5_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") full_input_box_5_2 = oasysgui.widgetBox(full_input_box_5, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(full_input_box_5_2, self, "column", label="Plot argument", labelWidth=290, items=["scan angle", "incidence angle", "exit angle"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- box_alpha = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=280) self.le_alphamax = gui.lineEdit(box_alpha, self, "alphamax", label="Approximations: alpha_max", labelWidth=170, addSpace=False, valueType=float, orientation="horizontal") gui.label(box_alpha, self, "*|xh|") gui.separator(tab_input) # ------------------------------------------------------------- box_top = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) box_top_0 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) box_top_0_1 = oasysgui.widgetBox(box_top_0, "", addSpace=False, orientation="vertical", width=100) gui.label(box_top_0_1, self, "Top layer profile\n(optional):") button = gui.button(box_top_0_1, self, "? (sintax)", callback=self.help_profile) button.setFixedWidth(90) box_top_0_2 = oasysgui.widgetBox(box_top_0, "", addSpace=False, orientation="horizontal", width=360) self.profile_area = QtWidgets.QTextEdit() self.profile_area.setMaximumHeight(110) self.profile_area.setMaximumWidth(360) box_top_0_2.layout().addWidget(self.profile_area) box_top_labels = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) box_top_labels_1 = oasysgui.widgetBox(box_top_labels, "", addSpace=False, orientation="horizontal", width=100) gui.label(box_top_labels_1, self, "Available Codes:") box_top_labels_2 = oasysgui.widgetBox(box_top_labels, "", addSpace=False, orientation="horizontal", width=360) gui.label(box_top_labels_2, self, "Crystals") gui.label(box_top_labels_2, self, "Non-Crystals") gui.label(box_top_labels_2, self, "Elements") box_top_1 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="horizontal", width=100) box_top_1_2 = oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="horizontal", width=360) crystals_area = QtWidgets.QTextEdit() crystals_area.setMaximumHeight(100) crystals_area.setMaximumWidth(120) crystals_area.setText("\n".join(ListUtility.get_list("crystals"))) crystals_area.setReadOnly(True) non_crystals_area = QtWidgets.QTextEdit() non_crystals_area.setMaximumHeight(100) non_crystals_area.setMaximumWidth(120) non_crystals_area.setText("\n".join(ListUtility.get_list("amorphous"))) non_crystals_area.setReadOnly(True) elements_area = QtWidgets.QTextEdit() elements_area.setMaximumHeight(100) elements_area.setMaximumWidth(120) elements_area.setText("\n".join(ListUtility.get_list("atoms"))) elements_area.setReadOnly(True) box_top_1_2.layout().addWidget(crystals_area) box_top_1_2.layout().addWidget(non_crystals_area) box_top_1_2.layout().addWidget(elements_area) # ----------------------------------------------------------- button = gui.button(tab_input, self, "Submit Query!", callback=self.submit) button.setFixedHeight(30) gui.rubber(self.controlArea) self.tabs = [] self.tabs_widget = oasysgui.tabWidget(self.mainArea) self.initializeTabs() self.set_TemplateType(change_values=False) self.profile_area.textChanged.connect(self.set_profile) self.le_alphamax.focusOutEvent = self.alphamax_focusOutEvent self.alphamax_focusOutEvent(None) gui.rubber(self.mainArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Run Simulation", self) self.runaction.triggered.connect(self.run_simulation) 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.5, self.MAX_WIDTH)), round(min(geom.height()*0.5, self.MAX_HEIGHT)))) label_box = ShadowGui.widgetBox(self.controlArea, "", orientation="horizontal") gui.separator(label_box, height=50) gui.label(label_box, self, " JUST A DEMO WIDGET!!!!!") gui.separator(label_box, height=50) self.left_box_1 = ShadowGui.widgetBox(self.controlArea, "Electron Beam", addSpace=True, orientation="vertical") ShadowGui.lineEdit(self.left_box_1, self, "energy_in_GeV", "Energy [GeV]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_1, self, "energy_spread", "Energy spread (relative)", labelWidth=300, valueType=int, orientation="horizontal") ShadowGui.lineEdit(self.left_box_1, self, "current", "Current (A)", labelWidth=300, valueType=float, orientation="horizontal") gui.comboBox(self.left_box_1, self, "kind_of_beam", label="Kind of Beam", items=["General", "Pencil"], labelWidth=300, orientation="horizontal", callback=self.set_kind_of_beam) self.left_box_2 = ShadowGui.widgetBox(self.left_box_1, "", addSpace=True, orientation="vertical", height=200) ShadowGui.lineEdit(self.left_box_2, self, "electrons_per_bunch", "Number of electrons per bunch", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_xx", "Moment (spatial^2, horizontal) [m^2]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_xxp", "Moment (spatial-angular, horizontal) [m]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_xpxp", "Moment (angular^2, horizontal)", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_yy", "Moment (spatial^2, vertical) [m^2]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_yyp", "Moment (spatial-angular, vertical) [m]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_2, self, "moment_ypyp", "Moment (angular^2, vertical)", labelWidth=300, valueType=float, orientation="horizontal") self.left_box_2_hidden = ShadowGui.widgetBox(self.left_box_1, "", addSpace=True, orientation="vertical", height=200) self.set_kind_of_beam() self.left_box_3 = ShadowGui.widgetBox(self.controlArea, "Bending Magnet Parameters", addSpace=True, orientation="vertical") ShadowGui.lineEdit(self.left_box_3, self, "radius", "Magnetic Radius [m]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_3, self, "magnetic_field", "Magnetic Field [T]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_3, self, "length", "Arc length [m]", labelWidth=300, valueType=float, orientation="horizontal") self.left_box_4 = ShadowGui.widgetBox(self.controlArea, "Simulation Parameters", addSpace=True, orientation="vertical") ShadowGui.lineEdit(self.left_box_4, self, "e_min", "Energy min [eV]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.left_box_4, self, "e_max", "Energy max [eV]", labelWidth=300, valueType=float, orientation="horizontal") button_box = ShadowGui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Simulation", callback=self.run_simulation) font = QFont(button.font()) font.setBold(True) button.setFont(font) palette = QPalette(button.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Blue')) button.setPalette(palette) # assign new palette button.setFixedHeight(45) button = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings) font = QFont(button.font()) font.setItalic(True) button.setFont(font) palette = QPalette(button.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Red')) button.setPalette(palette) # assign new palette button.setFixedHeight(45) button.setFixedWidth(100) gui.rubber(self.controlArea)
def build_positioning_directive_box(self, container_box, width, element_type=ElementType.SOURCE): box = oasysgui.widgetBox(container_box, "", orientation="vertical", width=width - 20) box_combos = oasysgui.widgetBox(box, "", orientation="vertical", width=width - 20) box_Distance = oasysgui.widgetBox(box, "", orientation="vertical", width=width - 20) ''' box_GrazingAngle = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_GrazingAngle_check = oasysgui.widgetBox(box_GrazingAngle, "", orientation="horizontal", width=20) box_GrazingAngle_value = oasysgui.widgetBox(box_GrazingAngle, "", orientation="horizontal") box_Angle = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_Angle_check = oasysgui.widgetBox(box_Angle, "", orientation="horizontal", width=20) box_Angle_value = oasysgui.widgetBox(box_Angle, "", orientation="horizontal") def set_WhichAngle(): box_GrazingAngle.setVisible(getattr(self, "WhichAngle") == positioning_directives_which_angle[0]) box_Angle.setVisible(getattr(self, "WhichAngle") != positioning_directives_which_angle[0]) ''' def set_Distance_checked(): box_Distance_value.setEnabled( getattr(self, "Distance_checked") == 1) def set_XYCentre_checked(): box_XYCentre_value.setEnabled( getattr(self, "XYCentre_checked") == 1) ''' def set_GrazingAngle_checked(): box_GrazingAngle_value.setEnabled(getattr(self, "GrazingAngle_checked") == 1) def set_Angle_checked(): box_Angle_value.setEnabled(getattr(self, "Angle_checked") == 1) ''' def set_positioning_directives(): ''' This function correctly sets the positioning directives by setting correct settings for self.What, self.Where and self.ReferTo from the descriptive phrases. Possibilities are: Autofocus - self.What='centre', self.Where='downstream focus', self.ReferTo='upstream' DistanceFromSource - self.What='centre', self.Where='centre', self.ReferTo='source' Custom - allows you to set your own self.What, self.Where and self.ReferTo ''' if element_type == ElementType.SOURCE: self.Distance_checked = 0 self.UseDistance = 0 self.UseDefocus = 0 self.UseCustom = 1 self.What = None self.Where = None self.ReferTo = PositioningDirectives.ReferTo.AbsoluteReference else: self.set_UseDistance() self.set_UseDefocus() self.set_UseCustom() self.set_Orientation() if self.WhatWhereReferTo == PositioningDirectivesPhrases.Type.OasysDefault: self.What = PositioningDirectives.What.Centre self.Where = PositioningDirectives.Where.Centre self.ReferTo = PositioningDirectives.ReferTo.UpstreamElement self.UseAsReference = True elif self.WhatWhereReferTo == PositioningDirectivesPhrases.Type.Autofocus: self.What = PositioningDirectives.What.Centre self.Where = PositioningDirectives.Where.DownstreamFocus self.ReferTo = PositioningDirectives.ReferTo.UpstreamElement elif self.WhatWhereReferTo == PositioningDirectivesPhrases.Type.DistanceFromSource: self.What = PositioningDirectives.What.Centre self.Where = PositioningDirectives.Where.Centre self.ReferTo = PositioningDirectives.ReferTo.Source elif self.WhatWhereReferTo == PositioningDirectivesPhrases.Type.Custom: pass else: raise Exception( "Wrong PositioningDirectives, only WhatWhereReferTo are allowed!" ) self.use_distance_box.setVisible(self.UseDistance) self.use_distance_box_empty.setVisible(self.UseDistance) self.use_defocus_box.setVisible(self.UseDefocus) self.use_defocus_box_empty.setVisible(self.UseDefocus) self.use_custom_box.setVisible(self.UseCustom) self.use_custom_box_empty.setVisible(self.UseCustom) pass #set_WhichAngle() # Build a combo box with the choice of positioning directions phrases if element_type != ElementType.SOURCE: # le = oasysgui.lineEdit(box_Distance, self, "ReferenceOE", "Reference O.E.", labelWidth=220, # valueType=str, orientation="horizontal") # # le.setReadOnly(True) # font = QFont(le.font()) # # font.setBold(True) # le.setFont(font) # palette = QPalette(le.palette()) # palette.setColor(QPalette.Text, QColor('grey')) # palette.setColor(QPalette.Base, QColor(243, 240, 140)) # le.setPalette(palette) box_orientation = oasysgui.widgetBox(box_combos, "", orientation="horizontal", width=width - 20) gui.label(box_orientation, self, label="Orientation", labelWidth=87) gui.comboBox(box_orientation, self, "OrientationGUI", items=positioning_directives_orientation, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) box_type = oasysgui.widgetBox(box_combos, "", orientation="horizontal", width=width - 20) gui.label(box_type, self, label="Position", labelWidth=87) gui.comboBox(box_type, self, "WhatWhereReferTo", items=positioning_directives_combos, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) # Send the value gui.separator(box_combos) self.use_distance_box = oasysgui.widgetBox( box_Distance, "", orientation="horizontal", width=width - 20) self.use_distance_box_empty = oasysgui.widgetBox( box_Distance, "", orientation="horizontal", width=width - 20) self.le_Distance_default = oasysgui.lineEdit( self.use_distance_box, self, "Distance", "Distance [m]", labelWidth=220, valueType=float, orientation="horizontal") self.use_defocus_box = oasysgui.widgetBox(box_Distance, "", orientation="horizontal", width=width - 20) self.use_defocus_box_empty = oasysgui.widgetBox( box_Distance, "", orientation="horizontal", width=width - 20) self.le_defocus = oasysgui.lineEdit(self.use_defocus_box, self, "Distance", "Defocus [m]", labelWidth=220, valueType=float, orientation="horizontal") self.use_custom_box = oasysgui.widgetBox(box, "", orientation="vertical", width=width - 20) self.use_custom_box_empty = oasysgui.widgetBox( box, "", orientation="vertical", width=width - 20) box_XYDistance = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal", width=width - 20) box_Distance_check = oasysgui.widgetBox(box_XYDistance, "", orientation="horizontal", width=20) box_Distance_value = oasysgui.widgetBox(box_XYDistance, "", orientation="vertical") box_XYCentre = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal", width=width - 20) box_XYCentre_check = oasysgui.widgetBox(box_XYCentre, "", orientation="horizontal", width=20) box_XYCentre_value = oasysgui.widgetBox(box_XYCentre, "", orientation="vertical") # = oasysgui.widgetBox(box_Distance, "", orientation="vertical", width=width - 20) # self.use_custom_box_empty = oasysgui.widgetBox(box_Distance, "", orientation="horizontal", width=width - 20) box_what = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") gui.label(box_what, self, label="Place", labelWidth=87) gui.comboBox(box_what, self, "What", label="", items=positioning_directives_what, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_what, self, label=" of this O.E.", labelWidth=80) box_where = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") gui.label(box_where, self, label="at", labelWidth=87) gui.comboBox(box_where, self, "Where", label="", items=positioning_directives_where, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_where, self, label=" of", labelWidth=80) box_refer_to = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") gui.label(box_refer_to, self, label=" ", labelWidth=87) gui.comboBox(box_refer_to, self, "ReferTo", label="", items=positioning_directives_refer_to, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_refer_to, self, label=" O.E.", labelWidth=80) ''' gui.comboBox(box_combos, self, "WhichAngle", label="Type Of Angle", items=positioning_directives_which_angle, labelWidth=box_combos.width()-150, sendSelectedValue=True, orientation="horizontal", callback=set_WhichAngle) ''' gui.checkBox(box_Distance_check, self, "Distance_checked", "", callback=set_Distance_checked) gui.checkBox(box_XYCentre_check, self, "XYCentre_checked", "", callback=set_XYCentre_checked) ''' gui.checkBox(box_GrazingAngle_check, self, "GrazingAngle_checked", "", callback=set_GrazingAngle_checked) gui.checkBox(box_Angle_check, self, "Angle_checked", "", callback=set_Angle_checked) ''' set_Distance_checked() set_XYCentre_checked() ''' set_Angle_checked() set_GrazingAngle_checked() ''' self.le_Distance = oasysgui.lineEdit(box_Distance_value, self, "Distance", "Distance [m]", labelWidth=196, valueType=float, orientation="horizontal") self.le_XCentre = oasysgui.lineEdit(box_XYCentre_value, self, "XCentre", "X Centre [m]", labelWidth=196, valueType=float, orientation="horizontal") self.le_YCentre = oasysgui.lineEdit(box_XYCentre_value, self, "YCentre", "Y Centre [m]", labelWidth=196, valueType=float, orientation="horizontal") ''' oasysgui.lineEdit(box_Angle_value, self, "Angle", "Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") oasysgui.lineEdit(box_GrazingAngle_value, self, "GrazingAngle", "Grazing Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") ''' elif element_type == ElementType.SOURCE: # For source, the positioning directives are limited box_orientation = oasysgui.widgetBox(box_combos, "", orientation="horizontal", width=width - 20) gui.label(box_orientation, self, label="Orientation", labelWidth=87) gui.comboBox(box_orientation, self, "OrientationGUI", items=positioning_directives_orientation, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) box_type = oasysgui.widgetBox(box_combos, "", orientation="horizontal", width=width - 20) gui.label(box_type, self, label="Position", labelWidth=87) gui.comboBox(box_type, self, "WhatWhereReferTo", items=positioning_directives_combos_source, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) # Send the value gui.separator(box_combos) self.use_custom_box = oasysgui.widgetBox(box, "", orientation="vertical", width=width - 20) self.use_custom_box_empty = oasysgui.widgetBox( box, "", orientation="vertical", width=width - 20) box_XYCentre = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal", width=width - 20) box_XYCentre_check = oasysgui.widgetBox(box_XYCentre, "", orientation="horizontal", width=20) box_XYCentre_value = oasysgui.widgetBox(box_XYCentre, "", orientation="vertical") # = oasysgui.widgetBox(box_Distance, "", orientation="vertical", width=width - 20) # self.use_custom_box_empty = oasysgui.widgetBox(box_Distance, "", orientation="horizontal", width=width - 20) # box_what = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") # gui.label(box_what, self, label="Place", labelWidth=87) # gui.comboBox(box_what, self, "What", label="", # items=positioning_directives_what, # sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) # gui.label(box_what, self, label=" of this O.E.", labelWidth=80) # # box_where = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") # gui.label(box_where, self, label="at", labelWidth=87) # gui.comboBox(box_where, self, "Where", label="", # items=positioning_directives_where, # sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) # gui.label(box_where, self, label=" of", labelWidth=80) # # box_refer_to = oasysgui.widgetBox(self.use_custom_box, "", orientation="horizontal") # gui.label(box_refer_to, self, label=" ", labelWidth=87) # gui.comboBox(box_refer_to, self, "ReferTo", label="", # items=positioning_directives_refer_to, # sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) # gui.label(box_refer_to, self, label=" O.E.", labelWidth=80) ''' gui.comboBox(box_combos, self, "WhichAngle", label="Type Of Angle", items=positioning_directives_which_angle, labelWidth=box_combos.width()-150, sendSelectedValue=True, orientation="horizontal", callback=set_WhichAngle) ''' gui.checkBox(box_XYCentre_check, self, "XYCentre_checked", "", callback=set_XYCentre_checked) ''' gui.checkBox(box_GrazingAngle_check, self, "GrazingAngle_checked", "", callback=set_GrazingAngle_checked) gui.checkBox(box_Angle_check, self, "Angle_checked", "", callback=set_Angle_checked) ''' set_XYCentre_checked() ''' set_Angle_checked() set_GrazingAngle_checked() ''' self.le_XCentre = oasysgui.lineEdit(box_XYCentre_value, self, "XCentre", "X Centre", labelWidth=196, valueType=float, orientation="horizontal") self.le_YCentre = oasysgui.lineEdit(box_XYCentre_value, self, "YCentre", "Y Centre", labelWidth=196, valueType=float, orientation="horizontal") ''' oasysgui.lineEdit(box_Angle_value, self, "Angle", "Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") oasysgui.lineEdit(box_GrazingAngle_value, self, "GrazingAngle", "Grazing Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") ''' set_positioning_directives()
def draw_specific_box(self): self.crystal_box = oasysgui.widgetBox(self.tab_bas, "Crystal Setting", addSpace=False, orientation="vertical") oasysgui.lineEdit(self.crystal_box, self, "d_spacing", "d-spacing [Å]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.crystal_box, self, "asymmetry_angle", "Asymmetry Angle [rad]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.crystal_box, self, "thickness", "Crystal Thickness [m]", labelWidth=260, valueType=float, orientation="horizontal") polarization_box = oasysgui.widgetBox(self.crystal_box, "Crystal Polarizability", addSpace=False, orientation="horizontal") polarization_box_l = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vertical", width=200) polarization_box_r = oasysgui.widgetBox(polarization_box, "", addSpace=False, orientation="vartical") gui.label(polarization_box_l, self, " Real Part") oasysgui.lineEdit(polarization_box_l, self, "psi_0r", "X0", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_l, self, "psi_hr", "Xh \u03c3", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_l, self, "psi_hbr", "Xh \u03c0", labelWidth=50, valueType=float, orientation="horizontal") gui.label(polarization_box_r, self, "Imaginary Part") oasysgui.lineEdit(polarization_box_r, self, "psi_0i", "", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_r, self, "psi_hi", "", labelWidth=50, valueType=float, orientation="horizontal") oasysgui.lineEdit(polarization_box_r, self, "psi_hbi", "", labelWidth=50, valueType=float, orientation="horizontal") self.notes_area = oasysgui.textArea(height=40, width=370) self.notes_area.setText(self.notes) self.crystal_box.layout().addWidget(self.notes_area)
def __init__(self): super().__init__() self.in_data = None self.in_distance = None self.in_learner = None self.in_classifier = None self.in_object_1 = None self.in_object_2 = None self.in_object_3 = None self.in_object_4 = None self.in_object_5 = None self.in_object_6 = None self.in_object_7 = None self.in_object_8 = None self.in_object_9 = None self.in_object_10 = None # MODIFIED BY LUCA REBUFFI 14/10/2014 #self.auto_execute = False for s in self.libraryListSource: s.flags = 0 self._cachedDocuments = {} self.infoBox = gui.widgetBox(self.controlArea, 'Info') gui.label( self.infoBox, self, "<p>Execute python script.</p><p>Input variables:<ul><li> " + \ "<li>".join([self.inputs[0].name, ".",".",".", self.inputs[-1].name]) + \ "</ul></p><p>Output variables:<ul><li>" + \ "<li>".join(t.name for t in self.outputs) + \ "</ul></p>" ) self.optionBox = oasysgui.widgetBox(self.controlArea, 'Options') gui.comboBox(self.optionBox, self, "font_size", label="Font Size", labelWidth=120, items=self.fonts, sendSelectedValue=False, orientation="horizontal", callback=self.changeFont) self.libraryList = itemmodels.PyListModel( [], self, flags=Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable) self.libraryList.wrap(self.libraryListSource) self.controlBox = gui.widgetBox(self.controlArea, 'Library') self.controlBox.layout().setSpacing(1) self.libraryView = QListView( editTriggers=QListView.DoubleClicked | QListView.EditKeyPressed, sizePolicy=QSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)) self.libraryView.setItemDelegate(ScriptItemDelegate(self)) self.libraryView.setModel(self.libraryList) self.libraryView.selectionModel().selectionChanged.connect( self.onSelectedScriptChanged) self.controlBox.layout().addWidget(self.libraryView) w = itemmodels.ModelActionsWidget() self.addNewScriptAction = action = QAction("+", self) action.setToolTip("Add a new script to the library") action.triggered.connect(self.onAddScript) w.addAction(action) action = QAction(unicodedata.lookup("MINUS SIGN"), self) action.setToolTip("Remove script from library") action.triggered.connect(self.onRemoveScript) w.addAction(action) action = QAction("Update", self) action.setToolTip("Save changes in the editor to library") action.setShortcut(QKeySequence(QKeySequence.Save)) action.triggered.connect(self.commitChangesToLibrary) w.addAction(action) action = QAction("More", self, toolTip="More actions") new_from_file = QAction("Import a script from a file", self) save_to_file = QAction("Save selected script to a file", self) save_to_file.setShortcut(QKeySequence(QKeySequence.SaveAs)) new_from_file.triggered.connect(self.onAddScriptFromFile) save_to_file.triggered.connect(self.saveScript) menu = QMenu(w) menu.addAction(new_from_file) menu.addAction(save_to_file) action.setMenu(menu) button = w.addAction(action) button.setPopupMode(QToolButton.InstantPopup) w.layout().setSpacing(1) self.controlBox.layout().addWidget(w) self.runBox = gui.widgetBox(self.controlArea, 'Run') gui.button(self.runBox, self, "Execute", callback=self.execute) gui.checkBox(self.runBox, self, "auto_execute", "Auto execute", tooltip="Run the script automatically whenever " + "the inputs to the widget change.") self.splitCanvas = QSplitter(Qt.Vertical, self.mainArea) self.mainArea.layout().addWidget(self.splitCanvas) self.defaultFont = defaultFont = \ "Monaco" if sys.platform == "darwin" else "Courier" self.textBox = gui.widgetBox(self, 'Python script') self.splitCanvas.addWidget(self.textBox) self.text = PythonScriptEditor(self) self.textBox.layout().addWidget(self.text) self.textBox.setAlignment(Qt.AlignVCenter) self.text.setTabStopWidth(4) self.text.modificationChanged[bool].connect(self.onModificationChanged) self.saveAction = action = QAction("&Save", self.text) action.setToolTip("Save script to file") action.setShortcut(QKeySequence(QKeySequence.Save)) action.setShortcutContext(Qt.WidgetWithChildrenShortcut) action.triggered.connect(self.saveScript) self.consoleBox = gui.widgetBox(self, 'Console') self.splitCanvas.addWidget(self.consoleBox) self.console = PythonConsole(self.__dict__, self) self.consoleBox.layout().addWidget(self.console) self.console.document().setDefaultFont(QFont(defaultFont)) self.consoleBox.setAlignment(Qt.AlignBottom) self.console.setTabStopWidth(4) select_row(self.libraryView, self.currentScriptIndex) self.splitCanvas.setSizes([2, 1]) if self.splitterState is not None: self.splitCanvas.restoreState(QByteArray(self.splitterState)) self.splitCanvas.splitterMoved[int, int].connect(self.onSpliterMoved) self.controlArea.layout().addStretch(1) self.resize(800, 600) self.changeFont()
def __init__(self): super().__init__() left_box_1 = oasysgui.widgetBox(self.controlArea, "TER_SL Request Form", addSpace=False, orientation="vertical", width=500, height=680) self.central_tabs = oasysgui.tabWidget(left_box_1) tab_template = oasysgui.createTabPage(self.central_tabs, "Template Options") tab_input = oasysgui.createTabPage(self.central_tabs, "Input Options") left_box_1_1 = oasysgui.widgetBox(tab_template, "", addSpace=False, orientation="vertical", width=480, height=670) gui.separator(left_box_1_1) ter_sl_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons(ter_sl_box, self, "ter_sl_form", ["Specular reflection from perfect reflectors", "Specular reflection from multilayers", "Specular reflection from perfect reflectors + standing waves", "Specular reflection from multilayers + standing waves"], callback=self.set_TerSLForm) # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- gui.separator(tab_input) left_box_2 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_2_1 = oasysgui.widgetBox(left_box_2, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(left_box_2_1, self, "xway", label="X-rays specified by", items=["Wavelength (Å)", "Energy (keV)", "Bragg angle (deg)", "X-ray line"], callback=self.set_xway, sendSelectedValue=False, orientation="horizontal") self.box_wave = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) oasysgui.lineEdit(self.box_wave, self, "wave", label="", labelWidth=0, addSpace=False, valueType=float, orientation="horizontal") self.box_line = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) XRayServerGui.combobox_text(self.box_line, self, "line", label="", labelWidth=0, items=self.get_lines(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.line) button = gui.button(self.box_line, self, "?", callback=self.help_lines) button.setFixedWidth(15) self.set_xway() gui.comboBox(left_box_2_1, self, "ipol", label="Polarization", items=["Sigma", "Pi", "Mixed"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- left_box_3 = oasysgui.widgetBox(tab_input, "", addSpace=True, orientation="vertical", width=470) gui.separator(left_box_3, height=4) left_box_3_top = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) gui.label(left_box_3_top, self, "Substrate:") left_box_3_content = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) left_box_3_left = oasysgui.widgetBox(left_box_3_content, "", addSpace=False, orientation="vertical", width=20) left_box_3_right = oasysgui.widgetBox(left_box_3_content, "", addSpace=False, orientation="vertical", width=445) gui.radioButtons(left_box_3_left, self, "subway", [" ", " ", " "], callback=self.set_subway) self.left_box_3_1 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="horizontal", width=445) XRayServerGui.combobox_text(self.left_box_3_1, self, "code", label="Crystal", labelWidth=45, items=self.get_crystals(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.code) button = gui.button(self.left_box_3_1, self, "?", callback=self.help_crystals) button.setFixedWidth(15) gui.comboBox(self.left_box_3_1, self, "df1df2", label=" ", labelWidth=1, items=["Auto DB for f\', f\'\'", "X0h data (0.5-2.5 A)", "Henke (0.4-1200 A)", "Brennan (0.02-400 A)"], sendSelectedValue=False, orientation="horizontal") self.left_box_3_2 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="horizontal", width=445) oasysgui.lineEdit(self.left_box_3_2, self, "chem", label="Chemical Formula", labelWidth=110, addSpace=False, valueType=str, orientation="horizontal", callback=self.set_rho) oasysgui.lineEdit(self.left_box_3_2, self, "rho", label=u"\u03C1" + " (g/cm3)", labelWidth=60, addSpace=False, valueType=float, orientation="horizontal") self.left_box_3_3 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="vertical", width=445) left_box_3_3_1 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) oasysgui.lineEdit(left_box_3_3_1, self, "x0", label="Susceptibility x0 (", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_1, self, " ) format: x0=(Re(x0), Im(x0))", labelWidth=230 ) left_box_3_3_2 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) oasysgui.lineEdit(left_box_3_3_2, self, "w0", label="x0 correction: w0", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_2, self, " this is used as: x0 = w0 * x0", labelWidth=230) left_box_3_3_3 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) oasysgui.lineEdit(left_box_3_3_3, self, "sigma", label="Roughness: sigma [Å]", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_3, self, " OR ") oasysgui.lineEdit(left_box_3_3_3, self, "tr", label="Transition layer tr [Å]", labelWidth=120, addSpace=False, valueType=float, orientation="horizontal") self.set_subway() # ------------------------------------------------------------- left_box_4 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=470) left_box_4_1 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="vertical", width=470) gui.label(left_box_4_1, self, "Incidence angle limits:") left_box_4_1_1 = oasysgui.widgetBox(left_box_4_1, "", addSpace=False, orientation="horizontal", width=470) oasysgui.lineEdit(left_box_4_1_1, self, "scanmin", label=" From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_4_1_1, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(left_box_4_1_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(left_box_4_1_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") # ------------------------------------------------------------- # ------------------------------------------------------------- self.standing_waves_box = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470, height=140) self.standing_waves_box_hidden = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=470, height=140) gui.separator(self.standing_waves_box, 10) standing_waves_box_1 = oasysgui.widgetBox(self.standing_waves_box, "", addSpace=False, orientation="horizontal", width=120) gui.checkBox(standing_waves_box_1, self, "swflag", "", callback=self.set_swflag) gui.label(standing_waves_box_1, self, "Standing waves:") self.standing_waves_box_2 = oasysgui.widgetBox(self.standing_waves_box, "", addSpace=False, orientation="vertical", width=470) standing_waves_box_2_1 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(standing_waves_box_2_1, self, "swref", label="Reference interface", labelWidth=130, addSpace=False, valueType=int, orientation="horizontal") gui.label(standing_waves_box_2_1, self, " (0=surface)") standing_waves_box_2_2 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(standing_waves_box_2_2, self, "swmin", label="Start offset", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_2, self, " [Å]", labelWidth=70) standing_waves_box_2_3 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(standing_waves_box_2_3, self, "swmax", label="End offset", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_3, self, " [Å]", labelWidth=70) standing_waves_box_2_4 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(standing_waves_box_2_4, self, "swpts", label="Number of offsets", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_4, self, " (max = 401)") self.set_swflag() gui.separator(tab_input) # ------------------------------------------------------------- box_top = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) box_top_0 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=250) gui.label(box_top_0, self, "Top layer profile (optional):") button = gui.button(box_top_0, self, "? (sintax)", callback=self.help_profile) button.setFixedWidth(90) box_top_1 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) self.profile_area = QtWidgets.QTextEdit() self.profile_area.setStyleSheet("background-color: white;") self.profile_area.setMaximumHeight(240) self.profile_area.setMaximumWidth(335) self.profile_area.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) box_top_1.layout().addWidget(self.profile_area) gui.separator(box_top_1) box_top_labels = oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="vertical", width=130) gui.label(box_top_labels, self, "Available Codes:") crystals_area = QtWidgets.QTextEdit() crystals_area.setStyleSheet("background-color: white;") crystals_area.setMaximumHeight(295) crystals_area.setMaximumWidth(130) crystals_area.setText("\n".join(ListUtility.get_list("crystals"))) crystals_area.setReadOnly(True) box_top_labels.layout().addWidget(crystals_area) gui.separator(box_top) # ----------------------------------------------------------- button = gui.button(tab_input, self, "Submit Query!", callback=self.submit) button.setFixedHeight(30) gui.rubber(self.controlArea) self.tabs = [] self.tabs_widget = oasysgui.tabWidget(self.mainArea) self.initializeTabs() self.set_TerSLForm(change_values=False, switch_page=False) self.profile_area.textChanged.connect(self.set_profile)
def __init__(self, image_url): super(FigureWidget, self).__init__() self.setFixedWidth(600) self.setFixedHeight(600) box_general = oasysgui.widgetBox(self, "", addSpace=False, orientation="vertical", width=600, height=600) gui.separator(box_general, height=30) box_top = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="vertical", width=600, height=50) title = gui.label(box_top, self, " Standing Waves plot") font = QFont(title.font()) font.setBold(True) font.setPointSize(36) palette = QPalette(title.palette()) palette.setColor(QPalette.Foreground, QColor('blue')) title.setFont(font) title.setPalette(palette) gui.separator(box_general, height=10) box_center = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="horizontal", width=600) box_label = oasysgui.widgetBox(box_center, "", addSpace=False, orientation="vertical", width=50) oasysgui.widgetBox(box_label, "", addSpace=False, orientation="vertical", height=50) label_y_axis = VerticalLabel("Incidence Angle", 200, 50) font = QFont(label_y_axis.font()) font.setBold(True) font.setPointSize(24) label_y_axis.setFont(font) #label_y_axis.setFixedHeight(200) #label_y_axis.setFixedWidth(50) box_label.layout().addWidget(label_y_axis) image_label = QLabel(box_center) image = QImage() image.loadFromData( HttpManager.send_xray_server_direct_request("/" + image_url, decode=False)) image_label.setPixmap(QPixmap(image)) box_center.layout().addWidget(image_label) box_bottom = oasysgui.widgetBox(box_general, "", addSpace=False, orientation="horizontal", width=600) label_x_axis = gui.label(box_bottom, self, " Offset [Å]") font = QFont(label_x_axis.font()) font.setBold(True) font.setPointSize(24) label_x_axis.setFont(font)
def __init__(self): super().__init__(show_automatic_box=False, show_view_box=False) self.general_options_box.setVisible(False) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Load SRW Files", callback=self.plot_degcoh) font = QFont(button.font()) font.setBold(True) button.setFont(font) palette = QPalette(button.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Blue')) button.setPalette(palette) # assign new palette button.setFixedHeight(45) gui.separator(self.controlArea) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) 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, "ME Degree of Coherence Setting") gui.separator(self.tab_bas) gui.label(self.tab_bas, self, "Mutual Intensity Files:") file_box = oasysgui.widgetBox(self.tab_bas, "", addSpace=False, orientation="horizontal") self.le_horizontal_cut_file_name = oasysgui.lineEdit( file_box, self, "horizontal_cut_file_name", "Horizontal Cut ", labelWidth=105, valueType=str, orientation="horizontal") gui.button(file_box, self, "...", callback=self.selectHorizontalCutFile) file_box = oasysgui.widgetBox(self.tab_bas, "", addSpace=False, orientation="horizontal") self.le_vertical_cut_file_name = oasysgui.lineEdit( file_box, self, "vertical_cut_file_name", "Vertical Cut ", labelWidth=105, valueType=str, orientation="horizontal") gui.button(file_box, self, "...", callback=self.selectVerticalCutFile) gui.separator(self.tab_bas) gui.comboBox(self.tab_bas, self, "mode", label="Calculation type:", items=[ "by using Numpy/Scipy (Faster)", "As Original Igor Macro (Slower)" ], orientation="horizontal")
def __init__(self): super().__init__() left_box_1 = oasysgui.widgetBox(self.controlArea, "GID_SL Request Form", addSpace=False, orientation="vertical", width=500, height=680) self.central_tabs = oasysgui.tabWidget(left_box_1) tab_template = oasysgui.createTabPage(self.central_tabs, "Template Options") tab_input = oasysgui.createTabPage(self.central_tabs, "Input Options") left_box_1_1 = oasysgui.widgetBox(tab_template, "", addSpace=False, orientation="vertical", width=480, height=670) gui.separator(left_box_1_1) gui.comboBox(left_box_1_1, self, "template_type", label="Template Type", labelWidth=100, items=["Simplified (coplanar geometries only)", "Full"], callback=self.set_TemplateType, sendSelectedValue=False, orientation="horizontal") self.simplified_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons(self.simplified_box, self, "simplified_form", ["Symmetric Bragg diffraction from perfect crystals", "Symmetric Bragg diffraction from multilayers and superlattices", "Symmetric Bragg diffraction at Bragg angle of 90 degrees (\"back diffraction\")", "Energy scanning of symmetric Bragg diffraction peaks"], callback=self.set_SimplifiedForm) self.full_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons(self.full_box, self, "full_form", ["Symmetric Bragg diffraction from perfect crystals", "Symmetric Bragg diffraction from multilayers and superlattices", "Coplanar extremely asymmetric diffraction of synchrotron radiation", "Grazing incidence (\"surface\") diffraction from perfect crystals", "Grazing incidence (\"surface\") diffraction from multilayers in the scheme\nwith position sensitive detector (PSD)", "Non-coplanar Bragg-Laue diffraction from crystals with a few degrees\nsurface miscut"], callback=self.set_FullForm) # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- gui.separator(tab_input) left_box_2 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_2_1 = oasysgui.widgetBox(left_box_2, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(left_box_2_1, self, "xway", label="X-rays specified by", items=["Wavelength (Å)", "Energy (keV)", "Bragg angle (deg)", "X-ray line"], callback=self.set_xway, sendSelectedValue=False, orientation="horizontal") self.box_wave = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) oasysgui.lineEdit(self.box_wave, self, "wave", label="", labelWidth=0, addSpace=False, valueType=float, orientation="horizontal") self.box_line = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) XRayServerGui.combobox_text(self.box_line, self, "line", label="", labelWidth=0, items=self.get_lines(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.line) button = gui.button(self.box_line, self, "?", callback=self.help_lines) button.setFixedWidth(15) self.set_xway() gui.comboBox(left_box_2_1, self, "ipol", label="Polarization", items=["Sigma", "Pi", "Mixed"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- left_box_3 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_3_1 = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) XRayServerGui.combobox_text(left_box_3_1, self, "code", label="Crystal", labelWidth=40, items=self.get_crystals(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.code) button = gui.button(left_box_3_1, self, "?", callback=self.help_crystals) button.setFixedWidth(15) gui.comboBox(left_box_3_1, self, "df1df2", label=" ", labelWidth=20, items=["Auto DB for f\', f\'\'", "X0h data (0.5-2.5 A)", "Henke (0.4-1200 A)", "Brennan (0.02-400 A)"], sendSelectedValue=False, orientation="horizontal") left_box_3_2 = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) oasysgui.lineEdit(left_box_3_2, self, "sigma", label="Sigma", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_3_2, self, "w0", label="A W0", labelWidth=50, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_3_2, self, "wh", label=" Wh", labelWidth=50, addSpace=False, valueType=float, orientation="horizontal") # ------------------------------------------------------------- left_box_4 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=470) left_box_4_1 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="horizontal", width=240) oasysgui.lineEdit(left_box_4_1, self, "i1", label="Bragg Reflection", labelWidth=97, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4_1, self, "i2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4_1, self, "i3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") left_box_4_2 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="horizontal", width=228) oasysgui.lineEdit(left_box_4_2, self, "daa", label=" Substrate da/a", labelWidth=135, addSpace=False, valueType=float, orientation="horizontal") # ------------------------------------------------------------- # ------------------------------------------------------------- self.simplified_input_box = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470, height=290) gui.comboBox(self.simplified_input_box, self, "igie", label="Geometry specified by", items=["angle of Bragg planes to surface ('+' for g0>gh)", "incidence angle of K0", "exit angle of Kh", "asymmetry factor beta=g0/gh"], callback=self.set_igie_s, sendSelectedValue=False, orientation="horizontal") simplified_input_box_1 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) oasysgui.lineEdit(simplified_input_box_1, self, "fcentre", label="Value", labelWidth=280, addSpace=False, valueType=float, orientation="horizontal") self.unic_combo_s = gui.comboBox(simplified_input_box_1, self, "unic", label=" ", labelWidth=1, items=[" ", "degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") self.set_igie_s() simplified_input_box_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) oasysgui.lineEdit(simplified_input_box_2, self, "scanmin", label="Scan: From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(simplified_input_box_2, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") self.simplified_input_box_scan_1_1 = oasysgui.widgetBox(simplified_input_box_2, "", addSpace=False, orientation="horizontal") gui.comboBox(self.simplified_input_box_scan_1_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.simplified_input_box_scan_1_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") self.simplified_input_box_scan_1_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal", width=470) gui.checkBox(self.simplified_input_box_scan_1_2, self, "invert", "Invert axis", labelWidth=190) gui.comboBox(self.simplified_input_box_scan_1_2, self, "column", label="Plot argument", labelWidth=100, items=["scan angle", "incidence angle", "exit angle"], sendSelectedValue=False, orientation="horizontal") self.simplified_input_box_scan_2_1 = oasysgui.widgetBox(simplified_input_box_2, "", addSpace=False, orientation="horizontal") self.unis_combo_s = gui.comboBox(self.simplified_input_box_scan_2_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad", "eV"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.simplified_input_box_scan_2_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") self.simplified_input_box_scan_2_2 = oasysgui.widgetBox(self.simplified_input_box, "", addSpace=False, orientation="horizontal") gui.comboBox(self.simplified_input_box_scan_2_2, self, "axis", label="Scan Type", labelWidth=290, items=["[k0 x h]", "Energy (eV)", "Energy (eV), no X0h recalc"], sendSelectedValue=False, orientation="horizontal", callback=self.set_scan_type_s) self.set_scan_type_s() # ------------------------------------------------------------- # ------------------------------------------------------------- self.full_input_box = oasysgui.widgetBox(tab_input, "", addSpace=True, orientation="vertical", width=470, height=290) gui.comboBox(self.full_input_box, self, "igie", label="Geom. by", labelWidth=60, items=["[1]. Surface orientation & incidence angle of K0", "[2]. Surface orientation & exit angle of Kh", "[3]. Surface orientation & condition of coplanar grazing incidence", "[4]. Surface orientation & condition of coplanar grazing exit", "[5]. Surface orientation & condition of symmetric Bragg case", "[6]. Condition of coplanar reflection & angle of Bragg planes to surface", "[7]. Condition of coplanar reflection & incidence angle of K0", "[8]. Condition of coplanar reflection & exit angle of Kh", "[9]. Condition of coplanar reflection & asymmetry factor beta=g0/gh"], callback=self.set_igie_f, sendSelectedValue=False, orientation="horizontal") gui.label(self.full_input_box, self, "-- Geom. parameter ([1,7]=incidence angle, [2,8]=exit angle, [6]=Bragg planes") full_input_box_1 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_1_1 = oasysgui.widgetBox(full_input_box_1, "", addSpace=False, orientation="horizontal", width=470) self.le_fcentre = oasysgui.lineEdit(full_input_box_1_1, self, "fcentre", label=" angle, [9]=g0/gh)", labelWidth=250, addSpace=False, valueType=float, orientation="horizontal") self.unic_combo_f = gui.comboBox(full_input_box_1_1, self, "unic", label=" ", labelWidth=1, items=[" ", "degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") self.set_igie_f() full_input_box_1_2 = oasysgui.widgetBox(full_input_box_1, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(full_input_box_1_2, self, "n1", label="-- Surface plane ([1-5])", labelWidth=135, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(full_input_box_1_2, self, "n2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(full_input_box_1_2, self, "n3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") full_input_box_2 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="horizontal", width=470) full_input_box_2_1 = oasysgui.widgetBox(full_input_box_2, "", addSpace=False, orientation="horizontal", width=270) oasysgui.lineEdit(full_input_box_2_1, self, "m1", label="Miscut direction", labelWidth=135, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(full_input_box_2_1, self, "m2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(full_input_box_2_1, self, "m3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") full_input_box_2_2 = oasysgui.widgetBox(full_input_box_2, "", addSpace=False, orientation="horizontal") oasysgui.lineEdit(full_input_box_2_2, self, "miscut", label="Miscut angle", addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(full_input_box_2_2, self, "unim", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") full_input_box_3 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_3_1 = oasysgui.widgetBox(full_input_box_3, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(full_input_box_3_1, self, "axis", label="Scan Type", labelWidth=190, items=["Surface normal (N_surface)", "[k0 x N_surface]", "Reciprocal latt.vector (h)", "[k0 x h]", "Other axis", "Takeoff spectrum (PSD)"], sendSelectedValue=False, orientation="horizontal", callback=self.set_scan_type_f) gui.checkBox(full_input_box_3_1, self, "invert", "Invert axis", labelWidth=90) full_input_box_3_2 = oasysgui.widgetBox(full_input_box_3, "", addSpace=False, orientation="horizontal", width=470) self.le_a1 = oasysgui.lineEdit(full_input_box_3_2, self, "a1", label="Indices, if other scan axis", labelWidth=290, addSpace=False, valueType=int, orientation="horizontal") self.le_a2 = oasysgui.lineEdit(full_input_box_3_2, self, "a2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") self.le_a3 = oasysgui.lineEdit(full_input_box_3_2, self, "a3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") self.set_scan_type_f() full_input_box_5 = oasysgui.widgetBox(self.full_input_box, "", addSpace=False, orientation="vertical", width=470) full_input_box_5_1 = oasysgui.widgetBox(full_input_box_5, "", addSpace=False, orientation="horizontal", width=470) oasysgui.lineEdit(full_input_box_5_1, self, "scanmin", label="Scan: From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(full_input_box_5_1, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(full_input_box_5_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(full_input_box_5_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") full_input_box_5_2 = oasysgui.widgetBox(full_input_box_5, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(full_input_box_5_2, self, "column", label="Plot argument", labelWidth=290, items=["scan angle", "incidence angle", "exit angle"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- box_alpha = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=280) self.le_alphamax = oasysgui.lineEdit(box_alpha, self, "alphamax", label="Approximations: alpha_max", labelWidth=170, addSpace=False, valueType=float, orientation="horizontal") gui.label(box_alpha, self, "*|xh|") gui.separator(tab_input) # ------------------------------------------------------------- box_top = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) box_top_0 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) box_top_0_1 = oasysgui.widgetBox(box_top_0, "", addSpace=False, orientation="vertical", width=100) gui.label(box_top_0_1, self, "Top layer profile\n(optional):") button = gui.button(box_top_0_1, self, "? (sintax)", callback=self.help_profile) button.setFixedWidth(90) box_top_0_2 = oasysgui.widgetBox(box_top_0, "", addSpace=False, orientation="horizontal", width=360) self.profile_area = QtWidgets.QTextEdit() self.profile_area.setStyleSheet("background-color: white;") self.profile_area.setMaximumHeight(110) self.profile_area.setMaximumWidth(360) box_top_0_2.layout().addWidget(self.profile_area) box_top_labels = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) box_top_labels_1 = oasysgui.widgetBox(box_top_labels, "", addSpace=False, orientation="horizontal", width=100) gui.label(box_top_labels_1, self, "Available Codes:") box_top_labels_2 = oasysgui.widgetBox(box_top_labels, "", addSpace=False, orientation="horizontal", width=360) gui.label(box_top_labels_2, self, "Crystals") gui.label(box_top_labels_2, self, "Non-Crystals") gui.label(box_top_labels_2, self, "Elements") box_top_1 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="horizontal", width=100) box_top_1_2 = oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="horizontal", width=360) crystals_area = QtWidgets.QTextEdit() crystals_area.setStyleSheet("background-color: white;") crystals_area.setMaximumHeight(100) crystals_area.setMaximumWidth(120) crystals_area.setText("\n".join(ListUtility.get_list("crystals"))) crystals_area.setReadOnly(True) non_crystals_area = QtWidgets.QTextEdit() non_crystals_area.setStyleSheet("background-color: white;") non_crystals_area.setMaximumHeight(100) non_crystals_area.setMaximumWidth(120) non_crystals_area.setText("\n".join(ListUtility.get_list("amorphous"))) non_crystals_area.setReadOnly(True) elements_area = QtWidgets.QTextEdit() elements_area.setStyleSheet("background-color: white;") elements_area.setMaximumHeight(100) elements_area.setMaximumWidth(120) elements_area.setText("\n".join(ListUtility.get_list("atoms"))) elements_area.setReadOnly(True) box_top_1_2.layout().addWidget(crystals_area) box_top_1_2.layout().addWidget(non_crystals_area) box_top_1_2.layout().addWidget(elements_area) # ----------------------------------------------------------- button = gui.button(tab_input, self, "Submit Query!", callback=self.submit) button.setFixedHeight(30) gui.rubber(self.controlArea) self.tabs = [] self.tabs_widget = oasysgui.tabWidget(self.mainArea) self.initializeTabs() self.set_TemplateType(change_values=False) self.profile_area.textChanged.connect(self.set_profile) self.le_alphamax.focusOutEvent = self.alphamax_focusOutEvent self.alphamax_focusOutEvent(None) gui.rubber(self.mainArea)
def build_mirror_specific_gui(self, container_box): self.tab_best = oasysgui.createTabPage(self.tabs_setting, "Find Best Focus") best_focus_box = oasysgui.widgetBox(self.tab_best, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 20) bestFocusLabel = "Use for: \n* best focus metrics (HEW, position)\n* intensity profile at best focus position\n* high computational speed\n" gui.label(best_focus_box, self, bestFocusLabel, labelWidth=None, box=None, orientation=2) self.le_defocus_start = oasysgui.lineEdit(best_focus_box, self, "defocus_start", "Start [mm]", labelWidth=240, valueType=float, orientation="horizontal") self.le_defocus_stop = oasysgui.lineEdit(best_focus_box, self, "defocus_stop", "Stop [mm]", labelWidth=240, valueType=float, orientation="horizontal") # self.le_defocus_step = oasysgui.lineEdit(best_focus_box, self, "defocus_step", "Step [mm]", labelWidth=240, valueType=float, orientation="horizontal") self.le_max_iter = oasysgui.lineEdit(best_focus_box, self, "max_iter", "Max. iterations", labelWidth=240, valueType=int, 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 - 20) gui.button(button_box, self, "Scan Start", callback=self.do_find_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 Complete Calculation Results", callback=self.save_best_focus_results, height=35) self.save_button.setEnabled(False) # PROBLEM HERE! STR AND FLOAT! le_BD = oasysgui.lineEdit(best_focus_box, self, "ActualBestDefocus", "Best focus at [m]", labelWidth=220, valueType=float, orientation="horizontal") le_BD.setReadOnly(True) font = QFont(le_BD.font()) # font.setBold(True) le_BD.setFont(font) palette = QPalette(le_BD.palette()) palette.setColor(QPalette.Text, QColor('grey')) palette.setColor(QPalette.Base, QColor(243, 240, 140)) le_BD.setPalette(palette) le_HEW = oasysgui.lineEdit(best_focus_box, self, "ActualBestHew", "HEW at best focus [" + u"\u03BC" + "m]", labelWidth=220, valueType=float, orientation="horizontal") le_HEW.setReadOnly(True) font = QFont(le_HEW.font()) # font.setBold(True) le_HEW.setFont(font) palette = QPalette(le_HEW.palette()) palette.setColor(QPalette.Text, QColor('grey')) palette.setColor(QPalette.Base, QColor(243, 240, 140)) le_HEW.setPalette(palette) self.best_focus_slider = None self.tab_sweep = oasysgui.createTabPage(self.tabs_setting, "Focal Scan") focus_sweep_box = oasysgui.widgetBox(self.tab_sweep, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 20) focusSweepLabel = "Use for: \n* a complete plot of the spot size through the focal plane\n* a collection of the intensity profiles\n* below-average computational performance\n" gui.label(focus_sweep_box, self, focusSweepLabel, labelWidth=None, box=None, orientation=2) self.le_defocus_start = oasysgui.lineEdit(focus_sweep_box, self, "defocus_start", "Lower limit [mm]", labelWidth=240, valueType=float, orientation="horizontal") self.le_defocus_stop = oasysgui.lineEdit(focus_sweep_box, self, "defocus_stop", "Upper limit [mm]", labelWidth=240, valueType=float, orientation="horizontal") self.le_defocus_Nsteps = oasysgui.lineEdit(focus_sweep_box, self, "defocus_Nsteps", "No. of steps", labelWidth=240, valueType=int, orientation="horizontal", callbackOnType=True, callback=self.get_StepSize) le_defocus_step = oasysgui.lineEdit(focus_sweep_box, self, "defocus_step", "Step [mm]", labelWidth=240, valueType=float, orientation="horizontal") le_defocus_step.setReadOnly(True) font = QFont(le_defocus_step.font()) le_defocus_step.setFont(font) palette = QPalette(le_defocus_step.palette()) palette.setColor(QPalette.Text, QColor('grey')) palette.setColor(QPalette.Base, QColor(243, 240, 140)) le_defocus_step.setPalette(palette) gui.separator(focus_sweep_box, height=5) gui.checkBox(focus_sweep_box, self, "show_animation", "Show animation during calculation") gui.separator(focus_sweep_box, height=5) button_box = oasysgui.widgetBox(focus_sweep_box, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH - 20) gui.button(button_box, self, "Scan Start", callback=self.do_focus_sweep_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(focus_sweep_box, self, "Save Complete Calculation Results", callback=self.save_best_focus_results, height=35) self.save_button.setEnabled(False) self.best_focus_slider = None
def __init__(self): super().__init__() tabs = oasysgui.tabWidget(self.tab_source, height=175) left_box_2 = oasysgui.createTabPage(tabs, "ID Parameters") left_box_3 = oasysgui.createTabPage(tabs, "ID Magnetic Field") oasysgui.lineEdit(left_box_2, self, "period_length", "Period Length [m]", labelWidth=260, valueType=float, orientation="horizontal", callback=self.set_harmonic_energy) oasysgui.lineEdit(left_box_2, self, "number_of_periods", "Number of Periods", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_2, self, "horizontal_central_position", "Horizontal Central Position [m]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_2, self, "vertical_central_position", "Vertical Central Position [m]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_2, self, "longitudinal_central_position", "Longitudinal Central Position [m]", labelWidth=260, valueType=float, orientation="horizontal") gui.comboBox(left_box_3, self, "magnetic_field_from", label="Magnetic Field", labelWidth=350, items=["From K", "From B"], callback=self.set_MagneticField, sendSelectedValue=False, orientation="horizontal") container = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal") horizontal_box = oasysgui.widgetBox(container, "", addSpace=False, orientation="vertical", width=215) vertical_box = oasysgui.widgetBox(container, "", addSpace=False, orientation="vertical", width=155) gui.label(horizontal_box, self, " Horizontal") gui.label(vertical_box, self, " Vertical") self.magnetic_field_box_1_h = oasysgui.widgetBox( horizontal_box, "", addSpace=False, orientation="vertical") self.magnetic_field_box_2_h = oasysgui.widgetBox( horizontal_box, "", addSpace=False, orientation="vertical") self.magnetic_field_box_1_v = oasysgui.widgetBox( vertical_box, "", addSpace=False, orientation="vertical") self.magnetic_field_box_2_v = oasysgui.widgetBox( vertical_box, "", addSpace=False, orientation="vertical") oasysgui.lineEdit(self.magnetic_field_box_1_h, self, "K_horizontal", "K", labelWidth=70, valueType=float, orientation="horizontal", callback=self.set_harmonic_energy) oasysgui.lineEdit(self.magnetic_field_box_1_v, self, "K_vertical", " ", labelWidth=2, valueType=float, orientation="horizontal", callback=self.set_harmonic_energy) oasysgui.lineEdit(self.magnetic_field_box_2_h, self, "B_horizontal", "B [T]", labelWidth=70, valueType=float, orientation="horizontal", callback=self.set_harmonic_energy) oasysgui.lineEdit(self.magnetic_field_box_2_v, self, "B_vertical", " ", labelWidth=2, valueType=float, orientation="horizontal", callback=self.set_harmonic_energy) self.set_MagneticField() oasysgui.lineEdit(horizontal_box, self, "initial_phase_horizontal", "\u03c6\u2080 [rad]", labelWidth=70, valueType=float, orientation="horizontal") oasysgui.lineEdit(vertical_box, self, "initial_phase_vertical", " ", labelWidth=2, valueType=float, orientation="horizontal") gui.comboBox(horizontal_box, self, "symmetry_vs_longitudinal_position_horizontal", label="Symmetry", labelWidth=70, items=["Symmetrical", "Anti-Symmetrical"], sendSelectedValue=False, orientation="horizontal") symmetry_v_box = oasysgui.widgetBox(vertical_box, "", addSpace=False, orientation="horizontal") gui.comboBox(symmetry_v_box, self, "symmetry_vs_longitudinal_position_vertical", label=" ", labelWidth=2, items=["Symmetrical", "Anti-Symmetrical"], sendSelectedValue=False, orientation="horizontal") gui.button(symmetry_v_box, self, "?", callback=self.open_help, width=12) #################################################################################### # Utility tab_util = oasysgui.createTabPage(self.tabs_setting, "Utility") left_box_1 = oasysgui.widgetBox(tab_util, "Auto Setting of Undulator", addSpace=False, orientation="vertical") oasysgui.lineEdit(left_box_1, self, "auto_energy", "Set Undulator at Energy [eV]", labelWidth=250, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "auto_harmonic_number", "As Harmonic #", labelWidth=250, valueType=int, orientation="horizontal") gui.button(left_box_1, self, "Set Kv value", callback=self.auto_set_undulator) gui.rubber(self.controlArea) gui.rubber(self.mainArea)
def add_parameter_box(container_box, variable, label): box = oasysgui.widgetBox(container_box, "", addSpace=False, orientation="horizontal") oasysgui.lineEdit(box, self, variable, label, labelWidth=50, valueType=float, orientation="horizontal") gui.label(box, self, " ", labelWidth=58) box = oasysgui.widgetBox(container_box, "", addSpace=False, orientation="horizontal") setattr( self, "le_" + variable + "_min", oasysgui.lineEdit(box, self, variable + "_min", "Min", labelWidth=50, valueType=float, orientation="horizontal")) setattr( self, "le_" + variable + "_max", oasysgui.lineEdit(box, self, variable + "_max", "Max", labelWidth=35, valueType=float, orientation="horizontal")) gui.checkBox(box, self, variable + "_fixed", "Fixed", callback=getattr(self, "set_" + variable)) box = oasysgui.widgetBox(container_box, "", addSpace=False, orientation="horizontal") le = oasysgui.lineEdit(box, self, variable + "_out", "Fitted", labelWidth=50, valueType=float, orientation="horizontal") le.setEnabled(False) le.setStyleSheet( "color: blue; background-color: rgb(254, 244, 205); font:bold") def set_variable_fit(): setattr(self, variable, getattr(self, variable + "_out")) gui.button(box, self, "<- Use", width=58, callback=set_variable_fit) getattr(self, "set_" + variable)()
def build_positioning_directive_box(self, container_box, width, element_type=ElementType.SOURCE): box = oasysgui.widgetBox(container_box, "Positioning Directives", orientation="vertical", width=width) box_combos = oasysgui.widgetBox(box, "", orientation="vertical", width=width-20) box_Distance = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_Distance_check = oasysgui.widgetBox(box_Distance, "", orientation="horizontal", width=20) box_Distance_value = oasysgui.widgetBox(box_Distance, "", orientation="horizontal") box_XYCentre = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_XYCentre_check = oasysgui.widgetBox(box_XYCentre, "", orientation="horizontal", width=20) box_XYCentre_value = oasysgui.widgetBox(box_XYCentre, "", orientation="vertical") ''' box_GrazingAngle = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_GrazingAngle_check = oasysgui.widgetBox(box_GrazingAngle, "", orientation="horizontal", width=20) box_GrazingAngle_value = oasysgui.widgetBox(box_GrazingAngle, "", orientation="horizontal") box_Angle = oasysgui.widgetBox(box, "", orientation="horizontal", width=width-20) box_Angle_check = oasysgui.widgetBox(box_Angle, "", orientation="horizontal", width=20) box_Angle_value = oasysgui.widgetBox(box_Angle, "", orientation="horizontal") def set_WhichAngle(): box_GrazingAngle.setVisible(getattr(self, "WhichAngle") == positioning_directives_which_angle[0]) box_Angle.setVisible(getattr(self, "WhichAngle") != positioning_directives_which_angle[0]) ''' def set_Distance_checked(): box_Distance_value.setEnabled(getattr(self, "Distance_checked") == 1) def set_XYCentre_checked(): box_XYCentre_value.setEnabled(getattr(self, "XYCentre_checked") == 1) ''' def set_GrazingAngle_checked(): box_GrazingAngle_value.setEnabled(getattr(self, "GrazingAngle_checked") == 1) def set_Angle_checked(): box_Angle_value.setEnabled(getattr(self, "Angle_checked") == 1) ''' def set_positioning_directives(): pass #set_WhichAngle() box_what = oasysgui.widgetBox(box_combos, "", orientation="horizontal") gui.label(box_what, self, label=" ", labelWidth=20) gui.comboBox(box_what, self, "What", label="", items=positioning_directives_what, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_what, self, label=" of this O.E.", labelWidth=80) box_where = oasysgui.widgetBox(box_combos, "", orientation="horizontal") gui.label(box_where, self, label="at", labelWidth=20) gui.comboBox(box_where, self, "Where", label="", items=positioning_directives_where, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_where, self, label=" of", labelWidth=80) box_refer_to = oasysgui.widgetBox(box_combos, "", orientation="horizontal") gui.label(box_refer_to, self, label=" ", labelWidth=20) gui.comboBox(box_refer_to, self, "ReferTo", label="", items=positioning_directives_refer_to, sendSelectedValue=True, orientation="horizontal", callback=set_positioning_directives) gui.label(box_refer_to, self, label=" O.E.", labelWidth=80) ''' gui.comboBox(box_combos, self, "WhichAngle", label="Type Of Angle", items=positioning_directives_which_angle, labelWidth=box_combos.width()-150, sendSelectedValue=True, orientation="horizontal", callback=set_WhichAngle) ''' gui.separator(box_combos) gui.checkBox(box_Distance_check, self, "Distance_checked", "", callback=set_Distance_checked) gui.checkBox(box_XYCentre_check, self, "XYCentre_checked", "", callback=set_XYCentre_checked) ''' gui.checkBox(box_GrazingAngle_check, self, "GrazingAngle_checked", "", callback=set_GrazingAngle_checked) gui.checkBox(box_Angle_check, self, "Angle_checked", "", callback=set_Angle_checked) ''' set_Distance_checked() set_XYCentre_checked() ''' set_Angle_checked() set_GrazingAngle_checked() ''' self.le_Distance = oasysgui.lineEdit(box_Distance_value, self, "Distance", "Distance", labelWidth=200, valueType=float, orientation="horizontal") self.le_XCentre = oasysgui.lineEdit(box_XYCentre_value, self, "XCentre", "X Centre", labelWidth=200, valueType=float, orientation="horizontal") self.le_YCentre = oasysgui.lineEdit(box_XYCentre_value, self, "YCentre", "Y Centre", labelWidth=200, valueType=float, orientation="horizontal") ''' oasysgui.lineEdit(box_Angle_value, self, "Angle", "Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") oasysgui.lineEdit(box_GrazingAngle_value, self, "GrazingAngle", "Grazing Angle [deg]", labelWidth=200, valueType=float, orientation="horizontal") ''' set_positioning_directives()
def __init__(self): super().__init__() left_box_1 = oasysgui.widgetBox(self.controlArea, "TER_SL Request Form", addSpace=False, orientation="vertical", width=500, height=680) self.central_tabs = oasysgui.tabWidget(left_box_1) tab_template = oasysgui.createTabPage(self.central_tabs, "Template Options") tab_input = oasysgui.createTabPage(self.central_tabs, "Input Options") left_box_1_1 = oasysgui.widgetBox(tab_template, "", addSpace=False, orientation="vertical", width=480, height=670) gui.separator(left_box_1_1) ter_sl_box = oasysgui.widgetBox(left_box_1_1, "", addSpace=False, orientation="horizontal", width=470, height=220) gui.radioButtons( ter_sl_box, self, "ter_sl_form", [ "Specular reflection from perfect reflectors", "Specular reflection from multilayers", "Specular reflection from perfect reflectors + standing waves", "Specular reflection from multilayers + standing waves" ], callback=self.set_TerSLForm) # ------------------------------------------------------------- # ------------------------------------------------------------- # ------------------------------------------------------------- gui.separator(tab_input) left_box_2 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) left_box_2_1 = oasysgui.widgetBox(left_box_2, "", addSpace=False, orientation="horizontal", width=470) gui.comboBox(left_box_2_1, self, "xway", label="X-rays specified by", items=[ "Wavelength (Å)", "Energy (keV)", "Bragg angle (deg)", "X-ray line" ], callback=self.set_xway, sendSelectedValue=False, orientation="horizontal") self.box_wave = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) gui.lineEdit(self.box_wave, self, "wave", label="", labelWidth=0, addSpace=False, valueType=float, orientation="horizontal") self.box_line = oasysgui.widgetBox(left_box_2_1, "", addSpace=False, orientation="horizontal", width=100) XRayServerGui.combobox_text(self.box_line, self, "line", label="", labelWidth=0, items=self.get_lines(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.line) button = gui.button(self.box_line, self, "?", callback=self.help_lines) button.setFixedWidth(15) self.set_xway() gui.comboBox(left_box_2_1, self, "ipol", label="Polarization", items=["Sigma", "Pi", "Mixed"], sendSelectedValue=False, orientation="horizontal") # ------------------------------------------------------------- left_box_3 = oasysgui.widgetBox(tab_input, "", addSpace=True, orientation="vertical", width=470) gui.separator(left_box_3, height=4) left_box_3_top = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) gui.label(left_box_3_top, self, "Substrate:") left_box_3_content = oasysgui.widgetBox(left_box_3, "", addSpace=False, orientation="horizontal", width=470) left_box_3_left = oasysgui.widgetBox(left_box_3_content, "", addSpace=False, orientation="vertical", width=20) left_box_3_right = oasysgui.widgetBox(left_box_3_content, "", addSpace=False, orientation="vertical", width=445) gui.radioButtons(left_box_3_left, self, "subway", [" ", " ", " "], callback=self.set_subway) self.left_box_3_1 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="horizontal", width=445) XRayServerGui.combobox_text(self.left_box_3_1, self, "code", label="Crystal", labelWidth=45, items=self.get_crystals(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.code) button = gui.button(self.left_box_3_1, self, "?", callback=self.help_crystals) button.setFixedWidth(15) gui.comboBox(self.left_box_3_1, self, "df1df2", label=" ", labelWidth=1, items=[ "Auto DB for f\', f\'\'", "X0h data (0.5-2.5 A)", "Henke (0.4-1200 A)", "Brennan (0.02-400 A)" ], sendSelectedValue=False, orientation="horizontal") self.left_box_3_2 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="horizontal", width=445) gui.lineEdit(self.left_box_3_2, self, "chem", label="Chemical Formula", labelWidth=110, addSpace=False, valueType=str, orientation="horizontal", callback=self.set_rho) gui.lineEdit(self.left_box_3_2, self, "rho", label=u"\u03C1" + " (g/cm3)", labelWidth=60, addSpace=False, valueType=float, orientation="horizontal") self.left_box_3_3 = oasysgui.widgetBox(left_box_3_right, "", addSpace=False, orientation="vertical", width=445) left_box_3_3_1 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) gui.lineEdit(left_box_3_3_1, self, "x0", label="Susceptibility x0 (", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_1, self, " ) format: x0=(Re(x0), Im(x0))", labelWidth=230) left_box_3_3_2 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) gui.lineEdit(left_box_3_3_2, self, "w0", label="x0 correction: w0", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_2, self, " this is used as: x0 = w0 * x0", labelWidth=230) left_box_3_3_3 = oasysgui.widgetBox(self.left_box_3_3, "", addSpace=False, orientation="horizontal", width=445) gui.lineEdit(left_box_3_3_3, self, "sigma", label="Roughness: sigma [Å]", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(left_box_3_3_3, self, " OR ") gui.lineEdit(left_box_3_3_3, self, "tr", label="Transition layer tr [Å]", labelWidth=120, addSpace=False, valueType=float, orientation="horizontal") self.set_subway() # ------------------------------------------------------------- left_box_4 = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="horizontal", width=470) left_box_4_1 = oasysgui.widgetBox(left_box_4, "", addSpace=False, orientation="vertical", width=470) gui.label(left_box_4_1, self, "Incidence angle limits:") left_box_4_1_1 = oasysgui.widgetBox(left_box_4_1, "", addSpace=False, orientation="horizontal", width=470) gui.lineEdit(left_box_4_1_1, self, "scanmin", label=" From", labelWidth=70, addSpace=False, valueType=float, orientation="horizontal") gui.lineEdit(left_box_4_1_1, self, "scanmax", label="To", labelWidth=15, addSpace=False, valueType=float, orientation="horizontal") gui.comboBox(left_box_4_1_1, self, "unis", label=" ", labelWidth=1, items=["degr.", "min.", "mrad.", "sec.", "urad"], sendSelectedValue=False, orientation="horizontal") gui.lineEdit(left_box_4_1_1, self, "nscan", label="Points", labelWidth=40, addSpace=False, valueType=int, orientation="horizontal") # ------------------------------------------------------------- # ------------------------------------------------------------- self.standing_waves_box = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470, height=140) self.standing_waves_box_hidden = oasysgui.widgetBox( tab_input, "", addSpace=False, orientation="horizontal", width=470, height=140) gui.separator(self.standing_waves_box, 10) standing_waves_box_1 = oasysgui.widgetBox(self.standing_waves_box, "", addSpace=False, orientation="horizontal", width=120) gui.checkBox(standing_waves_box_1, self, "swflag", "", callback=self.set_swflag) gui.label(standing_waves_box_1, self, "Standing waves:") self.standing_waves_box_2 = oasysgui.widgetBox(self.standing_waves_box, "", addSpace=False, orientation="vertical", width=470) standing_waves_box_2_1 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(standing_waves_box_2_1, self, "swref", label="Reference interface", labelWidth=130, addSpace=False, valueType=int, orientation="horizontal") gui.label(standing_waves_box_2_1, self, " (0=surface)") standing_waves_box_2_2 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(standing_waves_box_2_2, self, "swmin", label="Start offset", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_2, self, " [Å]", labelWidth=70) standing_waves_box_2_3 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(standing_waves_box_2_3, self, "swmax", label="End offset", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_3, self, " [Å]", labelWidth=70) standing_waves_box_2_4 = oasysgui.widgetBox(self.standing_waves_box_2, "", addSpace=False, orientation="horizontal", width=270) gui.lineEdit(standing_waves_box_2_4, self, "swpts", label="Number of offsets", labelWidth=130, addSpace=False, valueType=float, orientation="horizontal") gui.label(standing_waves_box_2_4, self, " (max = 401)") self.set_swflag() gui.separator(tab_input) # ------------------------------------------------------------- box_top = oasysgui.widgetBox(tab_input, "", addSpace=False, orientation="vertical", width=470) box_top_0 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=250) gui.label(box_top_0, self, "Top layer profile (optional):") button = gui.button(box_top_0, self, "? (sintax)", callback=self.help_profile) button.setFixedWidth(90) box_top_1 = oasysgui.widgetBox(box_top, "", addSpace=False, orientation="horizontal", width=470) self.profile_area = QtWidgets.QTextEdit() self.profile_area.setMaximumHeight(240) self.profile_area.setMaximumWidth(335) self.profile_area.setLineWrapMode(QtWidgets.QTextEdit.NoWrap) box_top_1.layout().addWidget(self.profile_area) gui.separator(box_top_1) box_top_labels = oasysgui.widgetBox(box_top_1, "", addSpace=False, orientation="vertical", width=130) gui.label(box_top_labels, self, "Available Codes:") crystals_area = QtWidgets.QTextEdit() crystals_area.setMaximumHeight(295) crystals_area.setMaximumWidth(130) crystals_area.setText("\n".join(ListUtility.get_list("crystals"))) crystals_area.setReadOnly(True) box_top_labels.layout().addWidget(crystals_area) gui.separator(box_top) # ----------------------------------------------------------- button = gui.button(tab_input, self, "Submit Query!", callback=self.submit) button.setFixedHeight(30) gui.rubber(self.controlArea) self.tabs = [] self.tabs_widget = oasysgui.tabWidget(self.mainArea) self.initializeTabs() self.set_TerSLForm(change_values=False, switch_page=False) self.profile_area.textChanged.connect(self.set_profile)