1
kdevelop-python-templates/sidebar/sidebar.py
Juraj Oravec 0b06fe04f2
Add sidebar template
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
2019-06-13 16:05:07 +02:00

47 lines
1.0 KiB
Python

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