예제 #1
0
    def __init__(self, title, level='INFO', msg=None):
        super(MessageWindow, self).__init__()
        set_style_sheet(self, os.path.join(get_css_path(), "dark_style1.qss"))
        self._state = False
        self.vertical_layout = QtWidgets.QVBoxLayout(self)
        self.horizontal_layout_btns = QtWidgets.QHBoxLayout()
        self.label_layout = QtWidgets.QHBoxLayout()

        title_font = QtGui.QFont()
        title_font.setPointSize(11)
        self.title_label = QtWidgets.QLabel()
        self.title_label.setText(title)
        self.title_label.setFont(title_font)

        level_font = QtGui.QFont()
        level_font.setPointSize(11)
        level_font.setBold(True)
        self.level_label = QtWidgets.QLabel()
        self.level_label.setFont(level_font)
        self.level_label.setText(level.upper())
        self.set_lvl_color(self.level_label, level)
        self.label_layout.addWidget(self.title_label)
        self.label_layout.addWidget(self.level_label)

        self.right_btn = QtWidgets.QPushButton()
        self.right_btn.setMinimumHeight(30)
        self.right_btn.setMinimumWidth(100)
        self.right_btn.setText(self.name_btn_right)
        self.right_btn.clicked.connect(self.on_right_btn)

        self.left_btn = QtWidgets.QPushButton()
        self.left_btn.setMinimumHeight(30)
        self.left_btn.setMinimumWidth(100)
        self.left_btn.setText(self.name_btn_left)
        self.left_btn.clicked.connect(self.on_left_btn)

        self.vertical_layout.addLayout(self.label_layout)

        if msg:
            self.text = QtWidgets.QTextEdit()
            self.text.setPlainText(msg)
            self.vertical_layout.addWidget(self.text)
            self.text.setReadOnly(True)

        self.horizontal_layout_btns.addWidget(self.left_btn)
        self.horizontal_layout_btns.addWidget(self.right_btn)

        self.vertical_layout.addLayout(self.horizontal_layout_btns)

        self.resize(100, 10)
        self.exec_()
예제 #2
0
 def __setStyleSheet(self):
     bold_font = QtGui.QFont()
     bold_font.setBold(True)
     self.setFont(bold_font)
예제 #3
0
 def __setFont(self):
     font = QtGui.QFont()
     font.setBold(True)
     self.name_lab.setFont(font)