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 __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 __init__(self, nodename, masteruri, loggername, level='INFO', parent=None): ''' Creates a new item. ''' QFrame.__init__(self, parent) self.setObjectName("LoggerItem") self.nodename = nodename self.masteruri = masteruri self.loggername = loggername self.current_level = None layout = QHBoxLayout(self) layout.setContentsMargins(1, 1, 1, 1) self.debug = QRadioButton() self.debug.setStyleSheet( "QRadioButton{ background-color: #39B54A;}") # QColor(57, 181, 74) self.debug.toggled.connect(self.toggled_debug) layout.addWidget(self.debug) self.info = QRadioButton() self.info.setStyleSheet("QRadioButton{ background-color: #FFFAFA;}") self.info.toggled.connect(self.toggled_info) layout.addWidget(self.info) self.warn = QRadioButton() self.warn.setStyleSheet( "QRadioButton{ background-color: #FFC706;}") # QColor(255, 199, 6) self.warn.toggled.connect(self.toggled_warn) layout.addWidget(self.warn) self.error = QRadioButton() self.error.setStyleSheet( "QRadioButton{ background-color: #DE382B;}") # QColor(222, 56, 43) self.error.toggled.connect(self.toggled_error) layout.addWidget(self.error) self.fatal = QRadioButton() self.fatal.setStyleSheet("QRadioButton{ background-color: #FF0000;}") self.fatal.toggled.connect(self.toggled_fatal) layout.addWidget(self.fatal) self.label = QLabel(loggername) layout.addWidget(self.label) layout.addStretch() self._callback = None # used to set all logger self.success_signal.connect(self.on_succes_update) self.error_signal.connect(self.on_error_update) self.set_level(level)
def __init__(self, editor, *args): QFrame.__init__(self, *args) self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.edit = editor self.number_bar = self.NumberBar() self.number_bar.set_text_edit(self.edit) hbox = QHBoxLayout(self) hbox.setSpacing(0) # hbox.setMargin(0) # removed: it is not supported by Qt5 hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.installEventFilter(self) self.edit.viewport().installEventFilter(self)
def __init__(self, masteruri, cfg, ns, nodes, parent=None): QFrame.__init__(self, parent) self._masteruri = masteruri self._nodes = {cfg: {ns: nodes}} frame_layout = QVBoxLayout(self) frame_layout.setContentsMargins(0, 0, 0, 0) # create frame for warning label self.warning_frame = warning_frame = QFrame(self) warning_layout = QHBoxLayout(warning_frame) warning_layout.setContentsMargins(0, 0, 0, 0) warning_layout.addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.warning_label = QLabel() icon = nm.settings().icon('crystal_clear_warning.png') self.warning_label.setPixmap(icon.pixmap(QSize(40, 40))) self.warning_label.setToolTip( 'Multiple configuration for same node found!\nA first one will be selected for the start a node!' ) warning_layout.addWidget(self.warning_label) warning_layout.addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) frame_layout.addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) frame_layout.addWidget(warning_frame) # create frame for start/stop buttons buttons_frame = QFrame() buttons_layout = QHBoxLayout(buttons_frame) buttons_layout.setContentsMargins(0, 0, 0, 0) buttons_layout.addItem(QSpacerItem(20, 20)) self.on_button = QPushButton() self.on_button.setFlat(False) self.on_button.setText("On") self.on_button.clicked.connect(self.on_on_clicked) buttons_layout.addWidget(self.on_button) self.off_button = QPushButton() self.off_button.setFlat(True) self.off_button.setText("Off") self.off_button.clicked.connect(self.on_off_clicked) buttons_layout.addWidget(self.off_button) buttons_layout.addItem(QSpacerItem(20, 20)) frame_layout.addWidget(buttons_frame) frame_layout.addItem( QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.warning_frame.setVisible(False)
def __init__(self, parent=None): QFrame.__init__(self, parent=parent) self.setObjectName('MessageFrame') self.questionid = self.QuestionInvalid self.text = "" self.iconid = self.IconEmpty self.data = MessageData(None) self.IMAGES = { 0: QPixmap(), 1: QPixmap(':/icons/crystal_clear_question.png').scaled( self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 2: QPixmap(':/icons/crystal_clear_launch_file.png').scaled( self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 3: QPixmap(":/icons/default_cfg.png").scaled(self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 4: QPixmap(":/icons/crystal_clear_nodelet_q.png").scaled( self.ICON_SIZE, self.ICON_SIZE, Qt.IgnoreAspectRatio, Qt.SmoothTransformation), 5: QPixmap(":/icons/crystal_clear_question.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) self.frameui.setVisible(False) self.frameui.questionOkButton.clicked.connect(self._on_question_ok) self.frameui.questionCancelButton.clicked.connect( self._on_question_cancel)
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 = {}
def __init__(self, masteruri, cfg, ns, nodes, parent=None): QFrame.__init__(self, parent) self._masteruri = masteruri self._nodes = {cfg: {ns: nodes}} frame_layout = QVBoxLayout(self) frame_layout.setContentsMargins(0, 0, 0, 0) # create frame for warning label self.warning_frame = warning_frame = QFrame(self) warning_layout = QHBoxLayout(warning_frame) warning_layout.setContentsMargins(0, 0, 0, 0) warning_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.warning_label = QLabel() icon = QIcon(':/icons/crystal_clear_warning.png') self.warning_label.setPixmap(icon.pixmap(QSize(40, 40))) self.warning_label.setToolTip('Multiple configuration for same node found!\nA first one will be selected for the start a node!') warning_layout.addWidget(self.warning_label) warning_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) frame_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) frame_layout.addWidget(warning_frame) # create frame for start/stop buttons buttons_frame = QFrame() buttons_layout = QHBoxLayout(buttons_frame) buttons_layout.setContentsMargins(0, 0, 0, 0) buttons_layout.addItem(QSpacerItem(20, 20)) self.on_button = QPushButton() self.on_button.setFlat(False) self.on_button.setText("On") self.on_button.clicked.connect(self.on_on_clicked) buttons_layout.addWidget(self.on_button) self.off_button = QPushButton() self.off_button.setFlat(True) self.off_button.setText("Off") self.off_button.clicked.connect(self.on_off_clicked) buttons_layout.addWidget(self.off_button) buttons_layout.addItem(QSpacerItem(20, 20)) frame_layout.addWidget(buttons_frame) frame_layout.addItem(QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.warning_frame.setVisible(False)