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 +