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__(self): super().__init__() # self.resetSettings() ################################# # FIX A WEIRD BEHAVIOUR AFTER DISPLAY # THE WIDGET: PROBABLY ON SIGNAL MANAGER self.dumpSettings() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedWidth(495) tabs_setting.setFixedHeight(750) tab_bas = ShadowGui.createTabPage(tabs_setting, "Basic Setting") tab_adv = ShadowGui.createTabPage(tabs_setting, "Advanced Setting") tabs_button_box = ShadowGui.widgetBox(tab_bas, "", addSpace=False, orientation="horizontal") gui.separator(tabs_button_box) gui.button(tabs_button_box, self, "Insert C.R.L. Before", callback=self.crl_insert_before) gui.button(tabs_button_box, self, "Insert C.R.L. After", callback=self.crl_insert_after) gui.button(tabs_button_box, self, "Remove C.R.L.", callback=self.crl_remove) gui.separator(tabs_button_box) self.tab_crls = gui.tabWidget(tab_bas) self.crl_box_array = [] for index in range(len(self.p)): tab_crl = ShadowGui.createTabPage(self.tab_crls, "C.R.L. " + str(index + 1)) crl_box = CRLBox(transfocator=self, parent=tab_crl, nlenses=self.nlenses[index], slots_empty=self.slots_empty[index], thickness=self.thickness[index], p=self.p[index], q=self.q[index], surface_shape=self.surface_shape[index], convex_to_the_beam=self.convex_to_the_beam[index], has_finite_diameter=self.has_finite_diameter[index], diameter=self.diameter[index], is_cylinder=self.is_cylinder[index], cylinder_angle=self.cylinder_angle[index], ri_calculation_mode=self.ri_calculation_mode[index], prerefl_file=self.prerefl_file[index], refraction_index=self.refraction_index[index], attenuation_coefficient=self.attenuation_coefficient[index], radius=self.radius[index], interthickness=self.interthickness[index], use_ccc=self.use_ccc[index]) self.crl_box_array.append(crl_box) adv_other_box = ShadowGui.widgetBox(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=310, items=["All", "Mirror", "Image", "None"], sendSelectedValue=False, orientation="horizontal") 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__(self): super().__init__() tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedWidth(450) gui.button(self.controlArea, self, "Refresh", callback=self.plot_results) # graph tab tab_gen = ShadowGui.createTabPage(tabs_setting, "General") # FOR FUTURE DEVELOPMENTS #tab_his = ShadowGui.createTabPage(tabs_setting, "Histograms") #tab_col = ShadowGui.createTabPage(tabs_setting, "Color") incremental_box = ShadowGui.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) screen_box = ShadowGui.widgetBox(tab_gen, "Screen Position Settings", addSpace=True, orientation="vertical", height=140) self.image_plane_combo = gui.comboBox(screen_box, self, "image_plane", label="Position of the Image", items=["On Image Plane", "Retraced"], callback=self.set_ImagePlane, sendSelectedValue=False, orientation="horizontal") self.image_plane_box = ShadowGui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", width=350, height=110) self.image_plane_box_empty = ShadowGui.widgetBox(screen_box, "", addSpace=True, orientation="vertical", width=350, height=110) ShadowGui.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 = ShadowGui.widgetBox(tab_gen, "General Settings", addSpace=True, orientation="vertical", height=350) self.x_column = gui.comboBox(general_box, self, "x_column_index", label="X Column",labelWidth=80, 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 = |Es|^2 + |Ep|^2", "31: S1-stokes = |Es|^2 - |Ep|^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 = ShadowGui.widgetBox(general_box, "", addSpace=True, orientation="vertical", width=420, height=100) self.xrange_box_empty = ShadowGui.widgetBox(general_box, "", addSpace=True, orientation="vertical", width=420, height=100) ShadowGui.lineEdit(self.xrange_box, self, "x_range_min", "X min", labelWidth=220, valueType=float, orientation="horizontal") ShadowGui.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=80, 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 = |Es|^2 + |Ep|^2", "31: S1-stokes = |Es|^2 - |Ep|^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 = ShadowGui.widgetBox(general_box, "", addSpace=True, orientation="vertical", width=420, height=100) self.yrange_box_empty = ShadowGui.widgetBox(general_box, "", addSpace=True, orientation="vertical", width=420, height=100) ShadowGui.lineEdit(self.yrange_box, self, "y_range_min", "Y min", labelWidth=220, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.yrange_box, self, "y_range_max", "Y max", labelWidth=220, valueType=float, orientation="horizontal") self.set_YRange() 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") histograms_box = ShadowGui.widgetBox(tab_gen, "Histograms settings", addSpace=True, orientation="vertical", height=70) ShadowGui.lineEdit(histograms_box, self, "number_of_bins", "Number of Bins", labelWidth=250, valueType=int, orientation="horizontal") self.image_box = gui.widgetBox(self.mainArea, "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() out_box = gui.widgetBox(self.mainArea, "Shadow Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.shadow_output) out_box.setFixedWidth(self.IMAGE_WIDTH) self.shadow_output.setFixedHeight(100) self.shadow_output.setFixedWidth(self.IMAGE_WIDTH-50)
def __init__(self): super().__init__() # self.resetSettings() ################################# # FIX A WEIRD BEHAVIOUR AFTER DISPLAY # THE WIDGET: PROBABLY ON SIGNAL MANAGER self.dumpSettings() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedWidth(495) tabs_setting.setFixedHeight(750) tab_bas = ShadowGui.createTabPage(tabs_setting, "Basic Setting") tab_adv = ShadowGui.createTabPage(tabs_setting, "Advanced Setting") ShadowGui.lineEdit(tab_bas, self, "p", "Distance Source - DCM center (P) [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "q", "Distance DCM center - Image plane (Q) [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "separation", "Separation between the Crystals [cm]\n(from center of 1st C. to center of 2nd C.) ", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "photon_energy_ev", "Photon Eneergy [eV]", labelWidth=350, valueType=float, orientation="horizontal") self.le_reflectivity_file = ShadowGui.lineEdit(tab_bas, self, "reflectivity_file", "Reflectivity File", labelWidth=150, valueType=str, orientation="horizontal") gui.separator(tab_bas, height=10) self.tab_crystals = gui.tabWidget(tab_bas) tab_first_crystal = ShadowGui.createTabPage(self.tab_crystals, "First Crystal") tab_second_crystal = ShadowGui.createTabPage(self.tab_crystals, "Second Crystal") self.crystal_1_box = CrystalBox(dcm=self, parent=tab_first_crystal, has_finite_dimensions=self.has_finite_dimensions[0], dimensions=self.dimensions[0]) self.crystal_2_box = CrystalBox(dcm=self, parent=tab_second_crystal, has_finite_dimensions=self.has_finite_dimensions[1], dimensions=self.dimensions[1]) adv_other_box = ShadowGui.widgetBox(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=310, items=["All", "Mirror", "Image", "None"], sendSelectedValue=False, orientation="horizontal") 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__(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.WIDGET_WIDTH)), round(min(geom.height() * 0.95, self.WIDGET_HEIGHT)))) gen_box = ShadowGui.widgetBox(self.controlArea, "Waviness Parameters", addSpace=True, orientation="horizontal", width=500) tabs_setting = gui.tabWidget(gen_box) tab_input = ShadowGui.createTabPage(tabs_setting, "Input Parameter") tab_harmonics = ShadowGui.createTabPage(tabs_setting, "Harmonics") tab_out = ShadowGui.createTabPage(tabs_setting, "Output") self.input_box = ShadowGui.widgetBox(tab_input, "Inputs", addSpace=True, orientation="vertical", width=470) gui.button(self.input_box, self, "Load xsh_waviness input file ...", callback=self.load_inp_file) gui.separator(self.input_box) ShadowGui.lineEdit(self.input_box, self, "number_of_points_x", "Number of Points (<201) X (width)", labelWidth=300, valueType=int, orientation="horizontal") ShadowGui.lineEdit(self.input_box, self, "number_of_points_y", " Y (length)", labelWidth=300, valueType=int, orientation="horizontal") gui.separator(self.input_box) ShadowGui.lineEdit(self.input_box, self, "dimension_x", "Dimensions [cm] X (width)", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.input_box, self, "dimension_y", " Y (length)", labelWidth=300, valueType=float, orientation="horizontal") gui.separator(self.input_box) ShadowGui.lineEdit(self.input_box, self, "estimated_slope_error", "Estimated slope error [arcsec]", labelWidth=300, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.input_box, self, "montecarlo_seed", "Monte Carlo initial seed", labelWidth=300, valueType=int, orientation="horizontal") self.output_box = ShadowGui.widgetBox(tab_input, "Outputs", addSpace=True, orientation="vertical", width=470) self.select_file_box = ShadowGui.widgetBox(self.output_box, "", addSpace=True, orientation="horizontal") gui.separator(self.output_box) gui.button(self.output_box, self, "Write xsh_waviness input file (optional) ...", callback=self.write_inp_file) ShadowGui.lineEdit(self.select_file_box, self, "waviness_file_name", "Output File Name", labelWidth=120, valueType=str, orientation="horizontal") self.harmonics_box = ShadowGui.widgetBox(tab_harmonics, "Harmonics", addSpace=True, orientation="vertical", width=470, height=690) ShadowGui.lineEdit(self.harmonics_box, self, "harmonic_maximum_index", "Harmonic Maximum Index", labelWidth=300, valueType=int, orientation="horizontal", callback=self.set_harmonics) gui.separator(self.harmonics_box) self.scrollarea = QScrollArea() self.scrollarea.setMaximumWidth(400) self.harmonics_box.layout().addWidget(self.scrollarea, alignment=Qt.AlignHCenter) self.shadow_output = QTextEdit() self.shadow_output.setReadOnly(True) out_box = ShadowGui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=600) out_box.layout().addWidget(self.shadow_output) button_box = ShadowGui.widgetBox(self.controlArea, "", addSpace=False, orientation="horizontal") button = gui.button(button_box, self, "Calculate Waviness", callback=self.calculate_waviness) button.setFixedHeight(45) button.setFixedWidth(170) button = gui.button(button_box, self, "Generate Waviness File", callback=self.generate_waviness_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(200) 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) button.setFixedWidth(120) 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_xlabel("X (cm)") self.axis.set_ylabel("Y (cm)") 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, show_automatic_box=True): 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.WIDGET_WIDTH)), round(min(geom.height()*0.95, self.WIDGET_HEIGHT)))) gen_box = gui.widgetBox(self.mainArea, "Beamline Info", addSpace=True, orientation="horizontal") tabs_setting = gui.tabWidget(gen_box) tabs_setting.setFixedHeight(self.WIDGET_HEIGHT-60) tabs_setting.setFixedWidth(self.WIDGET_WIDTH-60) tab_sys = ShadowGui.createTabPage(tabs_setting, "Sys Info") tab_mir = ShadowGui.createTabPage(tabs_setting, "OE Info") tab_sou = ShadowGui.createTabPage(tabs_setting, "Source Info") tab_scr = ShadowGui.createTabPage(tabs_setting, "Python Script") tab_out = ShadowGui.createTabPage(tabs_setting, "System Output") self.sysInfo = QtGui.QTextEdit() self.sysInfo.setReadOnly(True) self.sysInfo.setMaximumHeight(self.WIDGET_HEIGHT-100) self.mirInfo = QtGui.QTextEdit() self.mirInfo.setReadOnly(True) self.mirInfo.setMaximumHeight(self.WIDGET_HEIGHT-100) self.sourceInfo = QtGui.QTextEdit() self.sourceInfo.setReadOnly(True) self.sourceInfo.setMaximumHeight(self.WIDGET_HEIGHT-100) self.pythonScript = QtGui.QTextEdit() self.pythonScript.setReadOnly(False) # asked by Manolo self.pythonScript.setMaximumHeight(self.WIDGET_HEIGHT - 300) sys_box = ShadowGui.widgetBox(tab_sys, "", addSpace=True, orientation="horizontal", height = self.WIDGET_HEIGHT-80, width = self.WIDGET_WIDTH-80) sys_box.layout().addWidget(self.sysInfo) mir_box = ShadowGui.widgetBox(tab_mir, "", addSpace=True, orientation="horizontal", height = self.WIDGET_HEIGHT-80, width = self.WIDGET_WIDTH-80) mir_box.layout().addWidget(self.mirInfo) source_box = ShadowGui.widgetBox(tab_sou, "", addSpace=True, orientation="horizontal", height = self.WIDGET_HEIGHT-80, width = self.WIDGET_WIDTH-80) source_box.layout().addWidget(self.sourceInfo) script_box = ShadowGui.widgetBox(tab_scr, "", addSpace=True, orientation="vertical", height=self.WIDGET_HEIGHT - 80, width=self.WIDGET_WIDTH - 80) script_box.layout().addWidget(self.pythonScript) console_box = ShadowGui.widgetBox(script_box, "", addSpace=True, orientation="vertical", height=150, width=self.WIDGET_WIDTH - 80) self.console = PythonConsole(self.__dict__, self) console_box.layout().addWidget(self.console) self.shadow_output = QtGui.QTextEdit() self.shadow_output.setReadOnly(True) out_box = ShadowGui.widgetBox(tab_out, "System Output", addSpace=True, orientation="horizontal", height=self.WIDGET_HEIGHT - 80) out_box.layout().addWidget(self.shadow_output) ############################# button_box = ShadowGui.widgetBox(tab_scr, "", addSpace=True, orientation="horizontal") gui.button(button_box, self, "Run Script", callback=self.execute_script, height=40) gui.button(button_box, self, "Save Script to File", callback=self.save_script, height=40)
def __init__(self): super().__init__() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tab_bas = ShadowGui.createTabPage(tabs_setting, "Basic Setting") tab_adv = ShadowGui.createTabPage(tabs_setting, "Advanced Setting") crl_box = ShadowGui.widgetBox(tab_bas, "C.R.L. Input Parameters", addSpace=False, orientation="vertical", height=100, width=450) ShadowGui.lineEdit(crl_box, self, "nlenses", "Number of lenses", labelWidth=350, valueType=int, orientation="horizontal") ShadowGui.lineEdit(crl_box, self, "slots_empty", "Number of empty slots", labelWidth=350, valueType=int, orientation="horizontal") ShadowGui.lineEdit(crl_box, self, "thickness", "Piling thickness [cm]", labelWidth=350, valueType=float, orientation="horizontal") lens_box = ShadowGui.widgetBox(tab_bas, "Single Lens Input Parameters", addSpace=False, orientation="vertical", height=500, width=450) ShadowGui.lineEdit(lens_box, self, "p", "Distance Source-First lens interface (P) [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(lens_box, self, "q", "Distance Last lens interface-Image plane (Q) [cm]", labelWidth=350, valueType=float, orientation="horizontal") gui.separator(lens_box) gui.comboBox(lens_box, self, "has_finite_diameter", label="Lens Diameter", labelWidth=350, items=["Finite", "Infinite"], callback=self.set_diameter, sendSelectedValue=False, orientation="horizontal") self.diameter_box = ShadowGui.widgetBox(lens_box, "", addSpace=False, orientation="vertical", height=20) self.diameter_box_empty = ShadowGui.widgetBox(lens_box, "", addSpace=False, orientation="vertical", height=20) ShadowGui.lineEdit(self.diameter_box, self, "diameter", "Lens Diameter Value [cm]", labelWidth=350, valueType=float, orientation="horizontal") self.set_diameter() gui.separator(lens_box) gui.comboBox(lens_box, self, "surface_shape", label="Surface Shape", labelWidth=350, items=["Sphere", "Paraboloid", "Plane"], callback=self.set_surface_shape, sendSelectedValue=False, orientation="horizontal") self.surface_shape_box = ShadowGui.widgetBox(lens_box, "", addSpace=False, orientation="vertical", height=20) self.surface_shape_box_empty = ShadowGui.widgetBox(lens_box, "", addSpace=False, orientation="vertical", height=20) ShadowGui.lineEdit(self.surface_shape_box, self, "radius", "Curvature Radius [cm]", labelWidth=350, valueType=float, orientation="horizontal") self.set_surface_shape() ShadowGui.lineEdit(lens_box, self, "interthickness", "Lens Thickness [cm]", labelWidth=350, valueType=float, orientation="horizontal") gui.comboBox(lens_box, self, "use_ccc", label="Use C.C.C.", labelWidth=350, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.comboBox(lens_box, self, "convex_to_the_beam", label="Convexity of the first interface exposed to the beam\n(the second interface has opposite convexity)", labelWidth=350, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal") gui.separator(lens_box) gui.comboBox(lens_box, self, "is_cylinder", label="Cylindrical", labelWidth=350, items=["No", "Yes"], callback=self.set_cylindrical, sendSelectedValue=False, orientation="horizontal") self.box_cyl = ShadowGui.widgetBox(lens_box, "", addSpace=True, orientation="vertical", height=25) self.box_cyl_empty = ShadowGui.widgetBox(lens_box, "", addSpace=True, orientation="vertical", height=25) gui.comboBox(self.box_cyl, self, "cylinder_angle", label="Cylinder Angle (deg)", labelWidth=350, items=["0 (Meridional)", "90 (Sagittal)"], sendSelectedValue=False, orientation="horizontal") self.set_cylindrical() gui.separator(lens_box) gui.comboBox(lens_box, self, "ri_calculation_mode", label="Refraction Index calculation mode", labelWidth=350, items=["User Parameters", "Prerefl File"], callback=self.set_ri_calculation_mode, sendSelectedValue=False, orientation="horizontal") self.calculation_mode_1 = ShadowGui.widgetBox(lens_box, "", addSpace=True, orientation="vertical", height=50) ShadowGui.lineEdit(self.calculation_mode_1, self, "refraction_index", "Refraction index", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.calculation_mode_1, self, "attenuation_coefficient", "Attenuation coefficient [cm-1]", labelWidth=350, valueType=float, orientation="horizontal") self.calculation_mode_2 = ShadowGui.widgetBox(lens_box, "", addSpace=True, orientation="vertical", height=50) ShadowGui.lineEdit(self.calculation_mode_2, self, "prerefl_file", "File Prerefl", labelWidth=150, valueType=str, orientation="horizontal") self.set_ri_calculation_mode() adv_other_box = ShadowGui.widgetBox(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=310, items=["All", "Mirror", "Image", "None"], sendSelectedValue=False, orientation="horizontal") gui.separator(self.controlArea, height=80) 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__(self): super().__init__() # self.resetSettings() ################################# # FIX A WEIRD BEHAVIOUR AFTER DISPLAY # THE WIDGET: PROBABLY ON SIGNAL MANAGER self.dumpSettings() self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) tabs_setting = gui.tabWidget(self.controlArea) tabs_setting.setFixedWidth(495) tabs_setting.setFixedHeight(750) tab_bas = ShadowGui.createTabPage(tabs_setting, "Basic Setting") tab_adv = ShadowGui.createTabPage(tabs_setting, "Advanced Setting") ShadowGui.lineEdit(tab_bas, self, "p", "Distance Source - KB center (P) [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "q", "Distance KB center - Image plane (Q) [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "separation", "Separation between the Mirrors [cm]\n(from center of V.F.M. to center of H.F.M.) ", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(tab_bas, self, "mirror_orientation_angle", "Mirror orientation angle [deg]\n(with respect to the previous o.e. for the first mirror)", labelWidth=350, valueType=float, orientation="horizontal") gui.comboBox(tab_bas, self, "use_different_focal_positions", label="Different Focal Positions", labelWidth=350, items=["No", "Yes"], sendSelectedValue=False, orientation="horizontal", callback=self.set_use_different_focal_positions) self.focal_positions_box = ShadowGui.widgetBox(tab_bas, "", addSpace=False, orientation="vertical", height=45) self.focal_positions_empty = ShadowGui.widgetBox(tab_bas, "", addSpace=False, orientation="vertical", height=45) ShadowGui.lineEdit(self.focal_positions_box, self, "focal_positions_p", "Focal Position P [cm]", labelWidth=350, valueType=float, orientation="horizontal") ShadowGui.lineEdit(self.focal_positions_box, self, "focal_positions_q", "Focal Position Q [cm]", labelWidth=350, valueType=float, orientation="horizontal") self.set_use_different_focal_positions() gui.separator(tab_bas, height=10) self.tab_mirrors = gui.tabWidget(tab_bas) tab_vertical = ShadowGui.createTabPage(self.tab_mirrors, "Vertical Focusing Mirror") tab_horizontal = ShadowGui.createTabPage(self.tab_mirrors, "Horizontal Focusing Mirror") self.v_box = MirrorBox(kb=self, parent=tab_vertical, grazing_angles_mrad=self.grazing_angles_mrad[0], shape=self.shape[0], has_finite_dimensions=self.has_finite_dimensions[0], dimensions=self.dimensions[0], reflectivity_kind=self.reflectivity_kind[0], reflectivity_files=self.reflectivity_files[0], has_surface_error=self.has_surface_error[0], surface_error_files=self.surface_error_files[0]) self.h_box = MirrorBox(kb=self, parent=tab_horizontal, grazing_angles_mrad=self.grazing_angles_mrad[1], shape=self.shape[1], has_finite_dimensions=self.has_finite_dimensions[1], dimensions=self.dimensions[1], reflectivity_kind=self.reflectivity_kind[1], reflectivity_files=self.reflectivity_files[1], has_surface_error=self.has_surface_error[1], surface_error_files=self.surface_error_files[1]) adv_other_box = ShadowGui.widgetBox(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=310, items=["All", "Mirror", "Image", "None"], sendSelectedValue=False, orientation="horizontal") 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)