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

47 lines
1.0 KiB
Python
Raw Normal View History

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