1

Add toolbar button file template

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
This commit is contained in:
Juraj Oravec 2019-06-13 14:17:17 +02:00
parent 3eee9f43ec
commit 8754a8c37d
No known key found for this signature in database
GPG Key ID: 63ACB65056BC8D07
3 changed files with 91 additions and 0 deletions

49
button/button.py Normal file
View File

@ -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

View File

@ -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

29
button/options.kcfg Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<kcfgfile arg="true"/>
<group name="Toolbar Button">
<entry name="class_name" type="String">
<label>Class name</label>
<default>Button</default>
</entry>
<entry name="button_id" type="String">
<label>Button id</label>
<default></default>
</entry>
<entry name="button_name" type="String">
<label>Button name</label>
<default></default>
</entry>
<entry name="tooltip" type="String">
<label>Tooltip</label>
<default></default>
</entry>
<entry name="icon" type="String">
<label>Icon</label>
<default></default>
</entry>
</group>
</kcfg>