def __init__(self, icon: str, parent=None, f=Qt.Dialog | Qt.FramelessWindowHint):
super(Notification, self).__init__(parent, f)
self.parent = parent
self.theme = self.parent.theme
self.setObjectName('notification')
self.setContentsMargins(10, 10, 10, 10)
self.shown.connect(lambda: QTimer.singleShot(self.duration * 1000, self.fadeOut))
self.setWindowModality(Qt.ApplicationModal)
self.setMinimumWidth(550)
self._title, self._message = '', ''
self.buttons = []
self.msgLabel = QLabel(self._message, self)
self.msgLabel.setWordWrap(True)
logo_label = QLabel('<img src="{}" width="82" />'.format(icon), self)
logo_label.setFixedSize(82, 82)
self.left_layout = QVBoxLayout()
self.left_layout.addWidget(logo_label)
layout = QHBoxLayout()
layout.addStretch(1)
layout.addLayout(self.left_layout)
layout.addSpacing(10)
layout.addWidget(self.msgLabel, Qt.AlignVCenter)
layout.addStretch(1)
self.setLayout(layout)
评论列表
文章目录