MCPcopy Create free account
hub / github.com/debuggyo/Exo / button

Method button

ignis/modules/m3components/button.py:15–62  ·  view source on GitHub ↗
(
        icon: str = None,
        label: str = None,
        on_click=None,
        type="tonal",
        size="s",
        shape="round",
        css_classes: list = None,
        ialign: str = "center",
        vertical: bool = False,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

13
14 @staticmethod
15 def button(
16 icon: str = None,
17 label: str = None,
18 on_click=None,
19 type="tonal",
20 size="s",
21 shape="round",
22 css_classes: list = None,
23 ialign: str = "center",
24 vertical: bool = False,
25 **kwargs,
26 ):
27 if on_click is None:
28 on_click = lambda *_: None
29
30 classes = ["m3-button", type, size, shape]
31 if css_classes:
32 classes.extend(css_classes)
33
34 children = []
35 if icon:
36 children.append(
37 widgets.Label(
38 label=icon,
39 css_classes=["m3-button-icon"],
40 halign="center",
41 hexpand=False,
42 )
43 )
44 if not label:
45 classes.append("icon-only")
46 if label:
47 children.append(widgets.Label(label=label, css_classes=["m3-button-label"]))
48
49 gap = {"xs": 8, "s": 8, "m": 8, "l": 12, "xl": 16}.get(size, 8)
50
51 return Button(
52 css_classes=classes,
53 on_click=on_click,
54 child=widgets.Box(
55 vertical=vertical,
56 spacing=gap,
57 child=children,
58 halign=ialign,
59 valign="center",
60 ),
61 **kwargs,
62 )
63
64 @staticmethod
65 def connected_group(child, **kwargs):

Callers 10

__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
make_toggle_buttonsFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 1

ButtonClass · 0.85

Tested by 1

__init__Method · 0.64