1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01: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 3787a606d3
commit c71ca333e8
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
4 changed files with 14 additions and 4 deletions

View File

@ -122,6 +122,8 @@ set(GENERATED_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/sqldatabase_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/toolbutton_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/wheelhelper_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/urlinterceptor_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/PyFalkon/extensionschemehandler_wrapper.cpp
)
set(GENERATED_SOURCES_DEPENDENCIES
${GLOBAL_HEADER}
@ -144,6 +146,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

@ -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">
@ -113,12 +114,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

@ -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

@ -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()))