From 0b06fe04f2aa613decaa14cf4e1648fd2ac6f50d Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 13 Jun 2019 16:05:07 +0200 Subject: [PATCH] Add sidebar template Signed-off-by: Juraj Oravec --- sidebar/falkon-python-sidebar.desktop | 13 ++++++++ sidebar/options.kcfg | 21 ++++++++++++ sidebar/sidebar.py | 46 +++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 sidebar/falkon-python-sidebar.desktop create mode 100644 sidebar/options.kcfg create mode 100644 sidebar/sidebar.py diff --git a/sidebar/falkon-python-sidebar.desktop b/sidebar/falkon-python-sidebar.desktop new file mode 100644 index 0000000..91a0108 --- /dev/null +++ b/sidebar/falkon-python-sidebar.desktop @@ -0,0 +1,13 @@ +[General] +Name=Sidebar +Comment=Sidebar class for Falkon webbrowser +Category=Python/Falkon +Language=Python +Type=Other +Files=Implementation +OptionsFile=options.kcfg + +[Implementation] +Name=Implementation +File=sidebar.py +OutputFile={{ class_name }}.py diff --git a/sidebar/options.kcfg b/sidebar/options.kcfg new file mode 100644 index 0000000..d23b403 --- /dev/null +++ b/sidebar/options.kcfg @@ -0,0 +1,21 @@ + + + + + + + Sidebar + + + + + + + + + + + diff --git a/sidebar/sidebar.py b/sidebar/sidebar.py new file mode 100644 index 0000000..4e3a195 --- /dev/null +++ b/sidebar/sidebar.py @@ -0,0 +1,46 @@ +{% load kdev_filters %} +{% block license_header %} +{% if license %} +{{ license|lines_prepend:"# " }} +{% endif %} +{% endblock license_header %} + + +import Falkon +from PySide2 import QtGui, QtWidgets + + +class {{ class_name }}(Falkon.SideBarInterface): + def title(self): + {% if title %} + return "{{ title }}" + {% else %} + return "{{ class_name }}" + {% endif %} + + + def createMenuAction(self): + {% if title %} + action = Falkon.Action("{{ title }}") + {% else %} + action = Falkon.Action("{{ class_name }}") + {% endif %} + action.setCheckable(True) + {% if shortcut %} + action.setShortcut(QtGui.QKeySequence("{{ shortcut }}")) + {% endif %} + + + return action + + + def createSideBarWidget(self, window): + widget = QtWidgets.QWidget() + button = QtWidgets.QPushButton("Button in sidebar") + layout = QtWidgets.QVBoxLayout(widget) + layout.addWidget(button) + widget.setLayout(layout) + + + return widget +