def __init__(self): icon = IconFont().icon('paw') name = 'Beaglebone Daemon' group = 'CON' use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("archive") name = 'Archiver Appliance' group = 'CON' use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon('desktop') name = 'Archiver Viwer' group = 'CON' use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("cogs") name = "Write Node" group = "Rogue" use_with_widgets = True ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("code") name = "Root Tool" group = "" use_with_widgets = True ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("paw") name = "Beaglebone Daemon" group = "CON" use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("desktop") name = "Archiver Viwer" group = "CON" use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self): icon = IconFont().icon("code") name = "Dummy Tool 2" group = "Example" use_with_widgets = True use_without_widget = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets, use_without_widget=use_without_widget)
def __init__(self,save=False): icon = IconFont().icon("cogs") self.save = save if self.save: name = "File Save Browser" else: name = "File Open Browser" group = "Rogue" use_with_widgets = True ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def handle_right_y_axis_checkbox_changed(self, is_checked): self.chart.setShowRightAxis(is_checked) if is_checked: right_label = self.chart.labels["right"] if not right_label: right_label = self.y_axis_label_line_edt.text() right_unit = self.chart.units["right"] if not right_unit: right_unit = self.y_axis_unit_edt.text() self.right_y_axis_font_btn = QPushButton() self.right_y_axis_font_btn.setMaximumHeight(32) self.right_y_axis_font_btn.setMaximumWidth(32) self.right_y_axis_font_btn.setIcon(IconFont().icon("font")) self.right_y_axis_font_btn.clicked.connect( partial(self.handle_font_change, "right")) self.right_y_axis_lbl = QLabel("Right y-axis Label") self.right_y_axis_label_line_edt = QLineEdit() self.right_y_axis_label_line_edt.textChanged.connect( partial(self.handle_axis_label_change, "right")) self.right_y_axis_unit_lbl = QLabel("Right y-axis Unit") self.right_y_axis_unit_edt = QLineEdit() self.right_y_axis_unit_edt.setMaximumWidth(150) self.right_y_axis_unit_edt.textChanged.connect( partial(self.handle_axis_label_change, "right", is_unit=True)) self.right_y_axis_label_line_edt.setText(right_label) self.right_y_axis_unit_edt.setText(right_unit) right_y_axis_layout = QHBoxLayout() right_y_axis_layout.addWidget(self.right_y_axis_label_line_edt) right_y_axis_layout.addWidget(self.right_y_axis_font_btn) self.main_layout.insertRow(self.main_layout.rowCount() - 1, self.right_y_axis_lbl, right_y_axis_layout) self.main_layout.insertRow(self.main_layout.rowCount() - 1, self.right_y_axis_unit_lbl, self.right_y_axis_unit_edt) else: self.chart.showAxis("right", show=False) self.right_y_axis_lbl.deleteLater() self.right_y_axis_label_line_edt.deleteLater() self.right_y_axis_unit_lbl.deleteLater() self.right_y_axis_unit_edt.deleteLater() self.right_y_axis_font_btn.deleteLater()
def __init__(self, main_display, parent=None): super(AxisSettingsDisplay, self).__init__(parent=parent) self.main_layout = QFormLayout() self.main_display = main_display self.chart = self.main_display.chart self.x_axis_lbl = QLabel("x-axis Label") self.x_axis_label_line_edt = QLineEdit() current_x_label = self.chart.labels["bottom"] if current_x_label: current_x_label = current_x_label[current_x_label. find(X_AXIS_LABEL_SEPARATOR) + len(X_AXIS_LABEL_SEPARATOR):] self.x_axis_label_line_edt.setText(current_x_label) self.x_axis_label_line_edt.textChanged.connect( partial(self.handle_axis_label_change, "bottom")) self.x_axis_font_btn = QPushButton() self.x_axis_font_btn.setMaximumHeight(32) self.x_axis_font_btn.setMaximumWidth(32) self.x_axis_font_btn.setIcon(IconFont().icon("font")) self.x_axis_font_btn.clicked.connect( partial(self.handle_font_change, "bottom")) self.x_axis_unit_lbl = QLabel("x-axis Unit") self.x_axis_unit_edt = QLineEdit() self.x_axis_unit_edt.setMaximumWidth(150) self.x_axis_unit_edt.setText(self.chart.units["bottom"]) self.x_axis_unit_edt.textChanged.connect( partial(self.handle_axis_label_change, "bottom", is_unit=True)) self.y_axis_lbl = QLabel("y-axis Label") self.y_axis_label_line_edt = QLineEdit() self.y_axis_label_line_edt.setText(self.chart.labels["left"]) self.y_axis_label_line_edt.textChanged.connect( partial(self.handle_axis_label_change, "left")) self.y_axis_font_btn = QPushButton() self.y_axis_font_btn.setMaximumHeight(32) self.y_axis_font_btn.setMaximumWidth(32) self.y_axis_font_btn.setIcon(IconFont().icon("font")) self.y_axis_font_btn.clicked.connect( partial(self.handle_font_change, "left")) self.y_axis_unit_lbl = QLabel("y-axis Unit") self.y_axis_unit_edt = QLineEdit() self.y_axis_unit_edt.setMaximumWidth(150) self.y_axis_unit_edt.setText(self.chart.units["left"]) self.y_axis_unit_edt.textChanged.connect( partial(self.handle_axis_label_change, "left", is_unit=True)) self.right_y_axis_label_line_edt = QLineEdit() self.display_right_y_axis_chk = QCheckBox("Display the right y-axis") self.display_right_y_axis_chk.setChecked(self.chart.getShowRightAxis()) self.display_right_y_axis_chk.clicked.connect( self.handle_right_y_axis_checkbox_changed) self.display_right_y_axis_chk.setChecked(self.chart.getShowRightAxis()) self.right_y_axis_lbl = None self.right_y_axis_unit_edt = None self.right_y_axis_unit_lbl = None self.right_y_axis_unit_edt = None self.close_dialog_btn = QPushButton("Close") self.close_dialog_btn.clicked.connect(self.handle_close_button_clicked) self.setWindowTitle("Axis Settings") self.setMinimumSize(500, 300) self.setWindowModality(Qt.ApplicationModal) self.setup_ui()
def __init__(self): icon = IconFont().icon("cogs") name = "Dummy Tool" group = "Example" use_with_widgets = False ExternalTool.__init__(self, icon=icon, name=name, group=group, use_with_widgets=use_with_widgets)
def __init__(self, parent=None, args=[], macros=None, show_pv_add_panel=True, config_file=None): """ Create all the widgets, including any child dialogs. Parameters ---------- parent : QWidget The parent widget of the charting display args : list The command parameters macros : str Macros to modify the UI parameters at runtime show_pv_add_panel : bool Whether or not to show the PV add panel on top of the graph """ super(TimeChartDisplay, self).__init__(parent=parent, args=args, macros=macros) self.legend_font = None self.channel_map = dict() self.setWindowTitle("TimeChart Tool") self.main_layout = QVBoxLayout() self.body_layout = QVBoxLayout() self.pv_add_panel = QFrame() self.pv_add_panel.setVisible(show_pv_add_panel) self.pv_add_panel.setMaximumHeight(50) self.pv_layout = QHBoxLayout() self.pv_name_line_edt = QLineEdit() self.pv_name_line_edt.setAcceptDrops(True) self.pv_name_line_edt.returnPressed.connect(self.add_curve) self.pv_protocol_cmb = QComboBox() self.pv_protocol_cmb.addItems(["ca://", "archive://"]) self.pv_protocol_cmb.setEnabled(False) self.pv_connect_push_btn = QPushButton("Connect") self.pv_connect_push_btn.clicked.connect(self.add_curve) self.tab_panel = QTabWidget() self.tab_panel.setMinimumWidth(350) self.tab_panel.setMaximumWidth(350) self.curve_settings_tab = QWidget() self.data_settings_tab = QWidget() self.chart_settings_tab = QWidget() self.charting_layout = QHBoxLayout() self.chart = PyDMTimePlot(plot_by_timestamps=False) self.chart.setDownsampling(ds=False, auto=False, mode=None) self.chart.plot_redrawn_signal.connect(self.update_curve_data) self.chart.setBufferSize(DEFAULT_BUFFER_SIZE) self.chart.setPlotTitle(DEFAULT_CHART_TITLE) self.splitter = QSplitter() self.curve_settings_layout = QVBoxLayout() self.curve_settings_layout.setAlignment(Qt.AlignTop) self.curve_settings_layout.setSizeConstraint(QLayout.SetMinAndMaxSize) self.curve_settings_layout.setSpacing(5) self.crosshair_settings_layout = QVBoxLayout() self.crosshair_settings_layout.setAlignment(Qt.AlignTop) self.crosshair_settings_layout.setSpacing(5) self.enable_crosshair_chk = QCheckBox("Crosshair") self.crosshair_coord_lbl = QLabel() self.crosshair_coord_lbl.setWordWrap(True) self.curve_settings_inner_frame = QFrame() self.curve_settings_inner_frame.setLayout(self.curve_settings_layout) self.curve_settings_scroll = QScrollArea() self.curve_settings_scroll.setVerticalScrollBarPolicy( Qt.ScrollBarAsNeeded) self.curve_settings_scroll.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.curve_settings_scroll.setWidget(self.curve_settings_inner_frame) self.curve_settings_scroll.setWidgetResizable(True) self.enable_crosshair_chk.setChecked(False) self.enable_crosshair_chk.clicked.connect( self.handle_enable_crosshair_checkbox_clicked) self.enable_crosshair_chk.clicked.emit(False) self.curves_tab_layout = QHBoxLayout() self.curves_tab_layout.addWidget(self.curve_settings_scroll) self.data_tab_layout = QVBoxLayout() self.data_tab_layout.setAlignment(Qt.AlignTop) self.data_tab_layout.setSpacing(5) self.chart_settings_layout = QVBoxLayout() self.chart_settings_layout.setAlignment(Qt.AlignTop) self.chart_settings_layout.setSpacing(5) self.chart_layout = QVBoxLayout() self.chart_layout.setSpacing(10) self.chart_panel = QWidget() self.chart_panel.setMinimumHeight(400) self.chart_control_layout = QHBoxLayout() self.chart_control_layout.setAlignment(Qt.AlignHCenter) self.chart_control_layout.setSpacing(10) self.zoom_x_layout = QVBoxLayout() self.zoom_x_layout.setAlignment(Qt.AlignTop) self.zoom_x_layout.setSpacing(5) self.plus_icon = IconFont().icon("plus", color=QColor("green")) self.minus_icon = IconFont().icon("minus", color=QColor("red")) self.view_all_icon = IconFont().icon("globe", color=QColor("blue")) self.reset_icon = IconFont().icon("circle-o-notch", color=QColor("green")) self.zoom_in_x_btn = QPushButton("X Zoom") self.zoom_in_x_btn.setIcon(self.plus_icon) self.zoom_in_x_btn.clicked.connect( partial(self.handle_zoom_in_btn_clicked, "x", True)) self.zoom_in_x_btn.setEnabled(False) self.zoom_out_x_btn = QPushButton("X Zoom") self.zoom_out_x_btn.setIcon(self.minus_icon) self.zoom_out_x_btn.clicked.connect( partial(self.handle_zoom_in_btn_clicked, "x", False)) self.zoom_out_x_btn.setEnabled(False) self.zoom_y_layout = QVBoxLayout() self.zoom_y_layout.setAlignment(Qt.AlignTop) self.zoom_y_layout.setSpacing(5) self.zoom_in_y_btn = QPushButton("Y Zoom") self.zoom_in_y_btn.setIcon(self.plus_icon) self.zoom_in_y_btn.clicked.connect( partial(self.handle_zoom_in_btn_clicked, "y", True)) self.zoom_in_y_btn.setEnabled(False) self.zoom_out_y_btn = QPushButton("Y Zoom") self.zoom_out_y_btn.setIcon(self.minus_icon) self.zoom_out_y_btn.clicked.connect( partial(self.handle_zoom_in_btn_clicked, "y", False)) self.zoom_out_y_btn.setEnabled(False) self.view_all_btn = QPushButton("View All") self.view_all_btn.setIcon(self.view_all_icon) self.view_all_btn.clicked.connect(self.handle_view_all_button_clicked) self.view_all_btn.setEnabled(False) self.view_all_reset_chart_layout = QVBoxLayout() self.view_all_reset_chart_layout.setAlignment(Qt.AlignTop) self.view_all_reset_chart_layout.setSpacing(5) self.pause_chart_layout = QVBoxLayout() self.pause_chart_layout.setAlignment(Qt.AlignTop) self.pause_chart_layout.setSpacing(5) self.reset_chart_btn = QPushButton("Reset") self.reset_chart_btn.setIcon(self.reset_icon) self.reset_chart_btn.clicked.connect( self.handle_reset_chart_btn_clicked) self.reset_chart_btn.setEnabled(False) self.pause_icon = IconFont().icon("pause", color=QColor("red")) self.play_icon = IconFont().icon("play", color=QColor("green")) self.pause_chart_btn = QPushButton() self.pause_chart_btn.setIcon(self.pause_icon) self.pause_chart_btn.clicked.connect( self.handle_pause_chart_btn_clicked) self.title_settings_layout = QVBoxLayout() self.title_settings_layout.setAlignment(Qt.AlignTop) self.title_settings_layout.setSpacing(5) self.title_settings_grpbx = QGroupBox("Title and Legend") self.title_settings_grpbx.setMaximumHeight(120) self.import_export_data_layout = QVBoxLayout() self.import_export_data_layout.setAlignment(Qt.AlignTop) self.import_export_data_layout.setSpacing(5) self.import_data_btn = QPushButton("Import...") self.import_data_btn.clicked.connect( self.handle_import_data_btn_clicked) self.export_data_btn = QPushButton("Export...") self.export_data_btn.clicked.connect( self.handle_export_data_btn_clicked) self.chart_title_layout = QHBoxLayout() self.chart_title_layout.setSpacing(10) self.chart_title_lbl = QLabel(text="Graph Title") self.chart_title_line_edt = QLineEdit() self.chart_title_line_edt.setText(self.chart.getPlotTitle()) self.chart_title_line_edt.textChanged.connect( self.handle_title_text_changed) self.chart_title_font_btn = QPushButton() self.chart_title_font_btn.setFixedHeight(24) self.chart_title_font_btn.setFixedWidth(24) self.chart_title_font_btn.setIcon(IconFont().icon("font")) self.chart_title_font_btn.clicked.connect( partial(self.handle_chart_font_changed, "title")) self.chart_change_axis_settings_btn = QPushButton( text="Change Axis Settings...") self.chart_change_axis_settings_btn.clicked.connect( self.handle_change_axis_settings_clicked) self.update_datetime_timer = QTimer(self) self.update_datetime_timer.timeout.connect( self.handle_update_datetime_timer_timeout) self.chart_sync_mode_layout = QVBoxLayout() self.chart_sync_mode_layout.setSpacing(5) self.chart_sync_mode_grpbx = QGroupBox("Data Sampling Mode") self.chart_sync_mode_grpbx.setMaximumHeight(100) self.chart_sync_mode_sync_radio = QRadioButton("Synchronous") self.chart_sync_mode_async_radio = QRadioButton("Asynchronous") self.chart_sync_mode_async_radio.setChecked(True) self.graph_drawing_settings_layout = QVBoxLayout() self.graph_drawing_settings_layout.setAlignment(Qt.AlignVCenter) self.chart_interval_layout = QFormLayout() self.chart_redraw_rate_lbl = QLabel("Redraw Rate (Hz)") self.chart_redraw_rate_spin = QSpinBox() self.chart_redraw_rate_spin.setRange(MIN_REDRAW_RATE_HZ, MAX_REDRAW_RATE_HZ) self.chart_redraw_rate_spin.setValue(DEFAULT_REDRAW_RATE_HZ) self.chart_redraw_rate_spin.editingFinished.connect( self.handle_redraw_rate_changed) self.chart_data_sampling_rate_lbl = QLabel("Data Sampling Rate (Hz)") self.chart_data_async_sampling_rate_spin = QSpinBox() self.chart_data_async_sampling_rate_spin.setRange( MIN_DATA_SAMPLING_RATE_HZ, MAX_DATA_SAMPLING_RATE_HZ) self.chart_data_async_sampling_rate_spin.setValue( DEFAULT_DATA_SAMPLING_RATE_HZ) self.chart_data_async_sampling_rate_spin.editingFinished.connect( self.handle_data_sampling_rate_changed) self.chart_data_sampling_rate_lbl.hide() self.chart_data_async_sampling_rate_spin.hide() self.chart_limit_time_span_layout = QHBoxLayout() self.chart_limit_time_span_layout.setSpacing(5) self.limit_time_plan_text = "Limit Time Span" self.chart_limit_time_span_chk = QCheckBox(self.limit_time_plan_text) self.chart_limit_time_span_chk.hide() self.chart_limit_time_span_lbl = QLabel("Hr:Min:Sec") self.chart_limit_time_span_hours_spin_box = QSpinBox() self.chart_limit_time_span_hours_spin_box.setMaximum(999) self.chart_limit_time_span_minutes_spin_box = QSpinBox() self.chart_limit_time_span_minutes_spin_box.setMaximum(59) self.chart_limit_time_span_seconds_spin_box = QSpinBox() self.chart_limit_time_span_seconds_spin_box.setMaximum(59) self.chart_limit_time_span_activate_btn = QPushButton("Apply") self.chart_limit_time_span_activate_btn.setDisabled(True) self.chart_ring_buffer_layout = QFormLayout() self.chart_ring_buffer_size_lbl = QLabel("Ring Buffer Size") self.chart_ring_buffer_size_edt = QLineEdit() self.chart_ring_buffer_size_edt.returnPressed.connect( self.handle_buffer_size_changed) self.chart_ring_buffer_size_edt.setText(str(DEFAULT_BUFFER_SIZE)) self.show_legend_chk = QCheckBox("Show Legend") self.show_legend_chk.clicked.connect( self.handle_show_legend_checkbox_clicked) self.show_legend_chk.setChecked(self.chart.showLegend) self.legend_font_btn = QPushButton() self.legend_font_btn.setFixedHeight(24) self.legend_font_btn.setFixedWidth(24) self.legend_font_btn.setIcon(IconFont().icon("font")) self.legend_font_btn.clicked.connect( partial(self.handle_chart_font_changed, "legend")) self.graph_background_color_layout = QFormLayout() self.axis_grid_color_layout = QFormLayout() self.background_color_lbl = QLabel("Graph Background Color ") self.background_color_btn = QPushButton() self.background_color_btn.setStyleSheet( "background-color: " + self.chart.getBackgroundColor().name()) self.background_color_btn.setContentsMargins(10, 0, 5, 5) self.background_color_btn.setMaximumWidth(20) self.background_color_btn.clicked.connect( self.handle_background_color_button_clicked) self.axis_settings_layout = QVBoxLayout() self.axis_settings_layout.setSpacing(10) self.show_x_grid_chk = QCheckBox("Show x Grid") self.show_x_grid_chk.setChecked(self.chart.showXGrid) self.show_x_grid_chk.clicked.connect( self.handle_show_x_grid_checkbox_clicked) self.show_y_grid_chk = QCheckBox("Show y Grid") self.show_y_grid_chk.setChecked(self.chart.showYGrid) self.show_y_grid_chk.clicked.connect( self.handle_show_y_grid_checkbox_clicked) self.axis_color_lbl = QLabel("Axis and Grid Color") self.axis_color_btn = QPushButton() self.axis_color_btn.setStyleSheet("background-color: " + DEFAULT_CHART_AXIS_COLOR.name()) self.axis_color_btn.setContentsMargins(10, 0, 5, 5) self.axis_color_btn.setMaximumWidth(20) self.axis_color_btn.clicked.connect( self.handle_axis_color_button_clicked) self.grid_opacity_lbl = QLabel("Grid Opacity") self.grid_opacity_lbl.setEnabled(False) self.grid_opacity_slr = QSlider(Qt.Horizontal) self.grid_opacity_slr.setFocusPolicy(Qt.StrongFocus) self.grid_opacity_slr.setRange(0, 10) self.grid_opacity_slr.setValue(5) self.grid_opacity_slr.setTickInterval(1) self.grid_opacity_slr.setSingleStep(1) self.grid_opacity_slr.setTickPosition(QSlider.TicksBelow) self.grid_opacity_slr.valueChanged.connect( self.handle_grid_opacity_slider_mouse_release) self.grid_opacity_slr.setEnabled(False) self.reset_data_settings_btn = QPushButton("Reset Data Settings") self.reset_data_settings_btn.clicked.connect( self.handle_reset_data_settings_btn_clicked) self.reset_chart_settings_btn = QPushButton("Reset Chart Settings") self.reset_chart_settings_btn.clicked.connect( self.handle_reset_chart_settings_btn_clicked) self.curve_checkbox_panel = QWidget() self.graph_drawing_settings_grpbx = QGroupBox("Graph Intervals") self.graph_drawing_settings_grpbx.setAlignment(Qt.AlignTop) self.axis_settings_grpbx = QGroupBox("Graph Appearance") self.app = QApplication.instance() self.setup_ui() self.curve_settings_disp = None self.axis_settings_disp = None self.chart_data_export_disp = None self.chart_data_import_disp = None self.grid_alpha = 5 self.time_span_limit_hours = None self.time_span_limit_minutes = None self.time_span_limit_seconds = None self.data_sampling_mode = ASYNC_DATA_SAMPLING # If there is an imported config file, let's start TimeChart with the imported configuration data if config_file: importer = SettingsImporter(self) try: importer.import_settings(config_file) except SettingsImporterException: display_message_box( QMessageBox.Critical, "Import Failure", "Cannot import the file '{0}'. Check the log for the error details." .format(config_file)) logger.exception( "Cannot import the file '{0}'.".format(config_file))