19from PySide6
import QtCore, QtGui, QtWidgets
20from hellopython
import sidebar, button
21from hellopython.i18n
import i18n
26 def init(self, state, settingsPath):
27 print(
"{} {}".format(state, settingsPath))
29 plugins = Falkon.MainApplication.instance().plugins()
30 plugins.registerAppEventHandler(Falkon.PluginProxy.MousePressHandler, self)
36 Falkon.SideBarManager.addSidebar(
"hellopython-sidebar", self.
sidebar)
39 Falkon.MainApplication.instance().networkManager().registerExtensionSchemeHandler(
"hello", self.
schemeHandler)
41 if state == Falkon.PluginInterface.LateInitState:
42 for window
in Falkon.MainApplication.instance().windows():
48 Falkon.SideBarManager.removeSidebar(self.
sidebar)
50 for window
in Falkon.MainApplication.instance().windows():
60 if not r.imageUrl().isEmpty():
63 if not r.linkUrl().isEmpty():
66 if r.isContentEditable():
69 menu.addAction(
i18n(
"My first plugin action") + title, self.
actionSlot)
72 print(
"mousePress {} {} {}".format(type, obj, event))
76 QtWidgets.QMessageBox.information(self.
view,
i18n(
"Hello"),
i18n(
"First plugin action works :-)"))
80 b = QtWidgets.QPushButton(
"Hello Python v0.0.1")
81 closeButton = QtWidgets.QPushButton(
i18n(
"Close"))
82 label = QtWidgets.QLabel()
83 label.setPixmap(QtGui.QPixmap(
":icons/other/about.svg"))
85 l = QtWidgets.QVBoxLayout(self.
settings)
88 l.addWidget(closeButton)
90 self.
settings.setAttribute(QtCore.Qt.WA_DeleteOnClose)
91 self.
settings.setWindowTitle(
i18n(
"Hello Python Settings"))
92 self.
settings.setWindowIcon(QtGui.QIcon(
":icons/falkon.svg"))
93 closeButton.clicked.connect(self.
settings.close)
99 window.statusBar().addButton(b)
100 window.navigationBar().addToolButton(b)
104 if not window
in self.
buttons:
return
106 window.statusBar().removeButton(b)
107 window.navigationBar().removeToolButton(b)
114 print(
"req {}".format(job.requestUrl()))
115 self.setReply(job,
"text/html",
"<h1>TEST</h1>{}".format(job.requestUrl()))
def populateWebViewMenu(self, menu, view, r)
def mainWindowDeleted(self, window)
def showSettings(self, parent)
def init(self, state, settingsPath)
def mainWindowCreated(self, window)
def mousePress(self, type, obj, event)
def requestStarted(self, job)