-
Notifications
You must be signed in to change notification settings - Fork 362
Expand file tree
/
Copy pathlayout_basics.py
More file actions
52 lines (38 loc) · 1.44 KB
/
Copy pathlayout_basics.py
File metadata and controls
52 lines (38 loc) · 1.44 KB
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
51
52
# SPDX-FileCopyrightText: 2025 LichtFeld Studio Authors
# SPDX-License-Identifier: GPL-3.0-or-later
"""Basic layout composition with row, column, box, and split."""
import lichtfeld as lf
class LayoutBasicsPanel(lf.ui.Panel):
label = "Layout Basics"
space = lf.ui.PanelSpace.MAIN_PANEL_TAB
order = 300
def __init__(self):
self.opacity = 1.0
self.threshold = 0.5
self.name = "Untitled"
self.is_active = True
def draw(self, ui):
with ui.row() as row:
row.button("Action A")
row.button("Action B")
row.button("Action C")
with ui.box() as box:
box.heading("Settings")
changed, self.opacity = box.slider_float("Opacity", self.opacity, 0.0, 1.0)
changed, self.threshold = box.slider_float("Threshold", self.threshold, 0.0, 1.0)
with ui.split(0.3) as split:
split.label("Name")
changed, self.name = split.input_text("##name", self.name)
with ui.column() as col:
col.enabled = self.is_active
changed, self.opacity = col.slider_float("Opacity##col", self.opacity, 0.0, 1.0)
with col.row() as row:
row.button("Apply")
row.button("Cancel")
_classes = [LayoutBasicsPanel]
def on_load():
for cls in _classes:
lf.register_class(cls)
def on_unload():
for cls in reversed(_classes):
lf.unregister_class(cls)