1919from .components .button import ListItemBtn , ListItemBtnWithSwitch , NormalButton
2020from .components .container import ContainerFlexCol , ContainerGrid
2121from .components .listitem import DisplayItem , ImgGridItem
22+ from .deviceinfo import DeviceInfoManager
2223from .widgets .style import StyleWrapper
2324
2425
@@ -1471,22 +1472,14 @@ def __init__(self, prev_scr=None):
14711472 self ._init = True
14721473 else :
14731474 return
1474- model = device .get_model ()
1475- version = device .get_firmware_version ()
1476- serial = device .get_serial ()
1477-
1478- ble_name = device .get_ble_name () or uart .get_ble_name ()
1479- ble_version = uart .get_ble_version ()
1480- # storage = device.get_storage()
1481- boot_version = utils .boot_version ()
1482- board_version = utils .board_version ()
1475+ preloaded_info = DeviceInfoManager .instance ().get_info ()
14831476 super ().__init__ (
14841477 prev_scr = prev_scr , title = _ (i18n_keys .TITLE__ABOUT_DEVICE ), nav_back = True
14851478 )
1486-
14871479 self .container = ContainerFlexCol (self .content_area , self .title , padding_row = 0 )
1488-
1489- self .model = DisplayItem (self .container , _ (i18n_keys .ITEM__MODEL ), model )
1480+ self .model = DisplayItem (
1481+ self .container , _ (i18n_keys .ITEM__MODEL ), preloaded_info ["model" ]
1482+ )
14901483 self .model .label .add_style (
14911484 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
14921485 )
@@ -1496,27 +1489,16 @@ def __init__(self, prev_scr=None):
14961489 self .ble_mac = DisplayItem (
14971490 self .container ,
14981491 _ (i18n_keys .ITEM__BLUETOOTH_NAME ),
1499- ble_name ,
1492+ preloaded_info [ " ble_name" ] ,
15001493 )
15011494 self .ble_mac .label .add_style (
15021495 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
15031496 )
15041497 self .ble_mac .label_top .add_style (StyleWrapper ().text_color (lv_colors .WHITE ), 0 )
15051498 self .ble_mac .set_style_bg_color (lv_colors .BLACK , 0 )
15061499
1507- # self.storage = DisplayItem(
1508- # self.container,
1509- # _(i18n_keys.ITEM__STORAGE),
1510- # storage,
1511- # )
1512- # self.storage.label.add_style(
1513- # StyleWrapper().text_font(font_PJSREG24).text_color(lv_colors.LIGHT_GRAY), 0
1514- # )
1515- # self.storage.label_top.add_style(StyleWrapper().text_color(lv_colors.WHITE), 0)
1516- # self.storage.set_style_bg_color(lv_colors.BLACK, 0)
1517-
15181500 self .version = DisplayItem (
1519- self .container , _ (i18n_keys .ITEM__SYSTEM_VERSION ), version
1501+ self .container , _ (i18n_keys .ITEM__SYSTEM_VERSION ), preloaded_info [ " version" ]
15201502 )
15211503 self .version .label .add_style (
15221504 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
@@ -1527,7 +1509,7 @@ def __init__(self, prev_scr=None):
15271509 self .ble_version = DisplayItem (
15281510 self .container ,
15291511 _ (i18n_keys .ITEM__BLUETOOTH_VERSION ),
1530- ble_version ,
1512+ preloaded_info [ " ble_version" ] ,
15311513 )
15321514 self .ble_version .label .add_style (
15331515 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
@@ -1538,7 +1520,9 @@ def __init__(self, prev_scr=None):
15381520 self .ble_version .set_style_bg_color (lv_colors .BLACK , 0 )
15391521
15401522 self .boot_version = DisplayItem (
1541- self .container , _ (i18n_keys .ITEM__BOOTLOADER_VERSION ), boot_version
1523+ self .container ,
1524+ _ (i18n_keys .ITEM__BOOTLOADER_VERSION ),
1525+ preloaded_info ["boot_version" ],
15421526 )
15431527 self .boot_version .label .add_style (
15441528 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
@@ -1551,7 +1535,7 @@ def __init__(self, prev_scr=None):
15511535 self .board_version = DisplayItem (
15521536 self .container ,
15531537 _ (i18n_keys .ITEM__BOARDLOADER_VERSION ),
1554- board_version ,
1538+ preloaded_info [ " board_version" ] ,
15551539 )
15561540 self .board_version .label .add_style (
15571541 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
@@ -1570,7 +1554,7 @@ def __init__(self, prev_scr=None):
15701554 self .build_id .set_style_bg_color (lv_colors .BLACK , 0 )
15711555
15721556 self .serial = DisplayItem (
1573- self .container , _ (i18n_keys .ITEM__SERIAL_NUMBER ), serial
1557+ self .container , _ (i18n_keys .ITEM__SERIAL_NUMBER ), preloaded_info [ " serial" ]
15741558 )
15751559 self .serial .label .add_style (
15761560 StyleWrapper ().text_font (font_PJSREG24 ).text_color (lv_colors .LIGHT_GRAY ), 0
0 commit comments