File: notification.py

package info (click to toggle)
kf6-knotifications 6.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,816 kB
  • sloc: cpp: 3,180; java: 309; xml: 122; python: 24; sh: 14; makefile: 7; ansic: 4
file content (37 lines) | stat: -rw-r--r-- 913 bytes parent folder | download | duplicates (2)
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())