def __init__(self, parent=None, info=False): QFrame.__init__(self, parent=parent) self.setObjectName('MessageFrame') self.questionid = self.TYPE_INVALID self.text = "" self.data = MessageData(None) self.IMAGES = {1: QPixmap(), 2: QPixmap(':/icons/crystal_clear_question.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 3: QPixmap(':/icons/crystal_clear_launch_file.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 4: QPixmap(":/icons/default_cfg.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 5: QPixmap(":/icons/crystal_clear_nodelet_q.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 6: QPixmap(":/icons/crystal_clear_launch_file_transfer.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 7: QPixmap(":/icons/crystal_clear_question.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 8: QPixmap(":/icons/crystal_clear_no_io.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) } self._new_request = False self.frameui = QFrame() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MessageFrame.ui') loadUi(ui_file, self.frameui) color = QColor(255, 207, 121) self.frameui.setVisible(False) self.frameui.listLabel.setVisible(False) self.frameui.questionOkButton.clicked.connect(self._on_question_ok) self.frameui.questionCancelButton.clicked.connect(self._on_question_cancel) self.frameui.checkBox_dnaa.stateChanged.connect(self._on_checkbox_state_changed) self._ask = 'ask' if info: color = QColor(232, 104, 80) self.frameui.questionCancelButton.setVisible(False) self._ask = 'show' bg_style = "QFrame#questionFame { background-color: %s;}" % color.name() self.frameui.setStyleSheet("%s" % (bg_style)) self._queue = MessageQueue() self._do_not_ask = {}
def _create_log_bar(self): self.log_dock = QDockWidget(self) self.log_dock.setObjectName('LogFrame') self.log_dock.setFeatures(QDockWidget.DockWidgetMovable | QDockWidget.DockWidgetFloatable) self.log_bar = QWidget(self) self.horizontal_layout_log_bar = QHBoxLayout(self.log_bar) self.horizontal_layout_log_bar.setContentsMargins(2, 0, 2, 0) self.horizontal_layout_log_bar.setObjectName("horizontal_layout_log_bar") # add info label self._log_warning_count = 0 self.log_browser = QTextEdit() self.log_browser.setObjectName("log_browser") self.log_browser.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.log_browser.setLineWrapMode(QTextEdit.NoWrap) # self.log_browser.setMaximumHeight(120) color = QColor(255, 255, 235) bg_style = "QTextEdit#log_browser { background-color: %s;}" % color.name() self.log_bar.setStyleSheet("%s" % (bg_style)) self.horizontal_layout_log_bar.addWidget(self.log_browser) # add hide button self.clear_log_button = QPushButton("clear", self) self.clear_log_button.setObjectName("clear_log_button") self.clear_log_button.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Maximum) self.clear_log_button.clicked.connect(self.on_clear_log_button_clicked) self.clear_log_button.setFlat(True) self.horizontal_layout_log_bar.addWidget(self.clear_log_button) self.log_dock.setWidget(self.log_bar) return self.log_dock
def __init__(self, parent=None, info=False): QFrame.__init__(self, parent=parent) self.setObjectName('MessageFrame') self.questionid = self.TYPE_INVALID self.text = "" self.data = MessageData(None) self.IMAGES = {1: QPixmap(), 2: QPixmap(':/icons/crystal_clear_question.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 3: QPixmap(':/icons/crystal_clear_launch_file.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 4: QPixmap(":/icons/default_cfg.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 5: QPixmap(":/icons/crystal_clear_nodelet_q.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 6: QPixmap(":/icons/crystal_clear_question.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 7: QPixmap(":/icons/crystal_clear_launch_file_transfer.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 8: QPixmap(":/icons/crystal_clear_no_io.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) } self._new_request = False self.frameui = QFrame() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'MessageFrame.ui') loadUi(ui_file, self.frameui) color = QColor(255, 207, 121) self.frameui.setVisible(False) self.frameui.scrollArea.setVisible(False) self.frameui.questionOkButton.clicked.connect(self._on_question_ok) self.frameui.questionCancelButton.clicked.connect(self._on_question_cancel) self.frameui.checkBox_dnaa.stateChanged.connect(self._on_checkbox_state_changed) self._ask = 'ask' if info: color = QColor(232, 104, 80) self.frameui.questionCancelButton.setVisible(False) self._ask = 'show' bg_style = "QFrame#questionFame { background-color: %s;}" % color.name() self.frameui.setStyleSheet("%s" % (bg_style)) self._queue = MessageQueue() self._do_not_ask = {}
def add_curve(self, curve_id, curve_name, x, y): color = QColor(self._colors[self._color_index % len(self._colors)]) self._color_index += 1 line = self._canvas.axes.plot([], [], label=curve_name, linewidth=1, picker=5, color=color.name())[0] self._curves[curve_id] = ([], [], line, [None, None]) self.update_values(curve_id, x, y) self._update_legend()
def add_curve(self, curve_id, curve_name, data_x, data_y): data_x = collections.deque(data_x) data_y = collections.deque(data_y) color = QColor(self._colors[self._color_index % len(self._colors)]) self._color_index += 1 plot = self._canvas.axes.plot(data_x, data_y, label=curve_name, linewidth=1, picker=5, color=color.name())[0] self._curves[curve_id] = (data_x, data_y, plot) self._update_legend()
def __init__(self, parent=None, info=False): QFrame.__init__(self, parent=parent) self.setObjectName('MessageFrame') self.questionid = self.TYPE_INVALID self.text = "" self.data = MessageData(None) self.IMAGES = {1: QPixmap(), 2: nm.settings().pixmap('question.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 3: nm.settings().pixmap('crystal_clear_launch_file.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 4: nm.settings().pixmap('default_cfg.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 5: nm.settings().pixmap('crystal_clear_nodelet_q.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 6: nm.settings().pixmap('crystal_clear_launch_file_transfer.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 7: nm.settings().pixmap('crystal_clear_binary.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 8: nm.settings().pixmap('crystal_clear_no_io.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 9: nm.settings().pixmap('crystal_clear_run_zeroconf.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 10: nm.settings().pixmap('sekkyumu_restart.png').scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation) } self._new_request = False self._in_resp_process = False self.ui = QFrame() ui_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ui', 'MessageFrame.ui') loadUi(ui_file, self.ui) color = QColor(255, 207, 121) self.ui.questionOkButton.setIcon(nm.settings().icon('crystal_clear_button_apply.png')) self.ui.questionCancelButton.setIcon(nm.settings().icon('crystal_clear_button_close.png')) self.ui.listLabel.setTextInteractionFlags(Qt.TextSelectableByMouse) self.ui.questionLabel.setTextInteractionFlags(Qt.TextSelectableByMouse) self.ui.setVisible(False) self.ui.listLabel.setVisible(False) self.ui.questionOkButton.clicked.connect(self._on_question_ok) self.ui.questionCancelButton.clicked.connect(self._on_question_cancel) self.ui.checkBox_dnaa.stateChanged.connect(self._on_checkbox_state_changed) self._ask = 'ask' if info: color = QColor(232, 104, 80) self.ui.questionCancelButton.setVisible(False) self._ask = 'show' bg_style = "QFrame#questionFame { background-color: %s;}" % color.name() self.ui.setStyleSheet("%s" % (bg_style)) self._queue = MessageQueue() self._do_not_ask = {}