Skip to content

Commit 3e83080

Browse files
TinyuZhaolbuque
authored andcommitted
libs/m5ui: Add LVGL TabView widget docs and example.
Signed-off-by: tinyu <[email protected]>
1 parent d73eea4 commit 3e83080

File tree

8 files changed

+364
-20
lines changed

8 files changed

+364
-20
lines changed

docs/en/m5ui/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ Classes
8181
spinbox.rst
8282
spinner.rst
8383
switch.rst
84+
tabview.rst
8485
textarea.rst
8586
win.rst

docs/en/m5ui/tabview.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. currentmodule:: m5ui
2+
3+
M5TabView
4+
==========
5+
6+
.. include:: ../refs/m5ui.tabview.ref
7+
8+
M5TabView is a widget that can be used to create tabbed views in the user interface.
9+
10+
UiFlow2 Example
11+
---------------
12+
13+
tabview basic
14+
^^^^^^^^^^^^^^
15+
16+
Open the |tabview_cores3_example.m5f2| project in UiFlow2.
17+
18+
This example creates a tabview.
19+
20+
UiFlow2 Code Block:
21+
22+
|example.png|
23+
24+
Example output:
25+
26+
None
27+
28+
MicroPython Example
29+
-------------------
30+
31+
tabview basic
32+
^^^^^^^^^^^^^^
33+
34+
This example creates a tabview.
35+
36+
MicroPython Code Block:
37+
38+
.. literalinclude:: ../../../examples/m5ui/tabview/tabview_cores3_example.py
39+
:language: python
40+
:linenos:
41+
42+
Example output:
43+
44+
None
45+
46+
47+
**API**
48+
-------
49+
M5TabView
50+
^^^^^^^^^^
51+
52+
.. autoclass:: m5ui.tabview.M5TabView
53+
:members:
54+
55+
M5Label can be used in TabView. For specific usage, please refer to :ref:`m5ui.M5Label <m5ui.M5Label>` Documentation.
56+

