1
kdevelop-python-templates/button/button.py

50 lines
983 B
Python
Raw Normal View History

{% 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