Last active
May 10, 2019 20:47
-
-
Save DefaultUser/4af066d2c6638ec1e602ea5fdb4656c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Falkon | |
from PySide2 import QtCore | |
from PySide2 import QtWebEngineCore | |
class BlockmatrixInterceptor(Falkon.UrlInterceptor): | |
def interceptRequest(self, info): | |
print(info.requestUrl()) | |
return | |
#return False | |
#if info.resourceType() != QtWebEngineCore.QWebEngineUrlRequestInfo.ResourceTypeMainFrame: | |
# info.block(True) | |
class BlockmatrixPlugin(Falkon.PluginInterface, QtCore.QObject): | |
def init(self, state, settingsPath): | |
print(f"loading BlockmatrixPlugin {state} {settingsPath}") | |
self.interceptor = BlockmatrixInterceptor(self) | |
Falkon.MainApplication.instance().networkManager().installUrlInterceptor(self.interceptor) | |
def testPlugin(self): | |
return True | |
# def acceptNavigationRequest(self, page, url, navtype, isMainFrame): | |
# print(f"BlockmatrixPlugin nav request: {page}, {url}, {navtype}, {isMainFrame}") | |
# if isMainFrame: | |
# return True | |
# return False | |
def unload(self): | |
print("unloading BlockmatrixPlugin") | |
Falkon.registerPlugin(BlockmatrixPlugin()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment