Advance Wayland and KDE package bring-up
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
# SPDX-FileCopyrightText: 2024 Manuel Alcaraz Zambrano <manuelalcarazzam@gmail.com>
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
set(bindings_library "KNotifications")
|
||||
|
||||
set(wrapped_header ${CMAKE_CURRENT_SOURCE_DIR}/bindings.h)
|
||||
set(typesystem_file ${CMAKE_CURRENT_SOURCE_DIR}/bindings.xml)
|
||||
|
||||
set(generated_sources
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KNotifications/knotifications_module_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KNotifications/knotification_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KNotifications/knotificationaction_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KNotifications/knotificationreplyaction_wrapper.cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/KNotifications/knotifyconfig_wrapper.cpp)
|
||||
|
||||
set(dependencies Qt6::Core Qt6::Gui KF6::Notifications)
|
||||
|
||||
ecm_generate_python_bindings(
|
||||
PACKAGE_NAME ${bindings_library}
|
||||
VERSION ${KF_VERSION}
|
||||
WRAPPED_HEADER ${wrapped_header}
|
||||
TYPESYSTEM ${typesystem_file}
|
||||
GENERATED_SOURCES ${generated_sources}
|
||||
DEPENDENCIES ${dependencies}
|
||||
QT_VERSION ${REQUIRED_QT_VERSION}
|
||||
HOMEPAGE_URL "https://invent.kde.org/frameworks/knotifications"
|
||||
ISSUES_URL "https://bugs.kde.org/describecomponents.cgi?product=frameworks-knotifications"
|
||||
AUTHOR "The KDE Community"
|
||||
README ../README.md
|
||||
)
|
||||
|
||||
target_link_libraries(${bindings_library} PRIVATE KF6Notifications)
|
||||
|
||||
execute_process(COMMAND ${Python_EXECUTABLE} -Esc "import sysconfig; print(sysconfig.get_path('platlib', vars={'platbase': '${CMAKE_INSTALL_PREFIX}', 'base': '${CMAKE_INSTALL_PREFIX}'}))" OUTPUT_VARIABLE sysconfig_output)
|
||||
string(STRIP ${sysconfig_output} PYTHON_INSTALL_DIR)
|
||||
|
||||
install(TARGETS ${bindings_library} LIBRARY DESTINATION "${PYTHON_INSTALL_DIR}")
|
||||
@@ -0,0 +1,8 @@
|
||||
// SPDX-FileCopyrightText: 2024 Manuel Alcaraz Zambrano <manuelalcarazzam@gmail.com>
|
||||
// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <KNotification>
|
||||
#include <KNotificationReplyAction>
|
||||
#include <KNotifyConfig>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<typesystem package="KNotifications">
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2024 Manuel Alcaraz Zambrano <manuelalcarazzam@gmail.com>
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
-->
|
||||
<load-typesystem name="typesystem_gui.xml" generate="no"/>
|
||||
|
||||
<object-type name="KNotification">
|
||||
<enum-type name="NotificationFlag" flags="NotificationFlags" />
|
||||
<enum-type name="StandardEvent" />
|
||||
<enum-type name="Urgency" />
|
||||
</object-type>
|
||||
<object-type name="KNotificationAction" />
|
||||
<namespace-type name="KNotificationPermission" />
|
||||
<object-type name="KNotificationReplyAction">
|
||||
<enum-type name="FallbackBehavior" />
|
||||
</object-type>
|
||||
<object-type name="KNotifyConfig" />
|
||||
|
||||
</typesystem>
|
||||
@@ -0,0 +1,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())
|
||||
Reference in New Issue
Block a user