docs/en/refs/m5ui.tabview.ref

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.. |add_tab.png| image:: https://static-cdn.m5stack.com/mpy_docs/m5ui/tabview/align_to.png
2+
.. |rename_tab.png| image:: https://static-cdn.m5stack.com/mpy_docs/m5ui/tabview/rename_tab.png
3+
.. |example.png| image:: https://static-cdn.m5stack.com/mpy_docs/m5ui/tabview/example.png
4+
5+
6+
.. |tabview_cores3_example.m5f2| raw:: html
7+
8+
<a
9+
href="https://uiflow2.m5stack.com/?example=https://raw.githubusercontent.com/m5stack/uiflow-micropython/develop/examples/m5ui/tabview/tabview_cores3_example.m5f2"
10+
target="_blank"
11+
>
12+
tabview_cores3_example.m5f2
13+
</a>
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) 2016 - 2025 M5Stack Technology Co., Ltd
3+
# This file is distributed under the same license as the UIFlow2 Programming
4+
# Guide package.
5+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2025.
6+
#
7+
#, fuzzy
8+
msgid ""
9+
msgstr ""
10+
"Project-Id-Version: UIFlow2 Programming Guide \n"
11+
"Report-Msgid-Bugs-To: \n"
12+
"POT-Creation-Date: 2025-10-21 14:17+0800\n"
13+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15+
"Language: zh_CN\n"
16+
"Language-Team: zh_CN <[email protected]>\n"
17+
"Plural-Forms: nplurals=1; plural=0;\n"
18+
"MIME-Version: 1.0\n"
19+
"Content-Type: text/plain; charset=utf-8\n"
20+
"Content-Transfer-Encoding: 8bit\n"
21+
"Generated-By: Babel 2.16.0\n"
22+
23+
#: ../../en/m5ui/tabview.rst:4 ../../en/m5ui/tabview.rst:50
24+
#: f8aaff8085724c9cbe38eb7e28b6bcec fe3084a33f924e60a4cd8322cac89cdb
25+
msgid "M5TabView"
26+
msgstr "M5TabView"
27+
28+
#: ../../en/m5ui/tabview.rst:8 39d39083f595411f9a44e1ae197a57c6
29+
msgid ""
30+
"M5TabView is a widget that can be used to create tabbed views in the user"
31+
" interface."
32+
msgstr "M5TabView 是一个可用于在用户界面中创建选项卡视图的组件。"
33+
34+
#: ../../en/m5ui/tabview.rst:11 4ccf4866659847b2aba9803b87b1a964
35+
msgid "UiFlow2 Example"
36+
msgstr "UiFlow2 示例"
37+
38+
#: ../../en/m5ui/tabview.rst:14 ../../en/m5ui/tabview.rst:32
39+
#: 009cef26e9a5400b8a3b7f898b251576 47e3fcbe8a584d49a6c664f6898a84b3
40+
msgid "tabview basic"
41+
msgstr "标签视图基础"
42+
43+
#: ../../en/m5ui/tabview.rst:16 1a555f20b14d4a0bb89e4686d160f67c
44+
msgid "Open the |tabview_cores3_example.m5f2| project in UiFlow2."
45+
msgstr "在 UiFlow2 中打开 |tabview_cores3_example.m5f2| 项目。"
46+
47+
#: ../../en/m5ui/tabview.rst:18 ../../en/m5ui/tabview.rst:34
48+
#: 47db8d11a0ea4a9a99a093534575830c e9a5c5bbc13b447b851246c8eea96d48
49+
msgid "This example creates a tabview."
50+
msgstr "本示例创建了一个标签视图。"
51+
52+
#: ../../en/m5ui/tabview.rst:20 6d697ff939dd4df8bbec838efe515b07
53+
#: 86a41203a50b4841bec2cc29731ef9b4 bcca9ebf7787411188de5aa958e797f9
54+
#: cea791fe5b3340aab0f19cfbb63e38f3 m5ui.tabview.M5TabView:11
55+
#: m5ui.tabview.M5TabView.add_tab:6 m5ui.tabview.M5TabView.rename_tab:6 of
56+
msgid "UiFlow2 Code Block:"
57+
msgstr "UiFlow2 代码块:"
58+
59+
#: ../../en/m5ui/tabview.rst:22 5b843d1635bc435eb74f41d614904016
60+
msgid "|tabview_cores3_example.png|"
61+
msgstr ""
62+
63+
#: ../../en/m5ui/tabview.rst:24 ../../en/m5ui/tabview.rst:42
64+
#: 36d577315fb94d45841a615b54e9aff2 8b4f40a95a4142778ae289baef6cd47e
65+
msgid "Example output:"
66+
msgstr "示例输出:"
67+
68+
#: ../../en/m5ui/tabview.rst:26 ../../en/m5ui/tabview.rst:44
69+
#: 39e3a309d0b34e39b9959d99bc757dd6 3b6fd4edffca4d84be144d79aa3bc8b4
70+
#: 85ffaa4297934a3ea869525098f20328 m5ui.tabview.M5TabView:13 of
71+
msgid "None"
72+
msgstr ""
73+
74+
#: ../../en/m5ui/tabview.rst:29 8b45204efe6f440ba10444395978f4d5
75+
msgid "MicroPython Example"
76+
msgstr "MicroPython 示例"
77+
78+
#: ../../en/m5ui/tabview.rst:36 3681ae5c4fa049ff8d43bcb0c403fa2d
79+
#: a0faacfccd6f459e82666482c393465b c3ac910e1c494b128b3f8c9e069ef9ba
80+
#: c765971ae4544e16adef3a9a0aa542ad m5ui.tabview.M5TabView:15
81+
#: m5ui.tabview.M5TabView.add_tab:10 m5ui.tabview.M5TabView.rename_tab:10 of
82+
msgid "MicroPython Code Block:"
83+
msgstr "MicroPython 代码块:"
84+
85+
#: ../../en/m5ui/tabview.rst:48 cf958ae7984a418f85ed01077c8e22df
86+
msgid "**API**"
87+
msgstr ""
88+
89+
#: 2f333ccfae6e4d508551ad5405414083 m5ui.tabview.M5TabView:1 of
90+
msgid "Bases: :py:class:`~lvgl.tabview`"
91+
msgstr ""
92+
93+
#: 8b5f2ea1833e49af8c62cfb1fe156990 m5ui.tabview.M5TabView:1 of
94+
msgid "Create a TabView object."
95+
msgstr "创建一个标签页视图对象。"
96+
97+
#: ../../en/m5ui/tabview.rst 250f97edf0e449a3b635e41e17d4d4e2
98+
#: 444f50f5219541dca4e838f6470d25e8 9ab25bd18dfb4504895db06fc17dc610
99+
#: m5ui.tabview.M5TabView.add_tab m5ui.tabview.M5TabView.rename_tab of
100+
msgid "Parameters"
101+
msgstr "参数"
102+
103+
#: 5d5165905eca4946a82e4146c7ab8d96 m5ui.tabview.M5TabView:3 of
104+
msgid "The x position of the tab view."
105+
msgstr "标签视图的 x 坐标位置。"
106+
107+
#: aa2da75a65e0493fbcb510cccf14bdbc m5ui.tabview.M5TabView:4 of
108+
msgid "The y position of the tab view."
109+
msgstr "标签视图的 y 坐标位置。"
110+
111+
#: d7780f94c42a464792052e0ac168a256 m5ui.tabview.M5TabView:5 of
112+
msgid "The width of the tab view."
113+
msgstr "标签视图的宽度。"
114+
115+
#: c73ed2ef2b374fdf805e39e948bc7eb9 m5ui.tabview.M5TabView:6 of
116+
msgid "The height of the tab view."
117+
msgstr "标签视图的高度。"
118+
119+
#: 44cafac5ab6740acb24187e667551d77 m5ui.tabview.M5TabView:7 of
120+
msgid "The size of the tab bar."
121+
msgstr "标签栏的大小。"
122+
123+
#: 88abacbe24c247f0bc21f061d08565f0 m5ui.tabview.M5TabView:8 of
124+
msgid "The position of the tab bar."
125+
msgstr "标签栏的位置。"
126+
127+
#: 04ce0b2a8012408e89ab64a5d64650ad m5ui.tabview.M5TabView:9 of
128+
msgid ""
129+
"The parent object to attach the tab view to. If not specified, the tab "
130+
"view will be attached to the default screen."
131+
msgstr "要附加标签视图的父对象。如果未指定,标签视图将附加到默认屏幕。"
132+
133+
#: ace90a0df9b64d72acdf5c6ecef556d0 m5ui.tabview.M5TabView.add_tab:1 of
134+
msgid "Add a tab to the tab view."
135+
msgstr "向标签视图添加一个标签页。"
136+
137+
#: 6517d9755d2c4850885b480280136ad7 m5ui.tabview.M5TabView.add_tab:3 of
138+
msgid "The text to display on the tab."
139+
msgstr "标签页上要显示的文本。"
140+
141+
#: 52a2c484e38c45c0b224459c197802ac 8c99ea63ddc24ee4ac1834098839855c
142+
#: m5ui.tabview.M5TabView.add_tab m5ui.tabview.M5TabView.rename_tab of
143+
msgid "Return type"
144+
msgstr "返回类型"
145+
146+
#: c0739e0ff1d2424187f0d7deff296f9a m5ui.tabview.M5TabView.add_tab:8 of
147+
msgid "|add_tab.png|"
148+
msgstr ""
149+
150+
#: ../../en/refs/m5ui.tabview.ref:1 4e37763c5a7c4f9f87a997d00bffbaf2
151+
msgid "add_tab.png"
152+
msgstr ""
153+
154+
#: 7c9b54eb99004eec8bf9a27495b42ff6 m5ui.tabview.M5TabView.rename_tab:1 of
155+
msgid "Rename a tab in the tab view."
156+
msgstr "重命名标签视图中的标签。"
157+
158+
#: b1cbc60b595f4af29df0b6dc8efbd3ab m5ui.tabview.M5TabView.rename_tab:3 of
159+
msgid "The position of the tab to rename."
160+
msgstr "要重命名的标签页位置。"
161+
162+
#: 3f65f35ad0ba4dc9a10d194b1e86f198 m5ui.tabview.M5TabView.rename_tab:4 of
163+
msgid "The new text for the tab."
164+
msgstr "标签页的新文本。"
165+
166+
#: 5148ed7a179f4353a0f80c232275875a m5ui.tabview.M5TabView.rename_tab:8 of
167+
msgid "|rename_tab.png|"
168+
msgstr ""
169+
170+
#: ../../en/m5ui/tabview.rst:55 b43c8a04903d4255bb27c60588f67f63
171+
msgid ""
172+
"M5Label can be used in TabView. For specific usage, please refer to "
173+
":ref:`m5ui.M5Label <m5ui.M5Label>` Documentation."
174+
msgstr "M5Label 可以在 TabView 中使用。具体用法请参考 :ref:`m5ui.M5Label <m5ui.M5Label>` 文档。"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":"V2.0","versionNumber":"V2.3.6","type":"cores3","components":[{"name":"page0","type":"lvgl_page","layer":0,"screenId":"builtin","screenName":"","id":"r-BHP^g`T&%lk=qH","createTime":1761016547845,"backgroundColor":"#ffffff","isLVGL":true,"isSelected":true},{"name":"tabview0","type":"lvgl_tabview","layer":1,"screenId":"builtin","screenName":"","id":"yESq1C90N20T*65E","createTime":1761016552099,"x":0,"y":-2,"width":320,"height":240,"barSize":60,"mode":"TOP","modeOption":[{"label":"Top","value":"TOP"},{"label":"Bottom","value":"BOTTOM"},{"label":"Left","value":"LEFT"},{"label":"Right","value":"RIGHT"}],"tabList":[{"type":"tab","name":"Tab1","value":"Tab1"},{"type":"tab","name":"Tab2","value":"Tab2"}],"labelList":[{"type":"label","name":"label1","value":"This is label1","x":0,"y":0,"parent":"Tab1"}],"isInit":false,"pageId":"r-BHP^g`T&%lk=qH","isLVGL":true,"isSelected":false}],"resources":[{"hardware":["hardware_button","hardware_pin_button","imu","speaker","touch","als","mic","sdcard"]}],"units":[],"hats":[],"caps":[],"bases":[],"i2cs":[],"blockly":"<block type=\"basic_on_setup\" id=\"setup_block\" deletable=\"false\" x=\"50\" y=\"50\"><mutation isBegin=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_begin\" id=\"bVC9G2igzIy-A?Fb+$)(\"><next><block type=\"lvgl_page_screen_load\" id=\"zE/[{l?.173wifCPOv*B\"><field name=\"NAME\">page0</field><next><block type=\"lvgl_tabview_add_label2\" id=\"ZD0H?FFta/%!G`HVa8Y5\"><mutation parentId=\"yESq1C90N20T*65E\"></mutation><field name=\"NAME\">tabview0</field><field name=\"VARNAME\">label2</field><field name=\"FONT\">lv.font_montserrat_24</field><field name=\"TAB\">Tab1</field><value name=\"VALUE\"><shadow type=\"text\" id=\"(O+.AHAn{bu@D_|cbcEi\"><field name=\"TEXT\">Hello World</field></shadow></value><value name=\"X\"><shadow type=\"math_number\" id=\"X;03rFvJ`3Mw`jWpO@lY\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><value name=\"Y\"><shadow type=\"math_number\" id=\"Q-_rC?C5TFEZ0{2UbS:W\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><value name=\"COLOR1\"><block type=\"color_rgb_palette\" id=\"#ed}YE|86=bdzn+,^QoL\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#ffcc00</field></block></value><value name=\"COLOR2\"><block type=\"lvgl_tabview_config_color\" id=\"O}:Y7cA4.O+7Z.B[z}RA\" deletable=\"false\" movable=\"false\"><value name=\"COLOR\"><block type=\"color_rgb_palette\" id=\"5#zqsW~:Wb9$Wprrff@h\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#99ff99</field></block></value><value name=\"OPA\"><shadow type=\"math_slider\" id=\"+iv{;?5+JzItRc`Z-CF8\"><mutation max=\"255\" min=\"0\" step=\"10\" precision=\"1\"></mutation><field name=\"NUM\">255</field></shadow></value></block></value><next><block type=\"lvgl_tabview_add_label\" id=\"n$%#?%!%6NX(7N(Q(g[8\"><mutation parentId=\"yESq1C90N20T*65E\"></mutation><field name=\"NAME\">tabview0</field><field name=\"VARNAME\">label3</field><field name=\"TAB\">Tab2</field><value name=\"VALUE\"><shadow type=\"text\" id=\"?IcS_vUwaA$33C8m*6Q+\"><field name=\"TEXT\">hello M5</field></shadow></value><value name=\"X\"><shadow type=\"math_number\" id=\"ahSlB,B?q+?G6*^P/ui|\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><value name=\"Y\"><shadow type=\"math_number\" id=\"A[m_7?5`[email protected](aMq-\"><mutation max=\"Infinity\" min=\"-Infinity\" precision=\"0\"></mutation><field name=\"NUM\">0</field></shadow></value><next><block type=\"lvgl_tabview_label_set_font\" id=\"O#Y%Oz7{9VmhDUcuB#QH\"><mutation parentId=\"yESq1C90N20T*65E\"></mutation><field name=\"NAME\">tabview0</field><field name=\"VARNAME\">label3</field><field name=\"OPTION\">lv.font_montserrat_24</field><next><block type=\"lvgl_tabview_label_set_text_color\" id=\"~[H6PpUr0[0qOs;saDd|\"><mutation parentId=\"yESq1C90N20T*65E\"></mutation><field name=\"NAME\">tabview0</field><field name=\"VARNAME\">label3</field><value name=\"COLOR\"><block type=\"color_rgb_palette\" id=\"B;t7uX1]9FqfAU%hp8h_\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#6600cc</field></block></value><value name=\"OPA\"><shadow type=\"math_slider\" id=\"_.5}ON/^wio4;j^QwjI?\"><mutation max=\"255\" min=\"0\" step=\"10\" precision=\"1\"></mutation><field name=\"NUM\">255</field></shadow></value><next><block type=\"lvgl_tabview_label_set_bg_color\" id=\"cLt=GRMeKWSH8L1xvS1h\"><mutation parentId=\"yESq1C90N20T*65E\"></mutation><field name=\"NAME\">tabview0</field><field name=\"VARNAME\">label3</field><value name=\"COLOR\"><block type=\"color_rgb_palette\" id=\"iE=0p1-H?qWRF#pXg/EF\"><mutation mode=\"palette\"></mutation><field name=\"MODE\">palette</field><field name=\"COLOR\">#33ff33</field></block></value><value name=\"OPA\"><shadow type=\"math_slider\" id=\"9OJ%;OduEZs~.f~7/mpb\"><mutation max=\"255\" min=\"0\" step=\"10\" precision=\"1\"></mutation><field name=\"NUM\">255</field></shadow></value></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type=\"basic_on_loop\" id=\"loop_block\" deletable=\"false\" x=\"450\" y=\"50\"><mutation isUpdate=\"true\"></mutation><field name=\"UPDATEOP\">true</field><statement name=\"FUNC\"><block type=\"system_m5_update\" id=\"B7,NK!Ez8%Nf7O}p1.WW\"></block></statement></block>","screen":[{"simulationName":"Built-in","type":"builtin","width":320,"height":240,"scale":0.77,"screenName":"","blockId":"","screenColorType":0,"rotation":1,"id":"builtin","createTime":1761016547844}],"logicWhenNum":0,"customList":[]}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# SPDX-FileCopyrightText: 2025 M5Stack Technology CO LTD
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
import os, sys, io
6+
import M5
7+
from M5 import *
8+
import m5ui
9+
import lvgl as lv
10+
11+
12+
page0 = None
13+
tabview0 = None
14+
Tab1 = None
15+
Tab2 = None
16+
label1 = None
17+
label2 = None
18+
label3 = None
19+
20+
21+
def setup():
22+
global page0, tabview0, Tab1, Tab2, label1, label2, label3
23+
24+
M5.begin()
25+
Widgets.setRotation(1)
26+
m5ui.init()
27+
page0 = m5ui.M5Page(bg_c=0xFFFFFF)
28+
tabview0 = m5ui.M5TabView(
29+
x=0, y=-2, w=320, h=240, bar_size=60, bar_pos=lv.DIR.TOP, parent=page0
30+
)
31+
Tab1 = tabview0.add_tab("Tab1")
32+
Tab2 = tabview0.add_tab("Tab2")
33+
label1 = m5ui.M5Label("This is label1", x=0, y=0, parent=Tab1)
34+
35+
page0.screen_load()
36+
label2 = m5ui.M5Label(
37+
"Hello World",
38+
x=0,
39+
y=0,
40+
text_c=0xFFCC00,
41+
bg_c=0x99FF99,
42+
bg_opa=255,
43+
font=lv.font_montserrat_24,
44+
parent=Tab1,
45+
)
46+
label3 = m5ui.M5Label("hello M5", x=0, y=0, parent=Tab2)
47+
label3.set_style_text_font(lv.font_montserrat_24, lv.PART.MAIN | lv.STATE.DEFAULT)
48+
label3.set_text_color(0x6600CC, 255, 0)
49+
label3.set_bg_color(0x33FF33, 255, 0)
50+
51+
52+
def loop():
53+
global page0, tabview0, Tab1, Tab2, label1, label2, label3
54+
M5.update()
55+
56+
57+
if __name__ == "__main__":
58+
try:
59+
setup()
60+
while True:
61+
loop()
62+
except (Exception, KeyboardInterrupt) as e:
63+
try:
64+
m5ui.deinit()
65+
from utility import print_error_msg
66+
67+
print_error_msg(e)
68+
except ImportError:
69+
print("please update to latest firmware")

