1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 09:42:10 +02:00

PyFalkon: Fix build with latest PySide2

Add support for scheme handlers as PySide2 added QtWebEngineCore module.
This commit is contained in:
David Rosca 2018-04-29 20:17:45 +02:00
parent 61beda4fa2
commit d1fad353d0
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 14 additions and 4 deletions

View File

@ -126,6 +126,8 @@ set(GENERATED_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/wheelhelper_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/menu_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/action_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/urlinterceptor_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/extensionschemehandler_wrapper.cpp
)
set(GENERATED_SOURCES_DEPENDENCIES
${GLOBAL_HEADER}
@ -148,6 +150,7 @@ foreach(INCLUDE_DIR ${PYSIDE_INCLUDE_DIR})
list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtNetwork")
list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWidgets")
list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWebChannel")
list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWebEngineCore")
list(APPEND PYSIDE_ADDITIONAL_INCLUDES "${INCLUDE_DIR}/QtWebEngineWidgets")
endforeach()

View File

@ -62,8 +62,8 @@
// network
#include "networkmanager.h"
//#include "urlinterceptor.h"
//#include "schemehandlers/extensionschemehandler.h"
#include "urlinterceptor.h"
#include "schemehandlers/extensionschemehandler.h"
// notifications
#include "desktopnotificationsfactory.h"

View File

@ -1,5 +1,6 @@
<?xml version="1.0"?>
<typesystem package="PyFalkon">
<load-typesystem name="typesystem_webenginecore.xml" generate="no"/>
<load-typesystem name="typesystem_webenginewidgets.xml" generate="no"/>
<inject-code class="native" position="beginning">
@ -114,12 +115,10 @@
<object-type name="NavigationBar"/>
<object-type name="NetworkManager"/>
<!-- FIXME: Missing QWebEngineUrlRequest{Info,Job} in PySide
<object-type name="UrlInterceptor"/>
<object-type name="ExtensionSchemeHandler">
<include file-name="schemehandlers/extensionschemehandler.h" location="global"/>
</object-type>
-->
<object-type name="SearchEnginesDialog"/>
<object-type name="SearchEnginesManager">

View File

@ -35,6 +35,9 @@ class HelloPlugin(Falkon.PluginInterface, QtCore.QObject):
self.sidebar = sidebar.HelloSidebar()
Falkon.SideBarManager.addSidebar("hellopython-sidebar", self.sidebar)
self.schemeHandler = HelloSchemeHandler()
Falkon.MainApplication.instance().networkManager().registerExtensionSchemeHandler("hello", self.schemeHandler)
if state == Falkon.PluginInterface.LateInitState:
for window in Falkon.MainApplication.instance().windows():
self.mainWindowCreated(window)
@ -105,3 +108,8 @@ class HelloPlugin(Falkon.PluginInterface, QtCore.QObject):
del self.buttons[window]
Falkon.registerPlugin(HelloPlugin())
class HelloSchemeHandler(Falkon.ExtensionSchemeHandler):
def requestStarted(self, job):
print("req {}".format(job.requestUrl()))
self.setReply(job, "text/html", "<h1>TEST</h1>{}".format(job.requestUrl()))