1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
# SPDX-FileCopyrightText: 2024 Nicolas Fella <nicolas.fella@gmx.de>
# SPDX-License-Identifier: BSD-2-Clause
import sys
from PySide6 import QtCore
from PySide6 import QtWidgets
from KNotifications import KNotification
class KNotifcationsDemo(QtWidgets.QWidget):
def __init__(self):
super().__init__()
self.layout = QtWidgets.QVBoxLayout(self)
self.button = QtWidgets.QPushButton()
self.button.setText("Push me")
self.button.clicked.connect(self.magic)
self.layout.addWidget(self.button)
@QtCore.Slot()
def magic(self):
noti = KNotification("notification")
noti.setComponentName("plasma_workspace")
noti.setTitle("Hi")
noti.setText("Hello World")
noti.sendEvent()
if __name__ == "__main__":
app = QtWidgets.QApplication([])
widget = KNotifcationsDemo()
widget.show()
sys.exit(app.exec())
|