blob: 2a13911b620858bcc0b4b1217dc0a1458a53758c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
"""
Part of the tagit module.
A copy of the license is provided with the project.
Author: Matthias Baumgartner, 2022
"""
# kivy imports
from kivy.lang import Builder
import kivy.properties as kp
# inner-module imports
from .tile import Tile
# exports
__all__ = ('Buttons', )
## code ##
# load kv
# NOTE: ButtonDock doesn't need to be imported... why?!
Builder.load_string('''
<Buttons>:
title: 'Actions'
tooltip: 'Some buttons'
# content
slim: False
btns: btns
ButtonDock:
root: root.root
orientation: 'lr-tb'
id: btns
# space between childs
spacing: (5, 0) if root.slim else (30, 5)
# space between ButtonDock and its children
padding: (0, 0) if root.slim else (10, 5)
''')
# classes
class Buttons(Tile):
"""A container for buttons to trigger some action."""
buttons = kp.ListProperty()
def update(self):
if self.visible and len(self.btns.children) == 0:
self.btns.clear_widgets()
self.btns.populate(self.buttons)
## EOF ##
|