def init_info(self, info_dict, max_plot_points=None): self.title_label.setText(info_dict.get("title", "???")) self.history_button.setVisible(info_dict.get("history", False)) font = self.value_label.font() if info_dict.get("font"): font.setPointSize(info_dict.get("font")) if info_dict.get("bold"): font.setBold(True) self.value_label.setFont(font) if info_dict.get("align") == "left": self.value_label.setAlignment(Qt.AlignLeft) elif info_dict.get("align") == "right": self.value_label.setAlignment(Qt.AlignRight) elif info_dict.get("align") == "center": self.value_label.setAlignment(Qt.AlignHCenter) elif info_dict.get("align") == "justify": self.value_label.setAlignment(Qt.AlignJustify) if info_dict.get("history"): self.history_button.show() self.value_plot = TwoAxisPlotWidget(self, realtime_plot=True) self.value_plot.hide() self.main_vlayout.addWidget(self.value_plot) self.value_plot.set_tight_layout() self.value_plot.clear() self.value_plot.set_max_plot_point(max_plot_points) #self.value_plot.set_y_axis_limits([0, None]) self.update_info(info_dict)
def __init__(self, *args): BlissWidget.__init__(self, *args) self.defineSlot('set_data', ()) if pymca_imported: self.mcafit_widget = McaAdvancedFit.McaAdvancedFit(self) self.mcafit_widget.dismissButton.hide() else: self.mcafit_widget = TwoAxisPlotWidget(self) _main_vlayout = QVBoxLayout(self) _main_vlayout.addWidget(self.mcafit_widget) _main_vlayout.setSpacing(0) _main_vlayout.setContentsMargins(0, 0, 0, 0)
def init_info(self, info_dict, max_plot_points=None): self.title_label.setText(info_dict.get("title", "???")) self.history_button.setVisible(info_dict.get("history", False)) font = self.value_label.font() if info_dict.get("font"): font.setPointSize(info_dict.get("font")) if info_dict.get("bold"): font.setBold(True) self.value_label.setFont(font) if info_dict.get("history"): self.history_button.show() self.value_plot = TwoAxisPlotWidget(self, realtime_plot=True) self.value_plot.hide() self.main_vlayout.addWidget(self.value_plot) self.value_plot.set_tight_layout() self.value_plot.clear() self.value_plot.set_max_plot_point(max_plot_points) self.update_info(info_dict)
def __init__(self, parent=None, name="energy_scan_tab_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self.energy_scan_model = queue_model_objects.EnergyScan() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = QtGui.QWidget(self) _parameters_widget = QtGui.QWidget(_top_widget) self.periodic_table_widget = PeriodicTableWidget(_parameters_widget) self.data_path_widget = DataPathWidget(_parameters_widget) # LNLS # self.data_path_widget.data_path_layout.file_name_label.setText('') # self.data_path_widget.data_path_layout.file_name_label.hide() # self.data_path_widget.data_path_layout.file_name_value_label.hide() # --------------------------------------------------------------------- # LNLS self.data_path_widget.setFixedHeight(140) # --------------------------------------------------------------------- _snapshot_widget = QtGui.QWidget(self) # Snapshot of current position self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) # LNLS self.position_widget.setFixedSize(450, 340) # Graphics self.scan_plot_widget = TwoAxisPlotWidget(self, True) self.result_plot_widget = TwoAxisPlotWidget(self, False) # Layout ------------------------------------------------------------- _parameters_widget_layout = QtGui.QVBoxLayout() _parameters_widget_layout.addWidget(self.periodic_table_widget) _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _parameters_widget.setLayout(_parameters_widget_layout) _snapshots_vlayout = QtGui.QVBoxLayout(_snapshot_widget) _snapshots_vlayout.addWidget(self.position_widget) _snapshots_vlayout.setContentsMargins(0, 0, 0, 0) _snapshots_vlayout.setSpacing(2) # LNLS # _snapshots_vlayout.addStretch(10) _snapshots_vlayout.addStretch(0) _snapshot_widget.setLayout(_snapshots_vlayout) # ---- _top_widget_hlayout = QtGui.QHBoxLayout(self) _top_widget_hlayout.addWidget(_parameters_widget) _top_widget_hlayout.addWidget(_snapshot_widget) _top_widget_hlayout.addStretch(0) _top_widget_hlayout.setSpacing(2) _top_widget_hlayout.setContentsMargins(0, 0, 0, 0) _top_widget.setLayout(_top_widget_hlayout) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.scan_plot_widget) _main_vlayout.addWidget(self.result_plot_widget) _main_vlayout.setSpacing(5) _main_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout.addStretch(0) self.setLayout(_main_vlayout) # SizePolicies -------------------------------------------------------- self.scan_plot_widget.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) self.result_plot_widget.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) # Qt signal/slot connections ------------------------------------------ #qt.QObject.connect(self.periodic_table_widget, qt.PYSIGNAL('edgeSelected'), # self.element_clicked) self.data_path_widget.data_path_layout.prefix_ledit.\ textChanged.connect(self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.\ textChanged.connect(self._run_number_ledit_change)
def __init__(self, parent=None, name="energy_scan_tab_widget"): QtGui.QWidget.__init__(self, parent) if name is not None: self.setObjectName(name) # Hardware objects ---------------------------------------------------- # Internal variables -------------------------------------------------- self.energy_scan_model = queue_model_objects.EnergyScan() self._tree_view_item = None # Graphic elements ---------------------------------------------------- _top_widget = QtGui.QWidget(self) _parameters_widget = QtGui.QWidget(_top_widget) self.periodic_table_widget = PeriodicTableWidget(_parameters_widget) self.data_path_widget = DataPathWidget(_parameters_widget) self.data_path_widget.data_path_layout.file_name_label.setText('') self.data_path_widget.data_path_layout.file_name_value_label.hide() self.position_widget = uic.loadUi( os.path.join(os.path.dirname(__file__), 'ui_files/Qt4_snapshot_widget_layout.ui')) self.position_widget.setFixedSize(450, 340) self.scan_plot_widget = TwoAxisPlotWidget(self) self.scan_plot_widget.set_real_time_plot(True) self.result_plot_widget = TwoAxisPlotWidget(self) """self.scan_plot_widget = ScanPlotWidget(self) self.scan_plot_widget.setRealTimePlot(True) self.result_plot_widget = ScanPlotWidget(self) self.result_plot_widget.setRealTimePlot(False) self.scan_plot_widget.setFixedHeight(200) self.result_plot_widget.setFixedHeight(200)""" # Layout ------------------------------------------------------------- _parameters_widget_layout = QtGui.QVBoxLayout() _parameters_widget_layout.addWidget(self.periodic_table_widget) _parameters_widget_layout.addWidget(self.data_path_widget) _parameters_widget_layout.addStretch(0) _parameters_widget_layout.setSpacing(2) _parameters_widget_layout.setContentsMargins(0, 0, 0, 0) _parameters_widget.setLayout(_parameters_widget_layout) _top_widget_hlayout = QtGui.QHBoxLayout(self) _top_widget_hlayout.addWidget(_parameters_widget) _top_widget_hlayout.addWidget(self.position_widget) _top_widget_hlayout.addStretch(0) _top_widget_hlayout.setSpacing(2) _top_widget_hlayout.setContentsMargins(0, 0, 0, 0) _top_widget.setLayout(_top_widget_hlayout) _main_vlayout = QtGui.QVBoxLayout(self) _main_vlayout.addWidget(_top_widget) _main_vlayout.addWidget(self.scan_plot_widget) _main_vlayout.addWidget(self.result_plot_widget) _main_vlayout.setSpacing(2) _main_vlayout.setContentsMargins(2, 2, 2, 2) _main_vlayout.addStretch(0) self.setLayout(_main_vlayout) # SizePolicies -------------------------------------------------------- # Qt signal/slot connections ------------------------------------------ #qt.QObject.connect(self.periodic_table_widget, qt.PYSIGNAL('edgeSelected'), # self.element_clicked) self.data_path_widget.data_path_layout.prefix_ledit.\ textChanged.connect(self._prefix_ledit_change) self.data_path_widget.data_path_layout.run_number_ledit.\ textChanged.connect(self._run_number_ledit_change) #qt.QObject.connect(qt.qApp, qt.PYSIGNAL('tab_changed'), # self.tab_changed) # Other --------------------------------------------------------------- Qt4_widget_colors.set_widget_color(self.periodic_table_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.position_widget, Qt4_widget_colors.GROUP_BOX_GRAY) Qt4_widget_colors.set_widget_color(self.data_path_widget, Qt4_widget_colors.GROUP_BOX_GRAY)