def __init__(self): super().__init__() self.dataset = None self.sample = None self.otherdata = None # GUI box = gui.widgetBox(self.controlArea, "Info") self.infoa = gui.widgetLabel( box, 'No data on input yet, waiting to get something.') self.infob = gui.widgetLabel(box, '') gui.separator(self.controlArea) self.optionsBox = gui.widgetBox(self.controlArea, "Options") gui.spin(self.optionsBox, self, 'proportion', minv=10, maxv=90, step=10, label='Sample Size [%]:', callback=[self.selection, self.checkCommit]) gui.checkBox(self.optionsBox, self, 'commitOnChange', 'Commit data on selection change') gui.button(self.optionsBox, self, "Commit", callback=self.commit) self.optionsBox.setDisabled(True) self.resize(100, 50)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Write Shadow File", self) self.runaction.triggered.connect(self.write_file) self.addAction(self.runaction) self.setFixedWidth(590) self.setFixedHeight(180) left_box_1 = oasysgui.widgetBox(self.controlArea, "Shadow File Selection", addSpace=True, orientation="vertical", width=570, height=100) gui.checkBox(left_box_1, self, 'is_automatic_run', 'Automatic Execution') gui.separator(left_box_1, height=10) figure_box = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="horizontal", width=550, height=50) self.le_beam_file_name = oasysgui.lineEdit(figure_box, self, "beam_file_name", "Shadow File Name", labelWidth=120, valueType=str, orientation="horizontal") self.le_beam_file_name.setFixedWidth(330) gui.button(figure_box, self, "...", callback=self.selectFile) gui.separator(left_box_1, height=10) button = gui.button(self.controlArea, self, "Write Shadow File", callback=self.write_file) button.setFixedHeight(45) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Write Shadow File", self) self.runaction.triggered.connect(self.write_file) self.addAction(self.runaction) self.setFixedWidth(590) self.setFixedHeight(190) left_box_1 = oasysgui.widgetBox(self.controlArea, "Shadow File Selection", addSpace=True, orientation="vertical", width=570, height=110) gui.checkBox(left_box_1, self, 'is_automatic_run', 'Automatic Execution') gui.separator(left_box_1, height=10) figure_box = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="horizontal", width=550, height=35) self.le_beam_file_name = oasysgui.lineEdit(figure_box, self, "beam_file_name", "Shadow File Name", labelWidth=120, valueType=str, orientation="horizontal") self.le_beam_file_name.setFixedWidth(330) gui.button(figure_box, self, "...", callback=self.selectFile) button = gui.button(self.controlArea, self, "Write Shadow File", callback=self.write_file) button.setFixedHeight(45) gui.rubber(self.controlArea)
def __init__(self): super().__init__() button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Retrace", callback=self.retrace) 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(150) gui.separator(self.controlArea) box = oasysgui.widgetBox(self.controlArea, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH-5, height=550) main_box = oasysgui.widgetBox(box, "Shadow Beam Retrace", orientation="vertical", width=self.CONTROL_AREA_WIDTH-5, height=70) self.le_retrace_distance = oasysgui.lineEdit(main_box, self, "retrace_distance", "Retrace to ", labelWidth=280, valueType=float, orientation="horizontal")
def __init__(self): super().__init__(show_automatic_box=True) self.main_box = gui.widgetBox(self.controlArea, self.get_parameter_name(), orientation="vertical", width=self.CONTROL_AREA_WIDTH - 10, height=self.get_height()) self.button_box = gui.widgetBox(self.main_box, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH - 25) gui.button(self.button_box, self, "Send " + self.get_parameter_name(), height=40, callback=self.send_parameter) self.build_main_box() orangegui.separator(self.main_box) self.parameter_tabs = gui.tabWidget(self.main_box) self.parameter_box_array = [] self.build_parameter_box_array() runaction = OWAction("Send " + self.get_parameter_name(), self) runaction.triggered.connect(self.send_parameter) self.addAction(runaction) orangegui.rubber(self.controlArea)
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 build_gui(self): main_box = oasysgui.widgetBox(self.controlArea, "Wofry Wavefront Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-5, height=300) oasysgui.lineEdit(main_box, self, "source_lambda", "Wavelength [nm]", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(main_box, height=5) gui.comboBox(main_box, self, "source_position", label="Source Position", items=["User Defined", "Put Source at Mirror Focus"], labelWidth=260, callback=self.set_SourcePosition, sendSelectedValue=False, orientation="horizontal") self.source_position_box_1 = oasysgui.widgetBox(main_box, "", addSpace=False, orientation="vertical", height=70) self.source_position_box_2 = oasysgui.widgetBox(main_box, "", addSpace=False, orientation="vertical", height=70) self.le_z_origin = oasysgui.lineEdit(self.source_position_box_1, self, "z_origin", "Z Origin", labelWidth=260, valueType=float, orientation="horizontal") self.le_x_origin = oasysgui.lineEdit(self.source_position_box_1, self, "x_origin", "X Origin", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.source_position_box_1, self, "theta", "Theta [deg]", labelWidth=260, valueType=float, orientation="horizontal") self.le_longitudinal_correction = oasysgui.lineEdit(self.source_position_box_2, self, "longitudinal_correction", "Longitudinal correction", labelWidth=260, valueType=float, orientation="horizontal") self.le_transverse_correction = oasysgui.lineEdit(self.source_position_box_2, self, "transverse_correction", "Transverse correction", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.source_position_box_2, self, "delta_theta", "\u0394" + "Theta [deg]", labelWidth=260, valueType=float, orientation="horizontal") self.set_SourcePosition() gui.separator(main_box, height=5) gui.comboBox(main_box, self, "reset_phase", label="Reset Phase", items=["No", "Yes"], labelWidth=300, sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(main_box, self, "normalization_factor", "Normalization Factor", labelWidth=260, valueType=float, orientation="horizontal")
def __init__(self): self.setFixedWidth(590) self.setFixedHeight(390) left_box_1 = oasysgui.widgetBox(self.controlArea, "Ansys Surface", addSpace=True, orientation="vertical") select_file_box = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="horizontal", height=50) self.le_surface_file_name = oasysgui.lineEdit(select_file_box, self, "surface_file_name", "Surface File Name", labelWidth=150, valueType=str, orientation="horizontal") self.le_surface_file_name.setFixedWidth(300) pushButton = gui.button(select_file_box, self, "...") pushButton.clicked.connect(self.selectSurfaceFile) oasysgui.lineEdit(left_box_1, self, "x_min", "X Min", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "x_max", "X Max", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "y_min", "Y Min", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "y_max", "Y Max", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(left_box_1) oasysgui.lineEdit(left_box_1, self, "number_of_x_cells", "Number of X cells", labelWidth=350, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "number_of_y_cells", "Number of Y cells", labelWidth=350, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "n_sigma_x", "N Sigma X", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "n_sigma_y", "N Sigma Y", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(self.controlArea) button = gui.button(self.controlArea, self, "Convert To Shadow", callback=self.convertToShadow) button.setFixedHeight(45) gui.rubber(self.controlArea)
def __init__(self): super().__init__() # sets self.curvePoints, self.steps equidistant points from # 1/self.steps to 1 self.updateCurvePoints() # [start-snippet-2] self.scoring = [ ("Classification Accuracy", Orange.evaluation.scoring.CA), ("AUC", Orange.evaluation.scoring.AUC), ("Precision", Orange.evaluation.scoring.Precision), ("Recall", Orange.evaluation.scoring.Recall) ] # [end-snippet-2] #: input data on which to construct the learning curve self.data = None #: A {input_id: Learner} mapping of current learners from input channel self.learners = OrderedDict() #: A {input_id: List[Results]} mapping of input id to evaluation #: results list, one for each curve point self.results = OrderedDict() #: A {input_id: List[float]} mapping of input id to learning curve #: point scores self.curves = OrderedDict() # GUI box = gui.widgetBox(self.controlArea, "Info") self.infoa = gui.widgetLabel(box, 'No data on input.') self.infob = gui.widgetLabel(box, 'No learners.') gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Evaluation Scores") gui.comboBox(box, self, "scoringF", items=[x[0] for x in self.scoring], callback=self._invalidate_curves) gui.separator(self.controlArea) box = gui.widgetBox(self.controlArea, "Options") gui.spin(box, self, 'folds', 2, 100, step=1, label='Cross validation folds: ', keyboardTracking=False, callback=lambda: self._invalidate_results() if self.commitOnChange else None) gui.spin(box, self, 'steps', 2, 100, step=1, label='Learning curve points: ', keyboardTracking=False, callback=[self.updateCurvePoints, lambda: self._invalidate_results() if self.commitOnChange else None]) gui.checkBox(box, self, 'commitOnChange', 'Apply setting on any change') self.commitBtn = gui.button(box, self, "Apply Setting", callback=self._invalidate_results, disabled=True) gui.rubber(self.controlArea) # table widget self.table = gui.table(self.mainArea, selectionMode=QTableWidget.NoSelection)
def __init__(self): super().__init__() self.runaction = OWAction("Compute", self) self.runaction.triggered.connect(self.compute) self.addAction(self.runaction) geom = QApplication.desktop().availableGeometry() self.setGeometry(QRect(round(geom.width()*0.05), round(geom.height()*0.05), round(min(geom.width()*0.98, self.MAX_WIDTH)), round(min(geom.height()*0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) box0 = gui.widgetBox(self.controlArea, "", orientation="horizontal") #widget buttons: compute, set defaults, help gui.button(box0, self, "Compute", callback=self.compute) gui.button(box0, self, "Defaults", callback=self.defaults) gui.button(box0, self, "Help", callback=self.help1) gui.separator(self.controlArea, height=10) self.build_gui() self.process_showers() gui.rubber(self.controlArea) self.main_tabs = gui.tabWidget(self.mainArea) plot_tab = gui.createTabPage(self.main_tabs, "Results") out_tab = gui.createTabPage(self.main_tabs, "Output") view_box = oasysgui.widgetBox(plot_tab, "Results Options", addSpace=False, orientation="horizontal") view_box_1 = oasysgui.widgetBox(view_box, "", addSpace=False, orientation="vertical", width=350) self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="View Results", labelWidth=220, items=["No", "Yes"], callback=self.set_ViewType, sendSelectedValue=False, orientation="horizontal") self.tab = [] self.tabs = gui.tabWidget(plot_tab) self.initializeTabs() self.xoppy_output = QtGui.QTextEdit() self.xoppy_output.setReadOnly(True) out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.xoppy_output) self.xoppy_output.setFixedHeight(600) self.xoppy_output.setFixedWidth(600) gui.rubber(self.mainArea)
def __init__(self): super().__init__() geom = QApplication.desktop().availableGeometry() self.setGeometry( QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Read Surface", callback=self.read_surface) button.setFixedHeight(45) button = gui.button(button_box, self, "Render Surface", callback=self.render_surface) button.setFixedHeight(45) input_box_l = oasysgui.widgetBox(self.controlArea, "Input", addSpace=True, orientation="horizontal", height=self.TABS_AREA_HEIGHT) self.le_surface_file_name = oasysgui.lineEdit(input_box_l, self, "surface_file_name", "Surface File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(input_box_l, self, "...", callback=self.selectSurfaceFile) self.figure = Figure(figsize=(600, 600)) self.figure.patch.set_facecolor('white') self.axis = self.figure.add_subplot(111, projection='3d') self.axis.set_zlabel("Z [m]") self.figure_canvas = FigureCanvasQTAgg(self.figure) self.mainArea.layout().addWidget(self.figure_canvas) gui.rubber(self.mainArea)
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.runaction = widget.OWAction("Read Wavefront hdf5 File", self) self.runaction.triggered.connect(self.read_file) self.addAction(self.runaction) self.setFixedWidth(590) self.setFixedHeight(250) left_box_1 = oasysgui.widgetBox(self.controlArea, "HDF5 Local File Selection", addSpace=True, orientation="vertical", width=570, height=100) figure_box = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="vertical", width=550, height=50) self.le_file_name = oasysgui.lineEdit(figure_box, self, "file_name", "File Name", labelWidth=190, valueType=str, orientation="horizontal") self.le_file_name.setFixedWidth(360) self.le_data_path = oasysgui.lineEdit(figure_box, self, "data_path", "Group (wavefront name)", labelWidth=190, valueType=str, orientation="horizontal") self.le_data_path.setFixedWidth(360) gui.separator(left_box_1, height=20) button = gui.button(self.controlArea, self, "Browse File and Send Data", callback=self.read_file) button.setFixedHeight(45) gui.separator(self.controlArea, height=20) button = gui.button(self.controlArea, self, "Send Data", callback=self.send_data) button.setFixedHeight(45) gui.rubber(self.controlArea)
def __init__(self): super().__init__() geom = QApplication.desktop().availableGeometry() self.setGeometry(QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Read Thickness", callback=self.read_surface) button.setFixedHeight(45) button = gui.button(button_box, self, "Render Thickness", callback=self.render_surface) button.setFixedHeight(45) input_box_l = oasysgui.widgetBox(self.controlArea, "Input", addSpace=True, orientation="vertical", height=460, width=self.CONTROL_AREA_WIDTH) gui.button(input_box_l, self, "Select Thickness Error Profile Data Files", callback=self.select_files) self.files_area = oasysgui.textArea(height=250) self.refresh_files_text_area() input_box_l.layout().addWidget(self.files_area) gui.comboBox(input_box_l, self, "separator", label="Separator", labelWidth=350, items=["Comma", "Space"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(input_box_l, self, "skip_rows", label="Skip Rows", labelWidth=350, orientation="horizontal", valueType=int) oasysgui.lineEdit(input_box_l, self, "conversion_to_m_z", label="Thickness conversion to m", labelWidth=300, orientation="horizontal", valueType=float) oasysgui.lineEdit(input_box_l, self, "conversion_to_m_xy", label="Coordinates conversion to m", labelWidth=300, orientation="horizontal", valueType=float) gui.comboBox(input_box_l, self, "negate", label="Invert Surface", labelWidth=350, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") main_tabs = oasysgui.tabWidget(self.mainArea) plot_tab = oasysgui.createTabPage(main_tabs, "Thickness Error Surfaces") self.tab = [] self.tabs = oasysgui.tabWidget(plot_tab) self.initialize_figures() gui.rubber(self.controlArea) gui.rubber(self.mainArea)
def __init__(self): self.setFixedWidth(300) self.setFixedHeight(100) gui.separator(self.controlArea, height=40) gui.button(self.controlArea, self, "Read Spectrum File (autobinning.dat)", callback=self.read_spectrum_file) 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, " 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, " 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, show_automatic_box=True): super().__init__(show_automatic_box=show_automatic_box) self.runaction = widget.OWAction("Run Shadow/Trace", self) self.runaction.triggered.connect(self.traceOpticalElement) self.addAction(self.runaction) ################################# # FIX A WEIRD BEHAVIOUR AFTER DISPLAY # THE WIDGET: PROBABLY ON SIGNAL MANAGER self.dumpSettings() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") self.button_trace = gui.button(button_box, self, "Run Shadow/Trace", callback=self.traceOpticalElement) font = QFont(self.button_trace.font()) font.setBold(True) self.button_trace.setFont(font) palette = QPalette(self.button_trace.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Blue')) self.button_trace.setPalette(palette) # assign new palette self.button_trace.setFixedHeight(45) self.button_reset = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings) font = QFont(self.button_reset.font()) font.setItalic(True) self.button_reset.setFont(font) palette = QPalette(self.button_reset.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Red')) self.button_reset.setPalette(palette) # assign new palette self.button_reset.setFixedHeight(45) self.button_reset.setFixedWidth(150) gui.separator(self.controlArea) self.tabs_setting = oasysgui.tabWidget(self.controlArea) self.tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT-5) self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5) self.tab_bas = oasysgui.createTabPage(self.tabs_setting, "Basic Setting") self.tab_adv = oasysgui.createTabPage(self.tabs_setting, "Advanced Setting") adv_other_box = oasysgui.widgetBox(self.tab_adv, "Optional file output", addSpace=False, orientation="vertical") gui.comboBox(adv_other_box, self, "file_to_write_out", label="Files to write out", labelWidth=150, items=["All", "Mirror", "Image", "None", "Debug (All + start.xx/end.xx)"], sendSelectedValue=False, orientation="horizontal")
def init_gui(self, container): gui.lineEdit(container, self, "phase_name", "Phase Name (will appear in tabs and plots)", labelWidth=260, valueType=str, callback=self.widget.dump_phase_name) self.cb_symmetry = orangegui.comboBox(container, self, "symmetry", label="Symmetry", items=Symmetry.tuple(), callback=self.set_symmetry, orientation="horizontal") OWGenericWidget.create_box_in_widget(self, container, "a", "a [nm]", add_callback=True, min_value=0.0, min_accepted=False, trim=5) orangegui.separator(container) structure_box = gui.widgetBox(container, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH) gui.lineEdit(structure_box, self, "formula", "Chemical Formula", labelWidth=110, valueType=str, callback=self.widget.dump_formula) OWGenericWidget.create_box_in_widget(self, structure_box, "intensity_scale_factor", "I0", add_callback=True, min_value=0.0, min_accepted=False, trim=5)
def __init__(self, show_automatic_box=True): super().__init__(show_automatic_box) self.setFixedWidth(420) self.setFixedHeight(350) gen_box = gui.widgetBox(self.controlArea, "Energy Cirp", addSpace=True, orientation="vertical") button_box = oasysgui.widgetBox(gen_box, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Generate Energy Spectrum", callback=self.generate_energy_spectrum) 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(gen_box, height=10) result_box = oasysgui.widgetBox(gen_box, "Energy Cirp Setting", addSpace=True, orientation="vertical") gui.comboBox(result_box, self, "units", label="Units", labelWidth=260, items=["Energy", "Wavelength"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(result_box, self, "kind_of_calculation", label="Kind of calculation", labelWidth=110, items=["Energy/Wavelength = C + k*Y", "User File (Energy/Wavelength vs. Y)"], sendSelectedValue=False, orientation="horizontal", callback=self.set_KindOfCalculation) self.kind_box_1 = oasysgui.widgetBox(result_box, "", addSpace=True, orientation="vertical", height=50) oasysgui.lineEdit(self.kind_box_1, self, "factor", "Proportionality factor (k) [to eV/Å]", labelWidth=240, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_box_1, self, "central_value", "Central Energy/Wavelength Value [eV/Å]", labelWidth=240, valueType=float, orientation="horizontal") self.kind_box_2 = oasysgui.widgetBox(result_box, "", addSpace=True, orientation="horizontal", height=50) self.le_user_file = oasysgui.lineEdit(self.kind_box_2, self, "user_file", "File Name", labelWidth=60, valueType=str, orientation="horizontal") gui.button(self.kind_box_2, self, "...", callback=self.selectUserFile) self.set_KindOfCalculation()
def __init__(self, show_automatic_box=True): super().__init__(show_automatic_box=show_automatic_box) self.runaction = widget.OWAction("Run Shadow/Trace", self) self.runaction.triggered.connect(self.traceOpticalElement) self.addAction(self.runaction) ################################# # FIX A WEIRD BEHAVIOUR AFTER DISPLAY # THE WIDGET: PROBABLY ON SIGNAL MANAGER self.dumpSettings() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") self.button_trace = gui.button(button_box, self, "Run Shadow/Trace", callback=self.traceOpticalElement) font = QFont(self.button_trace.font()) font.setBold(True) self.button_trace.setFont(font) palette = QPalette(self.button_trace.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Blue')) self.button_trace.setPalette(palette) # assign new palette self.button_trace.setFixedHeight(45) self.button_reset = gui.button(button_box, self, "Reset Fields", callback=self.callResetSettings) font = QFont(self.button_reset.font()) font.setItalic(True) self.button_reset.setFont(font) palette = QPalette(self.button_reset.palette()) # make a copy of the palette palette.setColor(QPalette.ButtonText, QColor('Dark Red')) self.button_reset.setPalette(palette) # assign new palette self.button_reset.setFixedHeight(45) self.button_reset.setFixedWidth(150) gui.separator(self.controlArea) self.tabs_setting = gui.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, "Basic Setting") self.tab_adv = oasysgui.createTabPage(self.tabs_setting, "Advanced Setting") adv_other_box = oasysgui.widgetBox(self.tab_adv, "Optional file output", addSpace=False, orientation="vertical") gui.comboBox(adv_other_box, self, "file_to_write_out", label="Files to write out", labelWidth=150, items=["All", "Mirror", "Image", "None", "Debug (All + start.xx/end.xx)"], sendSelectedValue=False, orientation="horizontal")
def __init__(self): super().__init__() self.setFixedWidth(585) self.setFixedHeight(155) left_box_1 = oasysgui.widgetBox(self.controlArea, "Footprint Settings", addSpace=True, orientation="vertical", width=570, height=130) self.le_beam_file_name = oasysgui.lineEdit(left_box_1, self, "beam_file_name", "Shadow File Name", labelWidth=120, valueType=str, orientation="horizontal") self.le_beam_file_name.setReadOnly(True) font = QtGui.QFont(self.le_beam_file_name.font()) font.setBold(True) self.le_beam_file_name.setFont(font) palette = QtGui.QPalette( self.le_beam_file_name.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) self.le_beam_file_name.setPalette(palette) gui.comboBox(left_box_1, self, "kind_of_power", label="Kind Of Power", items=["Incident", "Absorbed", "Transmitted"], labelWidth=260, sendSelectedValue=False, orientation="horizontal") gui.separator(left_box_1) gui.button(left_box_1, self, "Send Footprint", callback=self.calculate_footprint(), height=25) gui.rubber(self.controlArea)
def __init__(self, show_automatic_box=False): super().__init__(show_automatic_box=show_automatic_box) self.runaction = widget.OWAction("Copy Source Parameters", self) self.runaction.triggered.connect(self.copy_src_parameters) self.addAction(self.runaction) self.runaction = widget.OWAction("Paste Source Parameters", self) self.runaction.triggered.connect(self.paste_src_parameters) self.addAction(self.runaction) self.runaction = widget.OWAction("Run Shadow/Source", self) self.runaction.triggered.connect(self.runShadowSource) self.addAction(self.runaction) self.general_options_box.setVisible(False) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Shadow/Source", callback=self.runShadowSource) 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(150) gui.separator(self.controlArea)
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_gui(self, container): self.cb_active = orangegui.comboBox(container, self, "active", label="Active", items=["No", "Yes"], callback=self.set_active, orientation="horizontal") orangegui.separator(container) self.main_box = gui.widgetBox(container, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 10) self.init_main_box()
def build_gui(self): main_box = oasysgui.widgetBox(self.controlArea, "Gaussian Wavefront Input Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-5, height=200) oasysgui.lineEdit(main_box, self, "qnC", "e-bunch charge [nC]", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(main_box, self, "thetaOM", "thetaOM", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(main_box, self, "ekev", "Energy [keV]", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(main_box, height=5) oasysgui.lineEdit(main_box, self, "pulse_duration", "Pulse Duration", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(main_box, self, "pulseEnergy", "Pulse Energy", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(main_box, self, "coh_time", "Coherence time", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(main_box, height=5) oasysgui.lineEdit(main_box, self, "distance", "Distance to next [m]", labelWidth=260, valueType=float, orientation="horizontal")
def __init__(self): super().__init__() geom = QApplication.desktop().availableGeometry() self.setGeometry( QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Load HDF5 file", callback=self.load_file) button.setFixedHeight(45) input_box_l = oasysgui.widgetBox(self.controlArea, "Input", addSpace=True, orientation="horizontal", height=self.TABS_AREA_HEIGHT) self.le_hdf5_file_name = oasysgui.lineEdit(input_box_l, self, "hdf5_file_name", "HDF5 File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(input_box_l, self, "...", callback=self.selectPlotXYFile) self.tree_view = Hdf5TreeViewWidget() self.mainArea.layout().addWidget(self.tree_view) gui.rubber(self.mainArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Run Shadow Beamline Simulation", self) self.runaction.triggered.connect(self.runSimulation) self.addAction(self.runaction) gui.separator(self.controlArea, height=600) button_box = ShadowGui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Simulation", callback=self.runSimulation) 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)
def __init__(self): super().__init__(show_automatic_box=True) self.setFixedHeight(410) main_box = gui.widgetBox(self.controlArea, "Line Profiles", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 10, height=300) button_box = gui.widgetBox(main_box, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH - 25) gui.button(button_box, self, "Debye-Waller Parameters", height=40, callback=self.send_debye_waller) orangegui.comboBox(main_box, self, "use_single_parameter_set", label="Use single set of Parameters", labelWidth=350, orientation="horizontal", items=["No", "Yes"], callback=self.set_use_single_parameter_set, sendSelectedValue=False) orangegui.separator(main_box) self.debye_wallers_tabs = gui.tabWidget(main_box) self.set_use_single_parameter_set(on_init=True) runaction = OWAction("Send Debye-Waller Parameters", self) runaction.triggered.connect(self.send_debye_waller) self.addAction(runaction) orangegui.rubber(self.controlArea)
def build_gui(self): main_box = oasysgui.widgetBox(self.controlArea, "Wofry Wavefront Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 5, height=300) le = oasysgui.lineEdit(main_box, self, "source_lambda", "Wavelength [nm]", labelWidth=260, valueType=float, orientation="horizontal") le.setReadOnly(True) font = QFont(le.font()) font.setBold(True) le.setFont(font) palette = QPalette(le.palette()) palette.setColor(QPalette.Text, QColor('dark blue')) palette.setColor(QPalette.Base, QColor(243, 240, 140)) le.setPalette(palette) gui.separator(main_box, height=5) gui.comboBox(main_box, self, "reset_phase", label="Reset Phase", items=["No", "Yes"], labelWidth=300, sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(main_box, self, "normalization_factor", "Normalization Factor", labelWidth=260, valueType=float, orientation="horizontal")
def __init__(self): super().__init__() self.runaction = widget.OWAction("Run Shadow/Trace", self) self.runaction.triggered.connect(self.traceOpticalElement) self.addAction(self.runaction) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tab_bas = ShadowGui.createTabPage(tabs_setting, "Basic Setting") lens_box = ShadowGui.widgetBox(tab_bas, "Input Parameters", addSpace=False, orientation="vertical", height=600, width=450) self.le_source_plane_distance = ShadowGui.lineEdit(lens_box, self, "source_plane_distance", "Source Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal") self.le_image_plane_distance = ShadowGui.lineEdit(lens_box, self, "image_plane_distance", "Image Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(self.controlArea) button_box = ShadowGui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Shadow/trace", callback=self.traceOpticalElement) 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)
def init_gui(self, container): gui.lineEdit(container, self, "phase_name", "Phase Name (will appear in tabs and plots)", labelWidth=260, valueType=str, callback=self.widget.dump_phase_name) self.cb_symmetry = orangegui.comboBox(container, self, "symmetry", label="Symmetry", items=Symmetry.tuple(), callback=self.set_symmetry, orientation="horizontal") OWGenericWidget.create_box_in_widget(self, container, "a", "a [nm]", add_callback=True, min_value=0.0, min_accepted=False, trim=5) orangegui.separator(container) structure_box = gui.widgetBox(container, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH) self.structure_box_1 = gui.widgetBox(structure_box, "", orientation="vertical", width=self.CONTROL_AREA_WIDTH - 5, height=90) file_box = gui.widgetBox(self.structure_box_1, "", orientation="horizontal", width=self.CONTROL_AREA_WIDTH-10) self.le_cif_file = gui.lineEdit(file_box, self, value="cif_file", valueType=str, label="CIF File", labelWidth=50, callback=self.widget.dump_cif_file) orangegui.button(file_box, self, "...", callback=self.open_folders) gui.lineEdit(self.structure_box_1, self, "formula", "Chemical Formula", labelWidth=110, valueType=str, callback=self.widget.dump_formula) OWGenericWidget.create_box_in_widget(self, self.structure_box_1, "intensity_scale_factor", "I0", add_callback=True, min_value=0.0, min_accepted=False, trim=5) text_area_box = gui.widgetBox(structure_box, "Calculation Result", orientation="vertical", height=165, width=self.CONTROL_AREA_WIDTH - 10) self.text_area = gui.textArea(height=125, width=self.CONTROL_AREA_WIDTH - 30, readOnly=True) self.text_area.setText("") text_area_box.layout().addWidget(self.text_area) self.is_on_init = False
def __init__(self): super().__init__() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tab_bas = oasysgui.createTabPage(tabs_setting, "Basic Setting") tab_adv = oasysgui.createTabPage(tabs_setting, "Advanced Setting") lens_box = oasysgui.widgetBox(tab_bas, "Input Parameters", addSpace=False, orientation="vertical", height=600, width=450) self.le_source_plane_distance = oasysgui.lineEdit(lens_box, self, "source_plane_distance", "Source Plane Distance", labelWidth=350, valueType=float, orientation="horizontal") self.le_image_plane_distance = oasysgui.lineEdit(lens_box, self, "image_plane_distance", "Image Plane Distance", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(lens_box) self.le_input_diameter = oasysgui.lineEdit(lens_box, self, "input_diameter", "Input Diameter", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "angular_acceptance", "Angular Acceptance [deg]", labelWidth=350, valueType=float, orientation="horizontal") self.le_inner_diameter = oasysgui.lineEdit(lens_box, self, "inner_diameter", "Central Diameter", labelWidth=350, valueType=float, orientation="horizontal") self.le_output_diameter = oasysgui.lineEdit(lens_box, self, "output_diameter", "Output Diameter", labelWidth=350, valueType=float, orientation="horizontal") self.le_focal_length = oasysgui.lineEdit(lens_box, self, "focal_length", "Focal Length", labelWidth=350, valueType=float, orientation="horizontal") self.le_focus_dimension = oasysgui.lineEdit(lens_box, self, "focus_dimension", "Approximate focus dimension", labelWidth=350, valueType=float, orientation="horizontal") self.le_lens_length = oasysgui.lineEdit(lens_box, self, "lens_length", "Lens Total Length", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(lens_box) oasysgui.lineEdit(lens_box, self, "transmittance", "Lens Transmittance [%]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(self.controlArea, height=80) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Shadow/trace", callback=self.traceOpticalElement) 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)
def __init__(self): super().__init__() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tab_bas = oasysgui.createTabPage(tabs_setting, "Basic Setting") tab_adv = oasysgui.createTabPage(tabs_setting, "Advanced Setting") lens_box = oasysgui.widgetBox(tab_bas, "Input Parameters", addSpace=False, orientation="vertical", height=600, width=450) oasysgui.lineEdit(lens_box, self, "source_plane_distance", "Source Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "image_plane_distance", "Image Plane Distance [cm]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(lens_box) oasysgui.lineEdit(lens_box, self, "input_diameter", "Input Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "angular_acceptance", "Angular Acceptance [deg]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "inner_diameter", "Central Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "output_diameter", "Output Diameter [cm]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "focal_length", "Focal Length [cm]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "focus_dimension", "Approximate focus dimension [um]", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(lens_box, self, "lens_length", "Lens Total Length [cm]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(lens_box) oasysgui.lineEdit(lens_box, self, "transmittance", "Lens Transmittance [%]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(self.controlArea, height=80) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run Shadow/trace", callback=self.traceOpticalElement) 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)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Calculate Height Profile", self) self.runaction.triggered.connect(self.calculate_heigth_profile_ni) self.addAction(self.runaction) self.runaction = widget.OWAction("Generate Height Profile File", self) self.runaction.triggered.connect(self.generate_heigth_profile_file_ni) self.addAction(self.runaction) geom = QApplication.desktop().availableGeometry() self.setGeometry(QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) # DABAM INITIALIZATION self.server = dabam.dabam() self.server.set_input_silent(True) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Calculate Height\nProfile", callback=self.calculate_heigth_profile) button.setFixedHeight(45) button = gui.button(button_box, self, "Generate Height\nProfile File", callback=self.generate_heigth_profile_file) 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.setFixedWidth(150) button = gui.button(button_box, self, "Reset Fields", callback=self.call_reset_settings) 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) gui.separator(self.controlArea) tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT) tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5) tab_input = oasysgui.createTabPage(tabs_setting, "DABAM Search Setting") tab_gener = oasysgui.createTabPage(tabs_setting, "DABAM Generation Setting") tab_out = oasysgui.createTabPage(tabs_setting, "Output") manual_box = oasysgui.widgetBox(tab_input, "Manual Entry", addSpace=True, orientation="vertical") oasysgui.lineEdit(manual_box, self, "entry_number", "Entry Number", labelWidth=300, valueType=int, orientation="horizontal") gui.separator(manual_box) button = gui.button(manual_box, self, "Retrieve Profile", callback=self.retrieve_profile) button.setFixedHeight(35) button.setFixedWidth(self.CONTROL_AREA_WIDTH-35) input_box = oasysgui.widgetBox(tab_input, "Search Parameters", addSpace=True, orientation="vertical") gui.comboBox(input_box, self, "shape", label="Mirror Shape", labelWidth=300, items=["All", "Plane", "Cylindrical", "Elliptical", "Toroidal", "Spherical"], sendSelectedValue=False, orientation="horizontal") gui.separator(input_box) input_box_1 = oasysgui.widgetBox(input_box, "", addSpace=True, orientation="horizontal") oasysgui.lineEdit(input_box_1, self, "slope_error_from", "Slope Error From (" + u"\u03BC" + "rad)", labelWidth=150, valueType=float, orientation="horizontal") oasysgui.lineEdit(input_box_1, self, "slope_error_to", "To (" + u"\u03BC" + "rad)", labelWidth=60, valueType=float, orientation="horizontal") input_box_2 = oasysgui.widgetBox(input_box, "", addSpace=True, orientation="horizontal") self.le_dimension_y_from = oasysgui.lineEdit(input_box_2, self, "dimension_y_from", "Mirror Length From", labelWidth=150, valueType=float, orientation="horizontal") self.le_dimension_y_to = oasysgui.lineEdit(input_box_2, self, "dimension_y_to", "To", labelWidth=60, valueType=float, orientation="horizontal") table_box = oasysgui.widgetBox(tab_input, "Search Results", addSpace=True, orientation="vertical", height=290) self.overlay_search = Overlay(table_box, self.search_profiles) self.overlay_search.hide() button = gui.button(input_box, self, "Search", callback=self.overlay_search.show) button.setFixedHeight(35) button.setFixedWidth(self.CONTROL_AREA_WIDTH-35) gui.comboBox(table_box, self, "use_undetrended", label="Use Undetrended Profile", labelWidth=300, items=["No", "Yes"], callback=self.table_item_clicked, sendSelectedValue=False, orientation="horizontal") gui.separator(table_box) self.scrollarea = QScrollArea() self.scrollarea.setMinimumWidth(self.CONTROL_AREA_WIDTH-35) table_box.layout().addWidget(self.scrollarea, alignment=Qt.AlignHCenter) self.table = QTableWidget(1, 5) self.table.setAlternatingRowColors(True) self.table.horizontalHeader().setResizeMode(QHeaderView.Fixed) self.table.verticalHeader().setVisible(False) self.table.setColumnWidth(0, 40) self.table.setColumnWidth(1, 70) self.table.setColumnWidth(2, 70) self.table.setColumnWidth(3, 85) self.table.setColumnWidth(4, 80) self.table.resizeRowsToContents() self.table.setSelectionBehavior(QAbstractItemView.SelectRows) self.table.itemClicked.connect(self.table_item_clicked) self.scrollarea.setWidget(self.table) self.scrollarea.setWidgetResizable(1) output_profile_box = oasysgui.widgetBox(tab_gener, "Surface Generation Parameters", addSpace=True, orientation="vertical", height=270) self.le_dimension_x = oasysgui.lineEdit(output_profile_box, self, "dimension_x", "Width", labelWidth=300, valueType=float, orientation="horizontal") self.le_step_x = oasysgui.lineEdit(output_profile_box, self, "step_x", "Step Width", labelWidth=300, valueType=float, orientation="horizontal") gui.comboBox(output_profile_box, self, "center_y", label="Center Profile in the middle of O.E.", labelWidth=300, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(output_profile_box, self, "modify_y", label="Modify Length?", labelWidth=240, items=["No", "Rescale to new length", "Fit to new length (fill or cut)"], callback=self.set_ModifyY, sendSelectedValue=False, orientation="horizontal") self.modify_box_1 = oasysgui.widgetBox(output_profile_box, "", addSpace=False, orientation="vertical", height=50) self.modify_box_2 = oasysgui.widgetBox(output_profile_box, "", addSpace=False, orientation="vertical", height=50) oasysgui.lineEdit(self.modify_box_2, self, "scale_factor_y", "Scale Factor", labelWidth=300, valueType=float, orientation="horizontal") self.modify_box_3 = oasysgui.widgetBox(output_profile_box, "", addSpace=False, orientation="vertical", height=50) self.le_new_length = oasysgui.lineEdit(self.modify_box_3, self, "new_length", "New Length", labelWidth=300, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.modify_box_3, self, "filler_value", "Filler Value (if new length > profile length) [nm]", labelWidth=300, valueType=float, orientation="horizontal") self.set_ModifyY() gui.comboBox(output_profile_box, self, "renormalize_y", label="Renormalize Length Profile to different RMS", labelWidth=300, items=["No", "Yes"], callback=self.set_RenormalizeY, sendSelectedValue=False, orientation="horizontal") self.output_profile_box_1 = oasysgui.widgetBox(output_profile_box, "", addSpace=True, orientation="vertical") gui.comboBox(self.output_profile_box_1, self, "error_type_y", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + u"\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.output_profile_box_1, self, "rms_y", "Rms Value", labelWidth=300, valueType=float, orientation="horizontal") self.set_RenormalizeY() output_box = oasysgui.widgetBox(tab_gener, "Outputs", addSpace=True, orientation="vertical") select_file_box = oasysgui.widgetBox(output_box, "", addSpace=True, orientation="horizontal") self.le_heigth_profile_file_name = oasysgui.lineEdit(select_file_box, self, "heigth_profile_file_name", "Output File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(select_file_box, self, "...", callback=self.selectFile) self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = oasysgui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=500) out_box.layout().addWidget(self.shadow_output) gui.rubber(self.controlArea) self.initializeTabs() gui.rubber(self.mainArea) self.overlay_search.raise_()
def __init__(self, show_automatic_box=True): super().__init__() gui.button(self.controlArea, self, "Calculate", callback=self.calculate, height=45) general_box = oasysgui.widgetBox(self.controlArea, "General Settings", addSpace=True, orientation="vertical", width=self.CONTROL_AREA_WIDTH-8, height=220) gui.comboBox(general_box, self, "mode", label="Mode", labelWidth=250, items=["Center at Origin", "Center at Baricenter", "Define Center..."], callback=self.set_Center, sendSelectedValue=False, orientation="horizontal") self.center_box = oasysgui.widgetBox(general_box, "", addSpace=False, orientation="vertical", height=50) self.center_box_empty = oasysgui.widgetBox(general_box, "", addSpace=False, orientation="vertical", height=50) self.le_center_x = oasysgui.lineEdit(self.center_box, self, "center_x", "Center X", labelWidth=260, valueType=float, orientation="horizontal") self.le_center_z = oasysgui.lineEdit(self.center_box, self, "center_z", "Center Z", labelWidth=260, valueType=float, orientation="horizontal") self.set_Center() gui.comboBox(general_box, self, "y_range", label="Y Range",labelWidth=250, items=["<Default>", "Set.."], callback=self.set_YRange, sendSelectedValue=False, orientation="horizontal") self.yrange_box = oasysgui.widgetBox(general_box, "", addSpace=False, orientation="vertical", height=100) self.yrange_box_empty = oasysgui.widgetBox(general_box, "", addSpace=False, orientation="vertical", height=100) self.le_y_range_min = oasysgui.lineEdit(self.yrange_box, self, "y_range_min", "Y min", labelWidth=260, valueType=float, orientation="horizontal") self.le_y_range_max = oasysgui.lineEdit(self.yrange_box, self, "y_range_max", "Y max", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.yrange_box, self, "y_npoints", "Points", labelWidth=260, valueType=float, orientation="horizontal") self.set_YRange() screen_box = oasysgui.widgetBox(self.controlArea, "Screen Position Settings", addSpace=True, orientation="vertical", height=110) self.image_plane_combo = gui.comboBox(screen_box, self, "image_plane", label="Position of the Image", items=["On Image Plane", "Retraced"], labelWidth=260, callback=self.set_ImagePlane, sendSelectedValue=False, orientation="horizontal") self.image_plane_box = oasysgui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", height=110) self.image_plane_box_empty = oasysgui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", height=110) oasysgui.lineEdit(self.image_plane_box, self, "image_plane_new_position", "Image Plane new Position", labelWidth=220, valueType=float, orientation="horizontal") gui.comboBox(self.image_plane_box, self, "image_plane_rel_abs_position", label="Position Type", labelWidth=250, items=["Absolute", "Relative"], sendSelectedValue=False, orientation="horizontal") self.set_ImagePlane() gui.separator(self.controlArea, height=200) tabs_setting = gui.tabWidget(self.mainArea) tabs_setting.setFixedHeight(self.IMAGE_HEIGHT+5) tabs_setting.setFixedWidth(self.IMAGE_WIDTH) tab_info = oasysgui.createTabPage(tabs_setting, "Focnew Info") tab_scan = oasysgui.createTabPage(tabs_setting, "Focnew Scan") self.focnewInfo = QtGui.QTextEdit() self.focnewInfo.setReadOnly(True) self.focnewInfo.setMaximumHeight(self.IMAGE_HEIGHT-35) info_box = oasysgui.widgetBox(tab_info, "", addSpace=True, orientation="horizontal", height = self.IMAGE_HEIGHT-20, width = self.IMAGE_WIDTH-20) info_box.layout().addWidget(self.focnewInfo) self.image_box = gui.widgetBox(tab_scan, "Scan", addSpace=True, orientation="vertical") self.image_box.setFixedHeight(self.IMAGE_HEIGHT-30) self.image_box.setFixedWidth(self.IMAGE_WIDTH-20)
def build_gui(self): self.leftWidgetPart.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.leftWidgetPart.setMaximumWidth(self.CONTROL_AREA_WIDTH + 20) self.leftWidgetPart.updateGeometry() box = oasysgui.widgetBox(self.controlArea, self.name + " Input Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-10) idx = -1 #widget index 10 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "NELEMENTS", label=self.unitLabels()[idx], addSpace=False, items=['0','1', '2', '3', '4', '5'], valueType=int, orientation="horizontal", callback=self.set_NELEMENTS, labelWidth=330) self.show_at(self.unitFlags()[idx], box1) #widget index 11 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL1_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 12 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL1_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 13 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 14 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 15 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 16 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 17 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL2_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 18 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL2_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 19 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 20 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 21 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 22 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 23 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL3_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 24 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL3_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 25 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 26 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 27 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 28 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 29 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL4_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 30 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL4_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 31 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 32 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 33 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 34 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 35 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL5_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 36 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL5_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 37 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 38 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 39 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 40 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 41 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) gui.comboBox(box1, self, "PLOT_SETS", label=self.unitLabels()[idx], addSpace=False, items=['Input beam', 'Beam transmitted after last element', 'Absorption by ALL elements', 'Absorption by LAST element'], valueType=int, orientation="horizontal", labelWidth=250, callback=self.replot_results) self.show_at(self.unitFlags()[idx], box1)
def build_gui(self): self.leftWidgetPart.setSizePolicy(QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)) self.leftWidgetPart.setMaximumWidth(self.CONTROL_AREA_WIDTH + 20) self.leftWidgetPart.updateGeometry() box = oasysgui.widgetBox(self.controlArea, self.name + " Input Parameters", orientation="vertical", width=self.CONTROL_AREA_WIDTH-10) idx = -1 #widget index 2 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "SOURCE", label=self.unitLabels()[idx], addSpace=False, items=['Normalized to 1 (Standard E grid) ', 'Normalized to 1 (E from keyboard) ', 'From external file. '], valueType=int, orientation="horizontal", labelWidth=150) self.show_at(self.unitFlags()[idx], box1) #widget index 6 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ENER_MIN", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 7 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ENER_MAX", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 8 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ENER_N", label=self.unitLabels()[idx], addSpace=False, valueType=int, validator=QIntValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 9 idx += 1 box1 = gui.widgetBox(box) file_box = oasysgui.widgetBox(box1, "", addSpace=False, orientation="horizontal", height=25) self.le_file = oasysgui.lineEdit(file_box, self, "SOURCE_FILE", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal") self.show_at(self.unitFlags()[idx], box1) #widget index 10 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "NELEMENTS", label=self.unitLabels()[idx], addSpace=False, items=['1', '2', '3', '4', '5'], valueType=int, orientation="horizontal", callback=self.set_NELEMENTS, labelWidth=330) self.show_at(self.unitFlags()[idx], box1) #widget index 11 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL1_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 12 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL1_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 13 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 14 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 15 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 16 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL1_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 17 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL2_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 18 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL2_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 19 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 20 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 21 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 22 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL2_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 23 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL3_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 24 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL3_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 25 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 26 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 27 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 28 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL3_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 29 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL4_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 30 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL4_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 31 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 32 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 33 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 34 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL4_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 35 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) oasysgui.lineEdit(box1, self, "EL5_FOR", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 36 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "EL5_FLAG", label=self.unitLabels()[idx], addSpace=False, items=['Filter', 'Mirror'], valueType=int, orientation="horizontal", callback=self.set_EL_FLAG, labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 37 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_THI", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 38 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_ANG", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 39 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_ROU", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 40 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "EL5_DEN", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 41 idx += 1 box1 = gui.widgetBox(box) gui.separator(box1, height=7) gui.comboBox(box1, self, "FILE_DUMP", label=self.unitLabels()[idx], addSpace=False, items=['No', 'Yes (xpower.spec)'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1)
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 __init__(self, show_automatic_box=True): super().__init__() self.runaction = widget.OWAction("Merge Beams", self) self.runaction.triggered.connect(self.merge_beams) self.addAction(self.runaction) self.setFixedWidth(400) self.setFixedHeight(400) gen_box = gui.widgetBox(self.controlArea, "Merge Shadow Beams", addSpace=True, orientation="vertical") button_box = oasysgui.widgetBox(gen_box, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Merge Beams and Send", callback=self.merge_beams) 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) weight_box = oasysgui.widgetBox(gen_box, "Relative Weights", addSpace=False, orientation="vertical") gui.comboBox(weight_box, self, "use_weights", label="Use Relative Weights?", labelWidth=350, items=["No", "Yes"], callback=self.set_UseWeights, sendSelectedValue=False, orientation="horizontal") gui.separator(weight_box, height=10) self.le_weight_input_beam1 = oasysgui.lineEdit(weight_box, self, "weight_input_beam1", "Input Beam 1 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam2 = oasysgui.lineEdit(weight_box, self, "weight_input_beam2", "Input Beam 2 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam3 = oasysgui.lineEdit(weight_box, self, "weight_input_beam3", "Input Beam 3 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam4 = oasysgui.lineEdit(weight_box, self, "weight_input_beam4", "Input Beam 4 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam5 = oasysgui.lineEdit(weight_box, self, "weight_input_beam5", "Input Beam 5 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam6 = oasysgui.lineEdit(weight_box, self, "weight_input_beam6", "Input Beam 6 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam7 = oasysgui.lineEdit(weight_box, self, "weight_input_beam7", "Input Beam 7 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam8 = oasysgui.lineEdit(weight_box, self, "weight_input_beam8", "Input Beam 8 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam9 = oasysgui.lineEdit(weight_box, self, "weight_input_beam9", "Input Beam 9 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam10 = oasysgui.lineEdit(weight_box, self, "weight_input_beam10", "Input Beam 10 weight", labelWidth=300, valueType=float, orientation="horizontal") self.le_weight_input_beam1.setEnabled(False) self.le_weight_input_beam2.setEnabled(False) self.le_weight_input_beam3.setEnabled(False) self.le_weight_input_beam4.setEnabled(False) self.le_weight_input_beam5.setEnabled(False) self.le_weight_input_beam6.setEnabled(False) self.le_weight_input_beam7.setEnabled(False) self.le_weight_input_beam8.setEnabled(False) self.le_weight_input_beam9.setEnabled(False) self.le_weight_input_beam10.setEnabled(False)
def __init__(self): super().__init__() self.setFixedWidth(570) self.setFixedHeight(397) self.controlArea.setFixedWidth(560) button_box = gui.widgetBox(self.controlArea, "", addSpace=True, orientation="horizontal") self.start_button = gui.button(button_box, self, "Send Beam", callback=self.sendSignal) self.start_button.setFixedHeight(45) button = gui.button(button_box, self, "Reset Accumulation", 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) left_box_1 = oasysgui.widgetBox(self.controlArea, "Accumulating Loop Management", addSpace=True, orientation="vertical", height=250) gui.comboBox(left_box_1, self, "kind_of_accumulation", label="Accumulated Quantity", labelWidth=350, items=["Number of Good Rays ", "Intensity of Good Rays"], callback=self.set_KindOfAccumulation, sendSelectedValue=False, orientation="horizontal") self.left_box_1_1 = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="vertical") self.left_box_1_2 = oasysgui.widgetBox(left_box_1, "", addSpace=True, orientation="vertical") oasysgui.lineEdit(self.left_box_1_1, self, "number_of_accumulated_rays", "Number of accumulated good rays\n(before sending signal)", labelWidth=350, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.left_box_1_2, self, "number_of_accumulated_rays", "Intenisty of accumulated good rays\n(before sending signal)", labelWidth=350, valueType=float, orientation="horizontal") self.set_KindOfAccumulation() gui.comboBox(left_box_1, self, "keep_go_rays", label="Remove lost rays from beam", labelWidth=350, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.separator(left_box_1) le = oasysgui.lineEdit(left_box_1, self, "current_number_of_rays", "Current number of good rays", labelWidth=350, valueType=int, orientation="horizontal") le.setReadOnly(True) font = QtGui.QFont(le.font()) font.setBold(True) le.setFont(font) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) le.setPalette(palette) self.le_current_intensity = oasysgui.lineEdit(left_box_1, self, "current_intensity", "Current intensity", labelWidth=350, valueType=float, orientation="horizontal") self.le_current_intensity.setReadOnly(True) font = QtGui.QFont(self.le_current_intensity.font()) font.setBold(True) self.le_current_intensity.setFont(font) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) self.le_current_intensity.setPalette(palette) le = oasysgui.lineEdit(left_box_1, self, "current_number_of_lost_rays", "Current number of lost rays", labelWidth=350, valueType=int, orientation="horizontal") le.setReadOnly(True) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark red')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) le.setPalette(palette) le = oasysgui.lineEdit(left_box_1, self, "current_number_of_total_rays", "Current number of total rays", labelWidth=350, valueType=int, orientation="horizontal") le.setReadOnly(True) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('black')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) le.setPalette(palette) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Compute", self) self.runaction.triggered.connect(self.compute) self.addAction(self.runaction) self.setFixedWidth(500) self.setFixedHeight(485) gui.separator(self.controlArea) box0 = gui.widgetBox(self.controlArea, "",orientation="horizontal") #widget buttons: compute, set defaults, help button = gui.button(box0, self, "Compute", callback=self.compute) button.setFixedHeight(45) button = gui.button(box0, self, "Defaults", callback=self.defaults) button.setFixedHeight(45) button = gui.button(box0, self, "Help", callback=self.help1) button.setFixedHeight(45) gui.separator(self.controlArea) box = oasysgui.widgetBox(self.controlArea, "Reflectivity Parameters", orientation="vertical") idx = -1 #widget index 0 idx += 1 oasysgui.lineEdit(box, self, "SYMBOL", label=self.unitLabels()[idx], addSpace=True, labelWidth=350, orientation="horizontal", callback=self.set_Density) self.show_at(self.unitFlags()[idx], box) #widget index 1 idx += 1 oasysgui.lineEdit(box, self, "DENSITY", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 2 idx += 1 box_2 = oasysgui.widgetBox(box, "", addSpace=True, orientation="horizontal") self.le_SHADOW_FILE = oasysgui.lineEdit(box_2, self, "SHADOW_FILE", label=self.unitLabels()[idx], addSpace=True, labelWidth=180, orientation="horizontal") gui.button(box_2, self, "...", callback=self.selectFile) self.show_at(self.unitFlags()[idx], box) #widget index 3 idx += 1 oasysgui.lineEdit(box, self, "E_MIN", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 4 idx += 1 oasysgui.lineEdit(box, self, "E_MAX", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 5 idx += 1 oasysgui.lineEdit(box, self, "E_STEP", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) self.process_showers() self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = oasysgui.widgetBox(self.controlArea, "System Output", addSpace=True, orientation="horizontal", height=150) out_box.layout().addWidget(self.shadow_output) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Run Hybrid", self) self.runaction.triggered.connect(self.run_hybrid) self.addAction(self.runaction) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Run HYBRID", callback=self.run_hybrid) 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) main_tabs = gui.tabWidget(self.mainArea) plot_tab = gui.createTabPage(main_tabs, "Plots") out_tab = gui.createTabPage(main_tabs, "Output") self.tabs = oasysgui.tabWidget(plot_tab) tabs_setting = oasysgui.tabWidget(self.controlArea) tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT) tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5) tab_bas = oasysgui.createTabPage(tabs_setting, "Hybrid Setting") box_1 = oasysgui.widgetBox(tab_bas, "Calculation Parameters", addSpace=True, orientation="vertical", height=250) gui.comboBox(box_1, self, "ghy_diff_plane", label="Diffraction Plane", labelWidth=310, items=["Sagittal", "Tangential", "Both"], callback=self.set_DiffPlane, sendSelectedValue=False, orientation="horizontal") gui.comboBox(box_1, self, "ghy_calcType", label="Calculation Type", labelWidth=100, items=["Diffraction by Simple Aperture", "Diffraction by Mirror Size", "Diffraction by Mirror Size + Figure Errors", "Diffraction by Lens or C.R.L. Size"], callback=self.set_CalculationType, sendSelectedValue=False, orientation="horizontal") gui.separator(box_1, 10) self.cb_focal_length_calc = gui.comboBox(box_1, self, "focal_length_calc", label="Focal Length", labelWidth=180, items=["Use O.E. Focal Distance", "Specify Value"], callback=self.set_FocalLengthCalc, sendSelectedValue=False, orientation="horizontal") self.le_focal_length = oasysgui.lineEdit(box_1, self, "ghy_focallength", "Focal Length Value", labelWidth=260, valueType=float, orientation="horizontal") self.cb_distance_to_image_calc = gui.comboBox(box_1, self, "distance_to_image_calc", label="Distance to image", labelWidth=150, items=["Use O.E. Image Plane Distance", "Specify Value"], callback=self.set_DistanceToImageCalc, sendSelectedValue=False, orientation="horizontal") self.le_distance_to_image = oasysgui.lineEdit(box_1, self, "ghy_distance", "Distance to image value", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(box_1) self.cb_nf = gui.comboBox(box_1, self, "ghy_nf", label="Near Field Calculation", labelWidth=310, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal", callback=self.initializeTabs) box_2 = oasysgui.widgetBox(tab_bas, "Numerical Control Parameters", addSpace=True, orientation="vertical", height=120) self.le_nbins_x = oasysgui.lineEdit(box_2, self, "ghy_nbins_x", "Number of bins for I(X) histogram", labelWidth=260, valueType=float, orientation="horizontal") self.le_nbins_z = oasysgui.lineEdit(box_2, self, "ghy_nbins_z", "Number of bins for I(Z) histogram", labelWidth=260, valueType=float, orientation="horizontal") self.le_npeak = oasysgui.lineEdit(box_2, self, "ghy_npeak", "Number of diffraction peaks", labelWidth=260, valueType=float, orientation="horizontal") self.le_fftnpts = oasysgui.lineEdit(box_2, self, "ghy_fftnpts", "Number of points for FFT", labelWidth=260, valueType=float, orientation="horizontal") self.set_DiffPlane() self.set_DistanceToImageCalc() self.set_CalculationType() adv_other_box = oasysgui.widgetBox(tab_bas, "Optional file output", addSpace=False, orientation="vertical") gui.comboBox(adv_other_box, self, "file_to_write_out", label="Files to write out", labelWidth=220, items=["None", "Debug (star.xx)"], sendSelectedValue=False, orientation="horizontal") self.shadow_output = QtGui.QTextEdit() self.shadow_output.setReadOnly(True) out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.shadow_output) self.shadow_output.setFixedHeight(600) self.shadow_output.setFixedWidth(600)
def __init__(self): super().__init__() geom = QApplication.desktop().availableGeometry() self.setGeometry(QRect(round(geom.width()*0.05), round(geom.height()*0.05), round(min(geom.width()*0.98, self.MAX_WIDTH)), round(min(geom.height()*0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) box0 = gui.widgetBox(self.controlArea, "", orientation="horizontal") #widget buttons: compute, set defaults, help gui.button(box0, self, "Compute", callback=self.compute) gui.button(box0, self, "Defaults", callback=self.defaults) gui.button(box0, self, "Help", callback=self.help1) gui.separator(self.controlArea, height=10) box = oasysgui.widgetBox(self.controlArea, self.name + " Input Parameters",orientation="vertical", width=self.CONTROL_AREA_WIDTH-5, height=150) self.xoppy_output = QTextEdit() self.xoppy_output.setReadOnly(True) self.xoppy_output.setFixedHeight(440) self.xoppy_output.setFixedWidth(self.CONTROL_AREA_WIDTH-25) out_box = gui.widgetBox(self.controlArea, "Calculation Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.xoppy_output) idx = -1 #widget index 0 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "FUNCTION", label=self.unitLabels()[idx], addSpace=False, items=['0 Fluorescence line energy', '1 Absorption edge energy', '2 Atomic weight', '3 Elemental density', '4 Total absorption cross section', '5 Photoionization cross section', '6 Partial photoionization cross section', '7 Rayleigh scattering cross section', '8 Compton scattering cross section', '9 Klein-Nishina cross section', '10 Mass energy-absorption cross section', '11 Differential unpolarized Klein-Nishina cross section', '12 Differential unpolarized Thomson cross section', '13 Differential unpolarized Rayleigh cross section', '14 Differential unpolarized Compton cross section', '15 Differential polarized Klein-Nishina cross section', '16 Differential polarized Thomson cross section', '17 Differential polarized Rayleigh cross section', '18 Differential polarized Compton cross section', '19 Atomic form factor', '20 Incoherent scattering function', '21 Momentum transfer function', '22 Coster-Kronig transition probability', '23 Fluorescence yield', '24 Jump factor', '25 Radiative transition probability', '26 Energy after Compton scattering', '27 Anomalous scattering factor φ′', '28 Anomalous scattering factor φ″', '29 Electronic configuration', '30 X-ray fluorescence production cross section (with full cascade)', '31 X-ray fluorescence production cross section (with radiative cascade)', '32 X-ray fluorescence production cross section (with non-radiative cascade)', '33 X-ray fluorescence production cross section (without cascade)', '34 Atomic level width', '35 Auger yield', '36 Auger rate', '37 Refractive index', '38 Compton broadening profile', '39 Partial Compton broadening profile', '40 List of NIST catalog compounds', '41 Get composition of NIST catalog compound', '42 List of X-ray emitting radionuclides', '43 Get excitation profile of X-ray emitting radionuclide', '44 Compoundparser'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 1 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ELEMENT", label=self.unitLabels()[idx], addSpace=False, valueType=int, validator=QIntValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 2 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ELEMENTORCOMPOUND", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 3 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "COMPOUND", label=self.unitLabels()[idx], addSpace=False, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 4 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "TRANSITION_IUPAC_OR_SIEGBAHN", label=self.unitLabels()[idx], addSpace=False, items=['IUPAC', 'SIEGBAHN', 'ALL TRANSITIONS'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 5 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "TRANSITION_IUPAC_TO", label=self.unitLabels()[idx], addSpace=False, items=['K', 'L1', 'L2', 'L3', 'M1', 'M2', 'M3', 'M4', 'M5', 'N1', 'N2', 'N3', 'N4', 'N5', 'N6', 'N7', 'O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7', 'P1', 'P2', 'P3', 'P4', 'P5', 'Q1', 'Q2', 'Q3'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 6 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "TRANSITION_IUPAC_FROM", label=self.unitLabels()[idx], addSpace=False, items=['K', 'L1', 'L2', 'L3', 'M1', 'M2', 'M3', 'M4', 'M5', 'N1', 'N2', 'N3', 'N4', 'N5', 'N6', 'N7', 'O1', 'O2', 'O3', 'O4', 'O5', 'O6', 'O7', 'P1', 'P2', 'P3', 'P4', 'P5', 'Q1', 'Q2', 'Q3'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 7 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "TRANSITION_SIEGBAHN", label=self.unitLabels()[idx], addSpace=False, items=['KA1_LINE', 'KA2_LINE', 'KB1_LINE', 'KB2_LINE', 'KB3_LINE', 'KB4_LINE', 'KB5_LINE', 'LA1_LINE', 'LA2_LINE', 'LB1_LINE', 'LB2_LINE', 'LB3_LINE', 'LB4_LINE', 'LB5_LINE', 'LB6_LINE', 'LB7_LINE', 'LB9_LINE', 'LB10_LINE', 'LB15_LINE', 'LB17_LINE', 'LG1_LINE', 'LG2_LINE', 'LG3_LINE', 'LG4_LINE', 'LG5_LINE', 'LG6_LINE', 'LG8_LINE', 'LE_LINE', 'LL_LINE', 'LS_LINE', 'LT_LINE', 'LU_LINE', 'LV_LINE'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 8 idx += 1 box1 = gui.widgetBox(box) gui.comboBox(box1, self, "SHELL", label=self.unitLabels()[idx], addSpace=False, items=['All shells', 'K_SHELL', 'L1_SHELL', 'L2_SHELL', 'L3_SHELL', 'M1_SHELL', 'M2_SHELL', 'M3_SHELL', 'M4_SHELL', 'M5_SHELL', 'N1_SHELL', 'N2_SHELL', 'N3_SHELL', 'N4_SHELL', 'N5_SHELL', 'N6_SHELL', 'N7_SHELL', 'O1_SHELL', 'O2_SHELL', 'O3_SHELL', 'O4_SHELL', 'O5_SHELL', 'O6_SHELL', 'O7_SHELL', 'P1_SHELL', 'P2_SHELL', 'P3_SHELL', 'P4_SHELL', 'P5_SHELL', 'Q1_SHELL', 'Q2_SHELL', 'Q3_SHELL'], valueType=int, orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) #widget index 9 idx += 1 box1 = gui.widgetBox(box) oasysgui.lineEdit(box1, self, "ENERGY", label=self.unitLabels()[idx], addSpace=False, valueType=float, validator=QDoubleValidator(), orientation="horizontal", labelWidth=250) self.show_at(self.unitFlags()[idx], box1) self.process_showers() gui.rubber(self.controlArea)
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): super().__init__() button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Reconstruct Wavefront", callback=self.reconstructWavefront) 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) tabs_setting = oasysgui.tabWidget(self.controlArea) tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT) tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5) tab_bas = oasysgui.createTabPage(tabs_setting, "Wavefront Viewer Setting") input_box = oasysgui.widgetBox(tab_bas, "Input Parameters", addSpace=False, orientation="vertical", width=375) oasysgui.lineEdit( input_box, self, "element_before", "Number of OEs before", labelWidth=300, valueType=int, orientation="horizontal", ) gui.separator(input_box, height=30) le_delta_angle_calculated = oasysgui.lineEdit( input_box, self, "delta_angle_calculated", "Delta Angle - Calculated (deg)", labelWidth=250, valueType=float, orientation="horizontal", ) le_delta_angle_shadow = oasysgui.lineEdit( input_box, self, "delta_angle_shadow", "Delta Angle - From Shadow (deg)", labelWidth=250, valueType=float, orientation="horizontal", ) le_delta_angle_calculated.setReadOnly(True) le_delta_angle_shadow.setReadOnly(True)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Compute", self) self.runaction.triggered.connect(self.compute) self.addAction(self.runaction) self.setFixedWidth(500) self.setFixedHeight(520) gui.separator(self.controlArea) box0 = oasysgui.widgetBox(self.controlArea, "", orientation="horizontal") # widget buttons: compute, set defaults, help button = gui.button(box0, self, "Compute", callback=self.compute) button.setFixedHeight(45) button = gui.button(box0, self, "Defaults", callback=self.defaults) button.setFixedHeight(45) tabs_setting = oasysgui.tabWidget(self.controlArea) tab_step_1 = oasysgui.createTabPage(tabs_setting, "Line Density") tab_step_2 = oasysgui.createTabPage(tabs_setting, "Angles") box = oasysgui.widgetBox(tab_step_1, "VLS-PGM Parameters", orientation="vertical") self.le_r_a = oasysgui.lineEdit( box, self, "r_a", "Distance Source-Grating", labelWidth=260, valueType=float, orientation="horizontal" ) self.le_r_b = oasysgui.lineEdit( box, self, "r_b", "Distance Grating-Exit Slits", labelWidth=260, valueType=float, orientation="horizontal" ) self.le_h = oasysgui.lineEdit( box, self, "h", "Vertical Distance Mirror-Grating", labelWidth=260, valueType=float, orientation="horizontal", ) self.le_k = oasysgui.lineEdit( box, self, "k", "Line Density (0th coeff.)", labelWidth=260, valueType=float, orientation="horizontal" ) gui.separator(box) box_2 = oasysgui.widgetBox(tab_step_1, "Grating Design Parameters", orientation="vertical") gui.comboBox( box_2, self, "units_in_use", label="Units in use", labelWidth=260, items=["eV", "Angstroms"], callback=self.set_UnitsInUse, sendSelectedValue=False, orientation="horizontal", ) self.autosetting_box_units_1 = oasysgui.widgetBox(box_2, "", addSpace=False, orientation="vertical") oasysgui.lineEdit( self.autosetting_box_units_1, self, "photon_energy", "Photon energy [eV]", labelWidth=260, valueType=float, orientation="horizontal", ) self.autosetting_box_units_2 = oasysgui.widgetBox(box_2, "", addSpace=False, orientation="vertical") oasysgui.lineEdit( self.autosetting_box_units_2, self, "photon_wavelength", "Wavelength [Å]", labelWidth=260, valueType=float, orientation="horizontal", ) self.set_UnitsInUse() oasysgui.lineEdit( box_2, self, "c", "C factor for optimized energy", labelWidth=260, valueType=float, orientation="horizontal" ) oasysgui.lineEdit( box_2, self, "grating_diffraction_order", "Diffraction Order (- for inside orders)", labelWidth=260, valueType=int, orientation="horizontal", ) ################################## box_3 = oasysgui.widgetBox(tab_step_2, "Ray-Tracing Parameter", orientation="vertical") gui.comboBox( box_3, self, "new_units_in_use", label="Units in use", labelWidth=260, items=["eV", "Angstroms"], callback=self.set_UnitsInUse2, sendSelectedValue=False, orientation="horizontal", ) self.autosetting_box_units_3 = oasysgui.widgetBox(box_3, "", addSpace=False, orientation="vertical") oasysgui.lineEdit( self.autosetting_box_units_3, self, "new_photon_energy", "New photon energy [eV]", labelWidth=260, valueType=float, orientation="horizontal", ) self.autosetting_box_units_4 = oasysgui.widgetBox(box_3, "", addSpace=False, orientation="vertical") oasysgui.lineEdit( self.autosetting_box_units_4, self, "new_photon_wavelength", "New wavelength [Å]", labelWidth=260, valueType=float, orientation="horizontal", ) self.set_UnitsInUse2() self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = oasysgui.widgetBox( self.controlArea, "System Output", addSpace=True, orientation="horizontal", height=150 ) out_box.layout().addWidget(self.shadow_output) gui.rubber(self.controlArea)
def __init__(self): super().__init__() gui.button(self.controlArea, self, "Refresh", callback=self.plot_results, height=45) gui.separator(self.controlArea, 10) self.tabs_setting = gui.tabWidget(self.controlArea) self.tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5) # graph tab tab_set = oasysgui.createTabPage(self.tabs_setting, "Plot Settings") tab_gen = oasysgui.createTabPage(self.tabs_setting, "Histogram Settings") screen_box = oasysgui.widgetBox(tab_set, "Screen Position Settings", addSpace=True, orientation="vertical", height=110) self.image_plane_combo = gui.comboBox(screen_box, self, "image_plane", label="Position of the Image", items=["On Image Plane", "Retraced"], labelWidth=260, callback=self.set_ImagePlane, sendSelectedValue=False, orientation="horizontal") self.image_plane_box = oasysgui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", height=110) self.image_plane_box_empty = oasysgui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", height=110) oasysgui.lineEdit(self.image_plane_box, self, "image_plane_new_position", "Image Plane new Position", labelWidth=220, valueType=float, orientation="horizontal") gui.comboBox(self.image_plane_box, self, "image_plane_rel_abs_position", label="Position Type", labelWidth=250, items=["Absolute", "Relative"], sendSelectedValue=False, orientation="horizontal") self.set_ImagePlane() general_box = oasysgui.widgetBox(tab_set, "Variables Settings", addSpace=True, orientation="vertical", height=350) self.x_column = gui.comboBox(general_box, self, "x_column_index", label="X Column",labelWidth=70, items=["1: X", "2: Y", "3: Z", "4: X'", "5: Y'", "6: Z'", "7: Es X", "8: Es Y", "9: Es Z", "10: Ray Flag", "11: Energy", "12: Ray Index", "13: Optical Path", "14: Phase s", "15: Phase p", "16: Ep X", "17: Ep Y", "18: Ep Z", "19: Wavelength", "20: R = sqrt(X^2 + Y^2 + Z^2)", "21: Theta (angle from Y axis)", "22: Magnitude = |Es| + |Ep|", "23: Total Intensity = |Es|^2 + |Ep|^2", "24: S Intensity = |Es|^2", "25: P Intensity = |Ep|^2", "26: |K|", "27: K X", "28: K Y", "29: K Z", "30: S0-stokes = |Ep|^2 + |Es|^2", "31: S1-stokes = |Ep|^2 - |Es|^2", "32: S2-stokes = 2|Es||Ep|cos(Phase s-Phase p)", "33: S3-stokes = 2|Es||Ep|sin(Phase s-Phase p)", ], sendSelectedValue=False, orientation="horizontal") gui.comboBox(general_box, self, "x_range", label="X Range", labelWidth=250, items=["<Default>", "Set.."], callback=self.set_XRange, sendSelectedValue=False, orientation="horizontal") self.xrange_box = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100) self.xrange_box_empty = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100) oasysgui.lineEdit(self.xrange_box, self, "x_range_min", "X min", labelWidth=220, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.xrange_box, self, "x_range_max", "X max", labelWidth=220, valueType=float, orientation="horizontal") self.set_XRange() self.y_column = gui.comboBox(general_box, self, "y_column_index", label="Y Column",labelWidth=70, items=["1: X", "2: Y", "3: Z", "4: X'", "5: Y'", "6: Z'", "7: Es X", "8: Es Y", "9: Es Z", "10: Ray Flag", "11: Energy", "12: Ray Index", "13: Optical Path", "14: Phase s", "15: Phase p", "16: Ep X", "17: Ep Y", "18: Ep Z", "19: Wavelength", "20: R = sqrt(X^2 + Y^2 + Z^2)", "21: Theta (angle from Y axis)", "22: Magnitude = |Es| + |Ep|", "23: Total Intensity = |Es|^2 + |Ep|^2", "24: S Intensity = |Es|^2", "25: P Intensity = |Ep|^2", "26: |K|", "27: K X", "28: K Y", "29: K Z", "30: S0-stokes = |Ep|^2 + |Es|^2", "31: S1-stokes = |Ep|^2 - |Es|^2", "32: S2-stokes = 2|Es||Ep|cos(Phase s-Phase p)", "33: S3-stokes = 2|Es||Ep|sin(Phase s-Phase p)", ], sendSelectedValue=False, orientation="horizontal") gui.comboBox(general_box, self, "y_range", label="Y Range",labelWidth=250, items=["<Default>", "Set.."], callback=self.set_YRange, sendSelectedValue=False, orientation="horizontal") self.yrange_box = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100) self.yrange_box_empty = oasysgui.widgetBox(general_box, "", addSpace=True, orientation="vertical", height=100) oasysgui.lineEdit(self.yrange_box, self, "y_range_min", "Y min", labelWidth=220, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.yrange_box, self, "y_range_max", "Y max", labelWidth=220, valueType=float, orientation="horizontal") self.set_YRange() self.weight_column = gui.comboBox(general_box, self, "weight_column_index", label="Weight", labelWidth=70, items=["0: No Weight", "1: X", "2: Y", "3: Z", "4: X'", "5: Y'", "6: Z'", "7: Es X", "8: Es Y", "9: Es Z", "10: Ray Flag", "11: Energy", "12: Ray Index", "13: Optical Path", "14: Phase s", "15: Phase p", "16: Ep X", "17: Ep Y", "18: Ep Z", "19: Wavelength", "20: R = sqrt(X^2 + Y^2 + Z^2)", "21: Theta (angle from Y axis)", "22: Magnitude = |Es| + |Ep|", "23: Total Intensity = |Es|^2 + |Ep|^2", "24: S Intensity = |Es|^2", "25: P Intensity = |Ep|^2", "26: |K|", "27: K X", "28: K Y", "29: K Z", "30: S0-stokes = |Ep|^2 + |Es|^2", "31: S1-stokes = |Ep|^2 - |Es|^2", "32: S2-stokes = 2|Es||Ep|cos(Phase s-Phase p)", "33: S3-stokes = 2|Es||Ep|sin(Phase s-Phase p)", ], sendSelectedValue=False, orientation="horizontal") gui.comboBox(general_box, self, "rays", label="Rays", labelWidth=250, items=["All rays", "Good Only", "Lost Only"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(general_box, self, "cartesian_axis", label="Cartesian Axis",labelWidth=300, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") incremental_box = oasysgui.widgetBox(tab_gen, "Incremental Result", addSpace=True, orientation="horizontal", height=80) gui.checkBox(incremental_box, self, "keep_result", "Keep Result") gui.button(incremental_box, self, "Clear", callback=self.clearResults) histograms_box = oasysgui.widgetBox(tab_gen, "Histograms settings", addSpace=True, orientation="vertical", height=90) oasysgui.lineEdit(histograms_box, self, "number_of_bins", "Number of Bins", labelWidth=250, valueType=int, orientation="horizontal") gui.comboBox(histograms_box, self, "is_conversion_active", label="Is U.M. conversion active", labelWidth=250, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") self.main_tabs = gui.tabWidget(self.mainArea) plot_tab = gui.createTabPage(self.main_tabs, "Plots") out_tab = gui.createTabPage(self.main_tabs, "Output") self.image_box = gui.widgetBox(plot_tab, "Plot Result", addSpace=True, orientation="vertical") self.image_box.setFixedHeight(self.IMAGE_HEIGHT) self.image_box.setFixedWidth(self.IMAGE_WIDTH) self.shadow_output = QtGui.QTextEdit() self.shadow_output.setReadOnly(True) out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.shadow_output) self.shadow_output.setFixedHeight(600) self.shadow_output.setFixedWidth(600)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Calculate Height Profile", self) self.runaction.triggered.connect(self.calculate_heigth_profile_ni) self.addAction(self.runaction) self.runaction = widget.OWAction("Generate Height Profile File", self) self.runaction.triggered.connect(self.generate_heigth_profile_file_ni) self.addAction(self.runaction) geom = QApplication.desktop().availableGeometry() self.setGeometry(QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Calculate Height\nProfile", callback=self.calculate_heigth_profile) button.setFixedHeight(45) button = gui.button(button_box, self, "Generate Height\nProfile File", callback=self.generate_heigth_profile_file) 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.setFixedWidth(150) button = gui.button(button_box, self, "Reset Fields", callback=self.call_reset_settings) 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) gui.separator(self.controlArea) tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT) tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH-5) tab_input = oasysgui.createTabPage(tabs_setting, "Input Parameters") tab_out = oasysgui.createTabPage(tabs_setting, "Output") tabs_input = gui.tabWidget(tab_input) tab_length = oasysgui.createTabPage(tabs_input, "Length") tab_width = oasysgui.createTabPage(tabs_input, "Width") #/ --------------------------------------- input_box_l = oasysgui.widgetBox(tab_length, "Calculation Parameters", addSpace=True, orientation="vertical") gui.comboBox(input_box_l, self, "kind_of_profile_y", label="Kind of Profile", labelWidth=260, items=["Fractal", "Gaussian", "User File"], callback=self.set_KindOfProfileY, sendSelectedValue=False, orientation="horizontal") gui.separator(input_box_l) self.kind_of_profile_y_box_1 = oasysgui.widgetBox(input_box_l, "", addSpace=True, orientation="vertical", height=350) self.le_dimension_y = oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "dimension_y", "Dimensions", labelWidth=260, valueType=float, orientation="horizontal") self.le_step_y = oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "step_y", "Step", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "montecarlo_seed_y", "Monte Carlo initial seed", labelWidth=260, valueType=int, orientation="horizontal") self.kind_of_profile_y_box_1_1 = oasysgui.widgetBox(self.kind_of_profile_y_box_1, "", addSpace=True, orientation="vertical") oasysgui.lineEdit(self.kind_of_profile_y_box_1_1, self, "power_law_exponent_beta_y", "Beta Value", labelWidth=260, valueType=float, orientation="horizontal") self.kind_of_profile_y_box_1_2 = oasysgui.widgetBox(self.kind_of_profile_y_box_1, "", addSpace=True, orientation="vertical") self.le_correlation_length_y = oasysgui.lineEdit(self.kind_of_profile_y_box_1_2, self, "correlation_length_y", "Correlation Length", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.kind_of_profile_y_box_1) gui.comboBox(self.kind_of_profile_y_box_1, self, "error_type_y", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + "\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "rms_y", "Rms Value", labelWidth=260, valueType=float, orientation="horizontal") self.kind_of_profile_y_box_2 = oasysgui.widgetBox(input_box_l, "", addSpace=True, orientation="vertical", height=350) select_file_box_2 = oasysgui.widgetBox(self.kind_of_profile_y_box_2, "", addSpace=True, orientation="horizontal") self.le_heigth_profile_1D_file_name_y = oasysgui.lineEdit(select_file_box_2, self, "heigth_profile_1D_file_name_y", "1D Profile File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(select_file_box_2, self, "...", callback=self.selectFile1D_Y) gui.comboBox(self.kind_of_profile_y_box_2, self, "delimiter_y", label="Fields delimiter", labelWidth=260, items=["Spaces", "Tabs"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_2, self, "conversion_factor_y_x", "Conversion from file\nto workspace units(Abscissa)", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_2, self, "conversion_factor_y_y", "Conversion from file\nto workspace units (Height Profile Values)", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.kind_of_profile_y_box_2) gui.comboBox(self.kind_of_profile_y_box_2, self, "center_y", label="Center Profile in the middle of O.E.", labelWidth=300, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(self.kind_of_profile_y_box_2, self, "modify_y", label="Modify Length?", labelWidth=240, items=["No", "Rescale to new length", "Fit to new length (fill or cut)"], callback=self.set_ModifyY, sendSelectedValue=False, orientation="horizontal") self.modify_box_2_1 = oasysgui.widgetBox(self.kind_of_profile_y_box_2, "", addSpace=False, orientation="vertical", height=70) self.modify_box_2_2 = oasysgui.widgetBox(self.kind_of_profile_y_box_2, "", addSpace=False, orientation="vertical", height=70) oasysgui.lineEdit(self.modify_box_2_2, self, "scale_factor_y", "Scale Factor", labelWidth=300, valueType=float, orientation="horizontal") self.modify_box_2_3 = oasysgui.widgetBox(self.kind_of_profile_y_box_2, "", addSpace=False, orientation="vertical", height=70) self.le_new_length = oasysgui.lineEdit(self.modify_box_2_3, self, "new_length", "New Length", labelWidth=300, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.modify_box_2_3, self, "filler_value", "Filler Value (if new length > profile length) [nm]", labelWidth=300, valueType=float, orientation="horizontal") self.set_ModifyY() gui.comboBox(self.kind_of_profile_y_box_2, self, "renormalize_y", label="Renormalize to different RMS", labelWidth=260, items=["No", "Yes"], callback=self.set_KindOfProfileY, sendSelectedValue=False, orientation="horizontal") self.kind_of_profile_y_box_2_1 = oasysgui.widgetBox(self.kind_of_profile_y_box_2, "", addSpace=True, orientation="vertical") gui.comboBox(self.kind_of_profile_y_box_2_1, self, "error_type_y", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + "\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_2_1, self, "rms_y", "Rms Value", labelWidth=260, valueType=float, orientation="horizontal") self.set_KindOfProfileY() #/ --------------------------------------- input_box_w = oasysgui.widgetBox(tab_width, "Calculation Parameters", addSpace=True, orientation="vertical") gui.comboBox(input_box_w, self, "kind_of_profile_x", label="Kind of Profile", labelWidth=260, items=["Fractal", "Gaussian", "User File"], callback=self.set_KindOfProfileX, sendSelectedValue=False, orientation="horizontal") gui.separator(input_box_w) self.kind_of_profile_x_box_1 = oasysgui.widgetBox(input_box_w, "", addSpace=True, orientation="vertical", height=300) self.le_dimension_x = oasysgui.lineEdit(self.kind_of_profile_x_box_1, self, "dimension_x", "Dimensions", labelWidth=260, valueType=float, orientation="horizontal") self.le_step_x = oasysgui.lineEdit(self.kind_of_profile_x_box_1, self, "step_x", "Step", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_x_box_1, self, "montecarlo_seed_x", "Monte Carlo initial seed", labelWidth=260, valueType=int, orientation="horizontal") self.kind_of_profile_x_box_1_1 = oasysgui.widgetBox(self.kind_of_profile_x_box_1, "", addSpace=True, orientation="vertical") oasysgui.lineEdit(self.kind_of_profile_x_box_1_1, self, "power_law_exponent_beta_x", "Beta Value", labelWidth=260, valueType=float, orientation="horizontal") self.kind_of_profile_x_box_1_2 = oasysgui.widgetBox(self.kind_of_profile_x_box_1, "", addSpace=True, orientation="vertical") self.le_correlation_length_x = oasysgui.lineEdit(self.kind_of_profile_x_box_1_2, self, "correlation_length_x", "Correlation Length", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.kind_of_profile_x_box_1) gui.comboBox(self.kind_of_profile_x_box_1, self, "error_type_x", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + "\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_x_box_1, self, "rms_x", "Rms Value", labelWidth=260, valueType=float, orientation="horizontal") ##---------------------------------- self.kind_of_profile_x_box_2 = oasysgui.widgetBox(input_box_w, "", addSpace=True, orientation="vertical", height=300) select_file_box_1 = oasysgui.widgetBox(self.kind_of_profile_x_box_2, "", addSpace=True, orientation="horizontal") self.le_heigth_profile_1D_file_name_x = oasysgui.lineEdit(select_file_box_1, self, "heigth_profile_1D_file_name_x", "1D Profile File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(select_file_box_1, self, "...", callback=self.selectFile1D_X) gui.comboBox(self.kind_of_profile_x_box_2 , self, "delimiter_x", label="Fields delimiter", labelWidth=260, items=["Spaces", "Tabs"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_x_box_2, self, "conversion_factor_x_x", "Conversion from file\nto workspace units(Abscissa)", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_x_box_2, self, "conversion_factor_x_y", "Conversion from file\nto workspace units (Height Profile Values)", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.kind_of_profile_x_box_2) gui.comboBox(self.kind_of_profile_x_box_2, self, "center_x", label="Center Profile in the middle of O.E.", labelWidth=300, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(self.kind_of_profile_x_box_2, self, "modify_x", label="Modify Length?", labelWidth=240, items=["No", "Rescale to new length", "Fit to new length (fill or cut)"], callback=self.set_ModifyX, sendSelectedValue=False, orientation="horizontal") self.modify_box_1_1 = oasysgui.widgetBox(self.kind_of_profile_x_box_2, "", addSpace=False, orientation="vertical", height=70) self.modify_box_1_2 = oasysgui.widgetBox(self.kind_of_profile_x_box_2, "", addSpace=False, orientation="vertical", height=70) oasysgui.lineEdit(self.modify_box_1_2, self, "scale_factor_x", "Scale Factor", labelWidth=300, valueType=float, orientation="horizontal") self.modify_box_1_3 = oasysgui.widgetBox(self.kind_of_profile_x_box_2, "", addSpace=False, orientation="vertical", height=70) self.le_new_length = oasysgui.lineEdit(self.modify_box_1_3, self, "new_length", "New Length", labelWidth=300, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.modify_box_1_3, self, "filler_value", "Filler Value (if new length > profile length) [nm]", labelWidth=300, valueType=float, orientation="horizontal") self.set_ModifyX() gui.comboBox(self.kind_of_profile_x_box_2, self, "renormalize_x", label="Renormalize to different RMS", labelWidth=260, items=["No", "Yes"], callback=self.set_KindOfProfileX, sendSelectedValue=False, orientation="horizontal") self.kind_of_profile_x_box_2_1 = oasysgui.widgetBox(self.kind_of_profile_x_box_2, "", addSpace=True, orientation="vertical") gui.comboBox(self.kind_of_profile_x_box_2_1, self, "error_type_x", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + "\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_x_box_2_1, self, "rms_x", "Rms Value", labelWidth=260, valueType=float, orientation="horizontal") self.set_KindOfProfileX() #/ --------------------------------------- self.output_box = oasysgui.widgetBox(tab_input, "Outputs", addSpace=True, orientation="vertical") self.select_file_box = oasysgui.widgetBox(self.output_box, "", addSpace=True, orientation="horizontal") self.le_heigth_profile_file_name = oasysgui.lineEdit(self.select_file_box, self, "heigth_profile_file_name", "Output File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(self.select_file_box, self, "...", callback=self.selectFile) self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = oasysgui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=580) out_box.layout().addWidget(self.shadow_output) gui.rubber(self.controlArea) self.figure = Figure(figsize=(600, 600)) self.figure.patch.set_facecolor('white') self.axis = self.figure.add_subplot(111, projection='3d') self.axis.set_zlabel("Z [nm]") self.figure_canvas = FigureCanvasQTAgg(self.figure) self.mainArea.layout().addWidget(self.figure_canvas) gui.rubber(self.mainArea)
def __init__(self): super().__init__() left_box_1 = oasysgui.widgetBox(self.controlArea, "X0h-Search Request Form", addSpace=True, orientation="vertical", width=400, height=630) left_box_2 = oasysgui.widgetBox(left_box_1, "X-rays", addSpace=True, orientation="horizontal", width=380, height=110) left_box_2_1 = oasysgui.widgetBox(left_box_2, "", addSpace=True, orientation="vertical", width=150, height=110) gui.radioButtons(left_box_2_1, self, "xway", ["Wavelength (Å)", "Energy (keV)", "Characteristic line"], callback=self.set_xway ) self.box_wave = oasysgui.widgetBox(left_box_2, "", addSpace=True, orientation="vertical", width=190) gui.separator(self.box_wave, height=10) oasysgui.lineEdit(self.box_wave, self, "wave", label="", labelWidth=0, addSpace=False, valueType=float, orientation="horizontal") self.box_line = oasysgui.widgetBox(left_box_2, "", addSpace=True, orientation="horizontal", width=190, height=110) gui.separator(self.box_line, height=120) 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() left_box_3 = oasysgui.widgetBox(left_box_1, "Crystal", addSpace=True, orientation="horizontal", width=380, height=60) self.box_crystal = oasysgui.widgetBox(left_box_3, "", addSpace=True, orientation="horizontal", width=210) XRayServerGui.combobox_text(self.box_crystal, self, "code", label="", labelWidth=0, items=self.get_crystals(), sendSelectedValue=True, orientation="horizontal", selectedValue=self.code) button = gui.button( self.box_crystal, self, "?", callback=self.help_crystals) button.setFixedWidth(15) left_box_4 = oasysgui.widgetBox(left_box_1, "Bragg Planes Range", addSpace=True, orientation="horizontal", width=380, height=60) oasysgui.lineEdit(left_box_4, self, "hkl11", label="From", labelWidth=50, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4, self, "hkl12", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4, self, "hkl13", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4, self, "hkl21", label=" To", labelWidth=50, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4, self, "hkl22", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_4, self, "hkl23", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") left_box_7 = oasysgui.widgetBox(left_box_1, "Bragg Angle Range", addSpace=True, orientation="horizontal", width=380, height=60) oasysgui.lineEdit(left_box_7, self, "qb1", label="From", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_7, self, "qb2", label=" To", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") tab_central = oasysgui.tabWidget(left_box_1) tab_1 = oasysgui.createTabPage(tab_central, "Intensity Control") tab_2 = oasysgui.createTabPage(tab_central, "Find only Bragg planes making certain angles to the surface") left_box_5 = oasysgui.widgetBox(tab_1, "", addSpace=True, orientation="vertical", width=370, height=250) gui.separator(left_box_5) oasysgui.lineEdit(left_box_5, self, "prcmin", label="Minimum |xh/x0| (%)", labelWidth=250, addSpace=False, valueType=float, orientation="horizontal") left_box_5_1 = oasysgui.widgetBox(left_box_5, "Database Options for dispersion corrections df1, df2", addSpace=True, orientation="vertical", width=370, height=185) gui.radioButtons(left_box_5_1, self, "df1df2", ["Auto (Henke at low energy, X0h at mid, Brennan-Cowan\nat high)", "Use X0h data (5-25 keV or 0.5-2.5 A), recommended for\nBragg diffraction", "Use Henke data (0.01-30 keV or 0.4-1200 A),\nrecommended for soft x-rays", "Use Brennan-Cowan data (0.03-700 keV or 0.02-400 A)"]) left_box_6 = oasysgui.widgetBox(tab_2, "", addSpace=True, orientation="vertical", width=370, height=255) gui.separator(left_box_6) left_box_6_1 = oasysgui.widgetBox(left_box_6, "", addSpace=False, orientation="horizontal", width=370, height=30) oasysgui.lineEdit(left_box_6_1, self, "base1", label="Surface Plane Indices", labelWidth=200, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_6_1, self, "base2", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_6_1, self, "base3", label=" ", labelWidth=1, addSpace=False, valueType=int, orientation="horizontal") gui.radioButtons(left_box_6, self, "modesearch", ["Planes make angles from Theta1 to Theta2", "Planes make angles from Theta1 to (Bragg_Angle - Theta2)", "Planes make angles from (Bragg_Angle - Theta1)\nto (Bragg_Angle - Theta2)"]) gui.separator(left_box_6, height=10) left_box_6_2 = oasysgui.widgetBox(left_box_6, "", addSpace=True, orientation="horizontal", width=370, height=30) oasysgui.lineEdit(left_box_6_2, self, "q1", label="Theta1", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_6_2, self, "q2", label=" Theta2", labelWidth=80, addSpace=False, valueType=float, orientation="horizontal") button = gui.button(self.controlArea, self, "Find Planes!", callback=self.submit) button.setFixedHeight(30) gui.rubber(self.controlArea) self.tabs_widget = oasysgui.tabWidget(self.mainArea) self.tab_output = oasysgui.createTabPage(self.tabs_widget, "X-ray Server Ouput") self.x0h_output = QWebView(self.tab_output) self.tab_output.layout().addWidget(self.x0h_output) self.x0h_output.setFixedHeight(640) self.x0h_output.setFixedWidth(740)
def __init__(self): self.setFixedWidth(590) self.setFixedHeight(550) left_box_1 = oasysgui.widgetBox(self.controlArea, "CCD Image", addSpace=True, orientation="vertical") gui.comboBox(left_box_1, self, "is_textual", label="Image Type", labelWidth=250, items=["JPEG/PNG", "Textual"], sendSelectedValue=False, orientation="horizontal", callback=self.setTextual) ######################################## self.select_file_box_1 = oasysgui.widgetBox(left_box_1, "Textual Image Parameters", addSpace=True, orientation="horizontal", height=250) self.le_image_txt_file_name = oasysgui.lineEdit(self.select_file_box_1, self, "image_file_name", "Image File Name", labelWidth=120, valueType=str, orientation="horizontal") self.le_image_txt_file_name.setFixedWidth(300) gui.button(self.select_file_box_1, self, "...", callback=self.selectTxtFile) self.select_file_box_2 = oasysgui.widgetBox(left_box_1, "Image Parameters", addSpace=True, orientation="vertical", height=250) select_file_box_2_int = oasysgui.widgetBox(self.select_file_box_2, "", addSpace=True, orientation="horizontal") self.le_image_file_name = oasysgui.lineEdit(select_file_box_2_int, self, "image_file_name", "Image File Name", labelWidth=120, valueType=str, orientation="horizontal") self.le_image_file_name.setFixedWidth(300) gui.button(select_file_box_2_int, self, "...", callback=self.selectFile) figure_box = oasysgui.widgetBox(self.select_file_box_2, "Preview", addSpace=True, orientation="vertical", width=350, height=180) self.preview_box = QtGui.QLabel("") self.preview_box.setFixedHeight(100) figure_box.layout().addWidget(self.preview_box) le = oasysgui.lineEdit(figure_box, self, "number_of_x_pixels", "Number of x Pixels", labelWidth=200, valueType=int, orientation="horizontal") le.setReadOnly(True) font = QtGui.QFont(le.font()) font.setBold(True) le.setFont(font) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) le.setPalette(palette) le = oasysgui.lineEdit(figure_box, self, "number_of_z_pixels", "Number of z Pixels", labelWidth=200, valueType=int, orientation="horizontal") le.setReadOnly(True) font = QtGui.QFont(le.font()) font.setBold(True) le.setFont(font) palette = QtGui.QPalette(le.palette()) # make a copy of the palette palette.setColor(QtGui.QPalette.Text, QtGui.QColor('dark blue')) palette.setColor(QtGui.QPalette.Base, QtGui.QColor(243, 240, 160)) le.setPalette(palette) ######################################## self.setTextual() self.loadImage() oasysgui.lineEdit(left_box_1, self, "pixel_size", "Pixel Size [um]", labelWidth=200, valueType=float, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "number_of_x_bins", "Number of Bin per Pixel [x]", labelWidth=200, valueType=int, orientation="horizontal") oasysgui.lineEdit(left_box_1, self, "number_of_z_bins", "Number of Bin per Pixel [z]", labelWidth=200, valueType=int, orientation="horizontal") gui.checkBox(left_box_1, self, "flip_vertically", "Flip Vertically") gui.checkBox(left_box_1, self, "flip_horizontally", "Flip Horizontally") gui.separator(self.controlArea) button = gui.button(self.controlArea, self, "Convert To Beam", callback=self.convertToBeam) button.setFixedHeight(45) gui.rubber(self.controlArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Calculate Height Profile", self) self.runaction.triggered.connect(self.calculate_heigth_profile) self.addAction(self.runaction) self.runaction = widget.OWAction("Generate Height Profile File", self) self.runaction.triggered.connect(self.generate_heigth_profile_file) self.addAction(self.runaction) geom = QApplication.desktop().availableGeometry() self.setGeometry( QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) gui.separator(self.controlArea) button_box = oasysgui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Calculate Height\nProfile", callback=self.calculate_heigth_profile) button.setFixedHeight(45) button = gui.button(button_box, self, "Generate Height\nProfile File", callback=self.generate_heigth_profile_file) 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.setFixedWidth(150) button = gui.button(button_box, self, "Reset Fields", callback=self.call_reset_settings) 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) gui.separator(self.controlArea) tabs_setting = oasysgui.tabWidget(self.controlArea) tabs_setting.setFixedHeight(self.TABS_AREA_HEIGHT) tabs_setting.setFixedWidth(self.CONTROL_AREA_WIDTH - 5) tab_input = oasysgui.createTabPage(tabs_setting, "Input Parameters") tab_out = oasysgui.createTabPage(tabs_setting, "Output") #/ --------------------------------------- input_box_l = oasysgui.widgetBox(tab_input, "Calculation Parameters", addSpace=True, orientation="vertical") gui.comboBox(input_box_l, self, "kind_of_profile_y", label="Kind of Profile", labelWidth=260, items=["Fractal", "Gaussian"], callback=self.set_KindOfProfileY, sendSelectedValue=False, orientation="horizontal") gui.separator(input_box_l) self.kind_of_profile_y_box_1 = oasysgui.widgetBox( input_box_l, "", addSpace=False, orientation="vertical", height=230) self.le_dimension_y = oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "dimension_y", "Dimensions", labelWidth=260, valueType=float, orientation="horizontal") self.le_step_y = oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "step_y", "Step", labelWidth=260, valueType=float, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "montecarlo_seed_y", "Monte Carlo initial seed", labelWidth=260, valueType=int, orientation="horizontal") self.kind_of_profile_y_box_1_1 = oasysgui.widgetBox( self.kind_of_profile_y_box_1, "", addSpace=False, orientation="vertical") oasysgui.lineEdit(self.kind_of_profile_y_box_1_1, self, "power_law_exponent_beta_y", "Beta Value", labelWidth=260, valueType=float, orientation="horizontal") self.kind_of_profile_y_box_1_2 = oasysgui.widgetBox( self.kind_of_profile_y_box_1, "", addSpace=False, orientation="vertical") self.le_correlation_length_y = oasysgui.lineEdit( self.kind_of_profile_y_box_1_2, self, "correlation_length_y", "Correlation Length", labelWidth=260, valueType=float, orientation="horizontal") gui.separator(self.kind_of_profile_y_box_1) gui.comboBox( self.kind_of_profile_y_box_1, self, "error_type_y", label="Normalization to", labelWidth=270, items=["Figure Error (nm)", "Slope Error (" + "\u03BC" + "rad)"], sendSelectedValue=False, orientation="horizontal") oasysgui.lineEdit(self.kind_of_profile_y_box_1, self, "rms_y", "Rms Value", labelWidth=260, valueType=float, orientation="horizontal") self.set_KindOfProfileY() self.output_box = oasysgui.widgetBox(tab_input, "Outputs", addSpace=True, orientation="vertical") self.select_file_box = oasysgui.widgetBox(self.output_box, "", addSpace=False, orientation="horizontal") self.le_heigth_profile_file_name = oasysgui.lineEdit( self.select_file_box, self, "heigth_profile_file_name", "Output File Name", labelWidth=120, valueType=str, orientation="horizontal") gui.button(self.select_file_box, self, "...", callback=self.selectFile) self.wise_output = QTextEdit() self.wise_output.setReadOnly(True) self.wise_output.setStyleSheet("background-color: white;") out_box = oasysgui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=580) out_box.layout().addWidget(self.wise_output) gui.rubber(self.controlArea) main_tabs = oasysgui.tabWidget(self.mainArea) self.plot_tab = oasysgui.createTabPage(main_tabs, "Results") self.plot_tab.setFixedHeight(self.IMAGE_HEIGHT) self.plot_tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = None gui.rubber(self.mainArea)
def __init__(self): super().__init__() self.runaction = widget.OWAction("Compute", self) self.runaction.triggered.connect(self.compute) self.addAction(self.runaction) self.setFixedWidth(500) self.setFixedHeight(520) idx = -1 gui.separator(self.controlArea) box0 = oasysgui.widgetBox(self.controlArea, "",orientation="horizontal") #widget buttons: compute, set defaults, help button = gui.button(box0, self, "Compute", callback=self.compute) button.setFixedHeight(45) button = gui.button(box0, self, "Defaults", callback=self.defaults) button.setFixedHeight(45) button = gui.button(box0, self, "Help", callback=self.help1) button.setFixedHeight(45) gui.separator(self.controlArea) #widget index 0 idx += 1 box = oasysgui.widgetBox(self.controlArea, "Crystal Parameters", orientation="vertical") gui.comboBox(box, self, "DESCRIPTOR", label=self.unitLabels()[idx], addSpace=True, items=self.crystals, sendSelectedValue=False, valueType=int, orientation="horizontal", labelWidth=350) self.show_at(self.unitFlags()[idx], box) #widget index 1 idx += 1 box_miller = oasysgui.widgetBox(box, "", orientation = "horizontal") oasysgui.lineEdit(box_miller, self, "H_MILLER_INDEX", label="Miller Indices [h k l]", addSpace=True, valueType=int, validator=QIntValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box_miller) #widget index 2 idx += 1 oasysgui.lineEdit(box_miller, self, "K_MILLER_INDEX", addSpace=True, valueType=int, validator=QIntValidator()) self.show_at(self.unitFlags()[idx], box) #widget index 3 idx += 1 oasysgui.lineEdit(box_miller, self, "L_MILLER_INDEX", addSpace=True, valueType=int, validator=QIntValidator(), orientation="horizontal") self.show_at(self.unitFlags()[idx], box) gui.separator(box) #widget index 4 idx += 1 oasysgui.lineEdit(box, self, "TEMPERATURE_FACTOR", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 5 idx += 1 oasysgui.lineEdit(box, self, "E_MIN", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 6 idx += 1 oasysgui.lineEdit(box, self, "E_MAX", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 7 idx += 1 oasysgui.lineEdit(box, self, "E_STEP", label=self.unitLabels()[idx], addSpace=True, valueType=float, validator=QDoubleValidator(), labelWidth=350, orientation="horizontal") self.show_at(self.unitFlags()[idx], box) #widget index 8 idx += 1 box_2 = oasysgui.widgetBox(box, "", addSpace=True, orientation="horizontal") self.le_SHADOW_FILE = oasysgui.lineEdit(box_2, self, "SHADOW_FILE", label=self.unitLabels()[idx], addSpace=True, labelWidth=180, orientation="horizontal") gui.button(box_2, self, "...", callback=self.selectFile) self.show_at(self.unitFlags()[idx], box) self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = oasysgui.widgetBox(self.controlArea, "System Output", addSpace=True, orientation="horizontal", height=150) out_box.layout().addWidget(self.shadow_output) self.process_showers() gui.rubber(self.controlArea)