def initializeTabs(self): current_tab = self.tabs.currentIndex() enabled = self.isFootprintEnabled() size = len(self.tab) indexes = range(0, size) for index in indexes: self.tabs.removeTab(size-1-index) titles = self.getTitles() self.tab = [gui.createTabPage(self.tabs, titles[0]), gui.createTabPage(self.tabs, titles[1]), gui.createTabPage(self.tabs, titles[2]), gui.createTabPage(self.tabs, titles[3]), gui.createTabPage(self.tabs, titles[4]), ] for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = [None, None, None, None, None] self.enableFootprint(enabled) self.tabs.setCurrentIndex(current_tab)
def __init__(self, show_automatic_box=True): super().__init__(show_automatic_box) self.main_tabs = gui.tabWidget(self.mainArea) plot_tab = gui.createTabPage(self.main_tabs, "Plots") out_tab = gui.createTabPage(self.main_tabs, "Output") view_box = oasysgui.widgetBox(plot_tab, "Plotting Style", 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="Select level of Plotting", labelWidth=220, items=["Detailed Plot", "Preview", "None"], callback=self.set_PlotQuality, sendSelectedValue=False, orientation="horizontal") self.tab = [] self.tabs = gui.tabWidget(plot_tab) self.initializeTabs() self.enableFootprint(False) 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 = 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 initializeTabs(self): current_tab = self.tabs_widget.currentIndex() size = len(self.tabs) for index in range(0, size): self.tabs_widget.removeTab(size-1-index) self.tabs = [gui.createTabPage(self.tabs_widget, "Reflectivity Plot"), gui.createTabPage(self.tabs_widget, "Standing Waves Plot")] for tab in self.tabs: tab.setFixedHeight(650) tab.setFixedWidth(650) self.plot_canvas = [None] self.tabs_widget.setCurrentIndex(current_tab)
def createTabPage(tabWidget, name, widgetToAdd=None, canScroll=False, height=None, width=None): tab = orange_gui.createTabPage(tabWidget, name, widgetToAdd, canScroll) tab.layout().setAlignment(Qt.AlignTop) if not height is None: tab.setFixedHeight(height) if not width is None: tab.setFixedWidth(width) return tab
def initializeTabs(self): current_tab = self.tabs_widget.currentIndex() size = len(self.tabs) for index in range(0, size): self.tabs_widget.removeTab(size-1-index) self.tabs = [gui.createTabPage(self.tabs_widget, "X-ray Server Ouput"), gui.createTabPage(self.tabs_widget, "Critical Angle for TER"), gui.createTabPage(self.tabs_widget, "Darwin Curve (" + u"\u03C3" + " Pol.)"), gui.createTabPage(self.tabs_widget, "Darwin Curve (" + u"\u03C0" + " Pol.)"), ] for tab in self.tabs: tab.setFixedHeight(650) tab.setFixedWidth(750) self.plot_canvas = [None, None, None] self.tabs_widget.setCurrentIndex(current_tab)
def initializeWigglerTabs(self): current_tab = self.wiggler_tabs.currentIndex() size = len(self.wiggler_tab) indexes = range(0, size) for index in indexes: self.wiggler_tabs.removeTab(size-1-index) self.wiggler_tab = [ gui.createTabPage(self.wiggler_tabs, "Magnetic Field"), gui.createTabPage(self.wiggler_tabs, "Electron Curvature"), gui.createTabPage(self.wiggler_tabs, "Electron Velocity"), gui.createTabPage(self.wiggler_tabs, "Electron Trajectory"), gui.createTabPage(self.wiggler_tabs, "Wiggler Spectrum"), ] for tab in self.wiggler_tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.wiggler_plot_canvas = [None, None, None, None, None] self.wiggler_tabs.setCurrentIndex(current_tab)
def initializeTabs(self): current_tab = self.tabs_widget.currentIndex() size = len(self.tabs) for index in range(0, size): self.tabs_widget.removeTab(size-1-index) self.tabs = [gui.createTabPage(self.tabs_widget, "Diffraction Intensity"),] for tab in self.tabs: tab.setFixedHeight(650) tab.setFixedWidth(650) self.plot_canvas = [None] self.tabs_widget.setCurrentIndex(current_tab)
def enableFootprint(self, enabled=False): if enabled: if self.tabs.count() == 5: self.tab.append(gui.createTabPage(self.tabs, "Footprint")) self.plot_canvas.append(None) else: if self.tabs.count() == 6: self.tabs.removeTab(5) self.tab = [self.tab[0], self.tab[1], self.tab[2], self.tab[3], self.tab[4],] self.plot_canvas = [self.plot_canvas[0], self.plot_canvas[1], self.plot_canvas[2], self.plot_canvas[3], self.plot_canvas[4],]
def initializeTabs(self): size = len(self.tab) indexes = range(0, size) for index in indexes: self.tabs.removeTab(size-1-index) titles = self.getTitles() self.tab = [] self.plot_canvas = [] for index in range(0, len(titles)): self.tab.append(gui.createTabPage(self.tabs, titles[index])) self.plot_canvas.append(None) for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH)
def initializeTabs(self): size = len(self.tab) indexes = range(0, size) for index in indexes: self.tabs.removeTab(size - 1 - index) self.tab = [] self.plot_canvas = [] self.set_tab_titles() for index in range(0, len(self.tab_titles)): self.tab.append( gui.createTabPage(self.tabs, self.tab_titles[index])) self.plot_canvas.append(None) for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH)
def enableFootprint(self, enabled=False): if enabled: if self.tabs.count() == 5: self.tab.append(gui.createTabPage(self.tabs, "Footprint")) self.plot_canvas.append(None) else: if self.tabs.count() == 6: self.tabs.removeTab(5) self.tab = [ self.tab[0], self.tab[1], self.tab[2], self.tab[3], self.tab[4], ] self.plot_canvas = [ self.plot_canvas[0], self.plot_canvas[1], self.plot_canvas[2], self.plot_canvas[3], self.plot_canvas[4], ]
def initializeTabs(self): self.tabs.clear() if self.ghy_calcType != 0 and self.ghy_nf == 1: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field"), gui.createTabPage(self.tabs, "Distribution of Position at Far Field"), gui.createTabPage(self.tabs, u"\u2206" + "Position at Near Field"), gui.createTabPage(self.tabs, "Distribution of Position at Near Field") ] else: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field"), gui.createTabPage(self.tabs, "Distribution of Position at Far Field") ] for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = [None, None, None, None]
def initializeWigglerTabs(self): current_tab = self.wiggler_tabs.currentIndex() size = len(self.wiggler_tab) indexes = range(0, size) for index in indexes: self.wiggler_tabs.removeTab(size-1-index) self.wiggler_tab = [ gui.createTabPage(self.wiggler_tabs, "Magnetic Field"), gui.createTabPage(self.wiggler_tabs, "Electron Curvature"), gui.createTabPage(self.wiggler_tabs, "Electron Velocity"), gui.createTabPage(self.wiggler_tabs, "Electron Trajectory"), gui.createTabPage(self.wiggler_tabs, "Wiggler Spectrum"), gui.createTabPage(self.wiggler_tabs, "Wiggler Spectral power") ] for tab in self.wiggler_tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.wiggler_plot_canvas = [None, None, None, None, None, None] self.wiggler_tabs.setCurrentIndex(current_tab)
def initializeTabs(self): self.tabs = gui.tabWidget(self.mainArea) self.tab = [gui.createTabPage(self.tabs, "Info"), gui.createTabPage(self.tabs, "Heights Profile"), gui.createTabPage(self.tabs, "Slopes Profile"), gui.createTabPage(self.tabs, "PSD Heights"), gui.createTabPage(self.tabs, "CSD Heights"), gui.createTabPage(self.tabs, "ACF"), gui.createTabPage(self.tabs, "Generated 2D Profile"), ] for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = [None, None, None, None, None, None] self.plot_canvas[0] = PlotWindow(roi=False, control=False, position=True, plugins=False) self.plot_canvas[0].setDefaultPlotLines(True) self.plot_canvas[0].setActiveCurveColor(color='darkblue') self.plot_canvas[0].setGraphYLabel("Z [nm]") self.plot_canvas[0].setGraphTitle("Heights Profile") self.plot_canvas[0].setDrawModeEnabled(True, 'rectangle') self.plot_canvas[0].setZoomModeEnabled(True) self.plot_canvas[1] = PlotWindow(roi=False, control=False, position=True, plugins=False) self.plot_canvas[1].setDefaultPlotLines(True) self.plot_canvas[1].setActiveCurveColor(color='darkblue') self.plot_canvas[1].setGraphYLabel("Zp [$\mu$rad]") self.plot_canvas[1].setGraphTitle("Slopes Profile") self.plot_canvas[1].setDrawModeEnabled(True, 'rectangle') self.plot_canvas[1].setZoomModeEnabled(True) self.plot_canvas[2] = PlotWindow(roi=False, control=False, position=True, plugins=False) self.plot_canvas[2].setDefaultPlotLines(True) self.plot_canvas[2].setActiveCurveColor(color='darkblue') self.plot_canvas[2].setGraphXLabel("f [m^-1]") self.plot_canvas[2].setGraphYLabel("PSD [m^3]") self.plot_canvas[2].setGraphTitle("Power Spectral Density of Heights Profile") self.plot_canvas[2].setDrawModeEnabled(True, 'rectangle') self.plot_canvas[2].setZoomModeEnabled(True) self.plot_canvas[2].setXAxisLogarithmic(True) self.plot_canvas[2].setYAxisLogarithmic(True) self.plot_canvas[3] = PlotWindow(roi=False, control=False, position=True, plugins=False) self.plot_canvas[3].setDefaultPlotLines(True) self.plot_canvas[3].setActiveCurveColor(color='darkblue') self.plot_canvas[3].setGraphXLabel("f [m^-1]") self.plot_canvas[3].setGraphYLabel("CSD [m^3]") self.plot_canvas[3].setGraphTitle("Cumulative Spectral Density of Heights Profile") self.plot_canvas[3].setDrawModeEnabled(True, 'rectangle') self.plot_canvas[3].setZoomModeEnabled(True) self.plot_canvas[3].setXAxisLogarithmic(True) self.plot_canvas[4] = PlotWindow(roi=False, control=False, position=True, plugins=False) self.plot_canvas[4].setDefaultPlotLines(True) self.plot_canvas[4].setActiveCurveColor(color='darkblue') self.plot_canvas[4].setGraphXLabel("Length [m]") self.plot_canvas[4].setGraphYLabel("ACF") self.plot_canvas[4].setGraphTitle("Autocovariance Function of Heights Profile") self.plot_canvas[4].setDrawModeEnabled(True, 'rectangle') self.plot_canvas[4].setZoomModeEnabled(True) self.figure = Figure(figsize=(self.IMAGE_HEIGHT, self.IMAGE_HEIGHT)) # QUADRATA! self.figure.patch.set_facecolor('white') self.axis = self.figure.add_subplot(111, projection='3d') self.axis.set_zlabel("Z [nm]") self.plot_canvas[5] = FigureCanvasQTAgg(self.figure) self.profileInfo = QTextEdit() self.profileInfo.setReadOnly(True) self.profileInfo.setMinimumHeight(self.IMAGE_HEIGHT-5) self.profileInfo.setMaximumHeight(self.IMAGE_HEIGHT-5) self.profileInfo.setMinimumWidth(310) self.profileInfo.setMaximumWidth(310) profile_box = oasysgui.widgetBox(self.tab[0], "", addSpace=True, orientation="horizontal", height = self.IMAGE_HEIGHT, width=320) profile_box.layout().addWidget(self.profileInfo) for index in range(0, 6): self.tab[index+1].layout().addWidget(self.plot_canvas[index]) self.tabs.setCurrentIndex(1)
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 initializeTabs(self): self.tabs.clear() tabs = [] if self.ghy_diff_plane < 2: tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Image Plane"))) self.tab = [[ gui.createTabPage(tabs[0], "Position"), gui.createTabPage(tabs[0], "Stats") ]] if self.ghy_nf == 1: tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Near Field"))) self.tab.append([ gui.createTabPage(tabs[1], "Position"), gui.createTabPage(tabs[1], "Stats") ]) elif self.ghy_diff_plane >= 2: if self.ghy_nf == 1: tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Image Plane (S)"))) tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Near Field (S)"))) tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Image Plane (T)"))) tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Near Field (T)"))) self.tab = [[ gui.createTabPage(tabs[0], "Position"), gui.createTabPage(tabs[0], "Stats") ], [ gui.createTabPage(tabs[1], "Position"), gui.createTabPage(tabs[1], "Stats") ], [ gui.createTabPage(tabs[2], "Position"), gui.createTabPage(tabs[2], "Stats") ], [ gui.createTabPage(tabs[3], "Position"), gui.createTabPage(tabs[3], "Stats") ]] else: tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Image Plane (S)"))) tabs.append( oasysgui.tabWidget( gui.createTabPage( self.tabs, "Distribution of Position at Image Plane (T)"))) self.tab = [[ gui.createTabPage(tabs[0], "Position"), gui.createTabPage(tabs[0], "Stats") ], [ gui.createTabPage(tabs[1], "Position"), gui.createTabPage(tabs[1], "Stats") ]] for tab in tabs: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = [None, None, None, None] self.plot_canvas_stats = [None, None, None, None]
def __init__(self): super().__init__() self.runaction = OWAction("Compute", self) self.runaction.triggered.connect(self.compute) self.addAction(self.runaction) geom = QApplication.desktop().availableGeometry() self.setGeometry( QRect(round(geom.width() * 0.05), round(geom.height() * 0.05), round(min(geom.width() * 0.98, self.MAX_WIDTH)), round(min(geom.height() * 0.95, self.MAX_HEIGHT)))) self.setMaximumHeight(self.geometry().height()) self.setMaximumWidth(self.geometry().width()) self.controlArea.setFixedWidth(self.CONTROL_AREA_WIDTH) self.general_options_box = gui.widgetBox(self.controlArea, "General Options", addSpace=True, orientation="horizontal") gui.checkBox(self.general_options_box, self, 'is_automatic_run', 'Automatic Execution') self.button_box = gui.widgetBox(self.controlArea, "", orientation="horizontal") #widget buttons: compute, set defaults, help gui.button(self.button_box, self, "Compute", callback=self.compute, height=35) gui.button(self.button_box, self, "Defaults", callback=self.defaults, height=35) gui.separator(self.controlArea, height=10) self.build_gui() gui.rubber(self.controlArea) self.main_tabs = gui.tabWidget(self.mainArea) plot_tab = gui.createTabPage(self.main_tabs, "Results") out_tab = gui.createTabPage(self.main_tabs, "Output") self.view_box = oasysgui.widgetBox(plot_tab, "Results Options", addSpace=False, orientation="horizontal") view_box_1 = oasysgui.widgetBox(self.view_box, "", addSpace=False, orientation="vertical", width=350) self.view_type_combo = gui.comboBox(view_box_1, self, "view_type", label="View Results", labelWidth=220, items=["No", "Yes"], callback=self.set_ViewType, sendSelectedValue=False, orientation="horizontal") self.tab = [] self.tabs = gui.tabWidget(plot_tab) self.initializeTabs() self.wise_output = QtGui.QTextEdit() self.wise_output.setReadOnly(True) out_box = gui.widgetBox(out_tab, "System Output", addSpace=True, orientation="horizontal") out_box.layout().addWidget(self.wise_output) self.wise_output.setFixedHeight(600) self.wise_output.setFixedWidth(600) gui.rubber(self.mainArea)
def initializeTabs(self): self.tabs.clear() if self.ghy_diff_plane < 2: if self.ghy_nf == 1: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field"), gui.createTabPage(self.tabs, "Distribution of Position at Image Plane"), gui.createTabPage(self.tabs, u"\u2206" + "Position at Near Field"), gui.createTabPage(self.tabs, "Distribution of Position at Near Field") ] else: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field"), gui.createTabPage(self.tabs, "Distribution of Position at Image Plane") ] elif self.ghy_diff_plane == 2: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field"), gui.createTabPage(self.tabs, "Distribution of Position at Image Plane") ] elif self.ghy_diff_plane == 3: if self.ghy_nf == 1: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field (S)"), gui.createTabPage(self.tabs, u"\u2206" + "Position at Near Field (S)"), gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field (T)"), gui.createTabPage(self.tabs, u"\u2206" + "Position at Near Field (T)"), gui.createTabPage(self.tabs, "Distribution of Position at Near Field"), gui.createTabPage(self.tabs, "Distribution of Position at Image Plane") ] else: self.tab = [gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field (S)"), gui.createTabPage(self.tabs, u"\u2206" + "Divergence at Far Field (T)"), gui.createTabPage(self.tabs, "Distribution of Position at Image Plane") ] for tab in self.tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) self.plot_canvas = [None, None, None, None, None, None]
def initializeUndulatorTabs(self): current_tab = self.undulator_tabs.currentIndex() size = len(self.undulator_tab) indexes = range(0, size) for index in indexes: self.undulator_tabs.removeTab(size - 1 - index) if self.delta_e == 0.0: self.undulator_tab = [ gui.createTabPage(self.undulator_tabs, "Radiation intensity (polar)"), gui.createTabPage(self.undulator_tabs, "Polarization (polar)"), gui.createTabPage( self.undulator_tabs, "Radiation intensity (cartesian - interpolated)"), gui.createTabPage(self.undulator_tabs, "Photon source size"), ] self.und_plot_canvas = [ None, None, None, None, ] else: self.undulator_tab = [ gui.createTabPage(self.undulator_tabs, "Radiation (polar)"), gui.createTabPage(self.undulator_tabs, "Polarization (polar)"), gui.createTabPage(self.undulator_tabs, "Radiation (interpolated)"), gui.createTabPage(self.undulator_tabs, "Photon source size"), gui.createTabPage(self.undulator_tabs, "Power Density (interpolated)"), gui.createTabPage(self.undulator_tabs, "Flux"), gui.createTabPage(self.undulator_tabs, "Spectral Power"), ] self.und_plot_canvas = [ None, None, None, None, None, None, None, ] for tab in self.undulator_tab: tab.setFixedHeight(self.IMAGE_HEIGHT) tab.setFixedWidth(self.IMAGE_WIDTH) # self.undulator_plot_canvas = [None, None, None] self.undulator_tabs.setCurrentIndex(current_tab)
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)