From 8754a8c37d9457de9925dd429e01f23a29e0579f Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 13 Jun 2019 14:17:17 +0200 Subject: [PATCH] Add toolbar button file template Signed-off-by: Juraj Oravec --- button/button.py | 49 +++++++++++++++++++++++++++++ button/falkon-python-button.desktop | 13 ++++++++ button/options.kcfg | 29 +++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 button/button.py create mode 100644 button/falkon-python-button.desktop create mode 100644 button/options.kcfg diff --git a/button/button.py b/button/button.py new file mode 100644 index 0000000..03d24fc --- /dev/null +++ b/button/button.py @@ -0,0 +1,49 @@ +{% load kdev_filters %} +{% block license_header %} +{% if license %} +{{ license|lines_prepend:"# " }} +{% endif %} +{% endblock license_header %} + + +import Falkon +import os +from PySide2 import QtGui + + +class {{ class_name }}(Falkon.AbstractButtonInterface): + def __init__(self): + super().__init__() + + + {% if icon %} + self.setIcon(QtGui.QIcon(os.path.join(os.path.dirname(__file__), "{{ icon }}"))) + {% endif %} + self.setTitle("{{ class_name }}") + {% if tooltip %} + self.setToolTip("{{ tooltip }}") + {% endif %} + + + self.clicked.connect(self.onClicked) + + + def id(self): + {% if button_id %} + return "{{ button_id }}" + {% else %} + return "{{ class_name|lower }}" + {% endif %} + + + def name(self): + {% if button_name %} + return "{{ button_name }}" + {% else %} + return "{{ class_name }}" + {% endif %} + + + def onClicked(self, controller): + pass + diff --git a/button/falkon-python-button.desktop b/button/falkon-python-button.desktop new file mode 100644 index 0000000..f28dbe6 --- /dev/null +++ b/button/falkon-python-button.desktop @@ -0,0 +1,13 @@ +[General] +Name=Toolbar button +Comment=Toolbar button class for Falkon webbrowser +Category=Python/Falkon +Language=Python +Type=Other +Files=Implementation +OptionsFile=options.kcfg + +[Implementation] +Name=Implementation +File=button.py +OutputFile={{ class_name }}.py diff --git a/button/options.kcfg b/button/options.kcfg new file mode 100644 index 0000000..07688dd --- /dev/null +++ b/button/options.kcfg @@ -0,0 +1,29 @@ + + + + + + + Button + + + + + + + + + + + + + + + + + + +