m5stack/libs/m5ui/label.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,18 @@ def set_shadow(self, color: int, opa: int, align: int, offset_x: int, offset_y:
8383
self._shadow_label.set_text(self.get_text())
8484
self._shadow_label.set_style_text_color(color, lv.PART.MAIN | lv.STATE.DEFAULT)
8585
self._shadow_label.set_style_text_opa(opa, lv.PART.MAIN | lv.STATE.DEFAULT)
86-
self._shadow_label.set_style_text_font(
87-
self.get_style_text_font(lv.PART.MAIN), lv.PART.MAIN
88-
)
89-
self._shadow_label.set_width(self.get_width())
86+
if isinstance(self.get_parent(), lv.list):
87+
self._shadow_label.set_style_text_font(
88+
self.get_style_text_font(lv.PART.MAIN), lv.PART.MAIN
89+
)
90+
self._shadow_label.set_width(self.get_width())
9091

91-
for part in (lv.PART.MAIN,):
92-
self._shadow_label.set_style_pad_left(self.get_style_pad_left(part), part)
93-
self._shadow_label.set_style_pad_right(self.get_style_pad_right(part), part)
94-
self._shadow_label.set_style_pad_top(self.get_style_pad_top(part), part)
95-
self._shadow_label.set_style_pad_bottom(self.get_style_pad_bottom(part), part)
92+
for part in (lv.PART.MAIN,):
93+
self._shadow_label.set_style_pad_left(self.get_style_pad_left(part), part)
94+
self._shadow_label.set_style_pad_right(self.get_style_pad_right(part), part)
95+
self._shadow_label.set_style_pad_top(self.get_style_pad_top(part), part)
96+
self._shadow_label.set_style_pad_bottom(self.get_style_pad_bottom(part), part)
9697

97-
if isinstance(self.get_parent(), lv.list):
9898
offset_x -= self.get_style_pad_left(part)
9999
self._shadow_label.align_to(self, align, offset_x, offset_y)
100100

0 commit comments

Comments
 (0)