mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-30 07:06:19 +08:00
chore(gdb): add LVImageDecoder complete fields and dump image_decoder command
This commit is contained in:
@@ -36,6 +36,7 @@ from .lvgl import (
|
|||||||
EVENT_CODE_NAMES,
|
EVENT_CODE_NAMES,
|
||||||
LVAnim,
|
LVAnim,
|
||||||
LVTimer,
|
LVTimer,
|
||||||
|
LVImageDecoder,
|
||||||
LVFsDrv,
|
LVFsDrv,
|
||||||
)
|
)
|
||||||
from . import cmds as cmds
|
from . import cmds as cmds
|
||||||
@@ -76,5 +77,6 @@ __all__ = [
|
|||||||
"EVENT_CODE_NAMES",
|
"EVENT_CODE_NAMES",
|
||||||
"LVAnim",
|
"LVAnim",
|
||||||
"LVTimer",
|
"LVTimer",
|
||||||
|
"LVImageDecoder",
|
||||||
"LVFsDrv",
|
"LVFsDrv",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from .misc import (
|
|||||||
CheckCache,
|
CheckCache,
|
||||||
DumpAnim,
|
DumpAnim,
|
||||||
DumpTimer,
|
DumpTimer,
|
||||||
|
DumpImageDecoder,
|
||||||
DumpFsDrv,
|
DumpFsDrv,
|
||||||
)
|
)
|
||||||
from .debugger import Debugger
|
from .debugger import Debugger
|
||||||
@@ -35,6 +36,7 @@ CheckPrefix()
|
|||||||
CheckCache()
|
CheckCache()
|
||||||
DumpAnim()
|
DumpAnim()
|
||||||
DumpTimer()
|
DumpTimer()
|
||||||
|
DumpImageDecoder()
|
||||||
DumpFsDrv()
|
DumpFsDrv()
|
||||||
DumpDrawTask()
|
DumpDrawTask()
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from .lv_style import InfoStyle
|
|||||||
from .lv_cache import DumpCache, CheckPrefix, CheckCache
|
from .lv_cache import DumpCache, CheckPrefix, CheckCache
|
||||||
from .lv_anim import DumpAnim
|
from .lv_anim import DumpAnim
|
||||||
from .lv_timer import DumpTimer
|
from .lv_timer import DumpTimer
|
||||||
|
from .lv_image_decoder import DumpImageDecoder
|
||||||
from .lv_fs import DumpFsDrv
|
from .lv_fs import DumpFsDrv
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -11,5 +12,6 @@ __all__ = [
|
|||||||
"CheckCache",
|
"CheckCache",
|
||||||
"DumpAnim",
|
"DumpAnim",
|
||||||
"DumpTimer",
|
"DumpTimer",
|
||||||
|
"DumpImageDecoder",
|
||||||
"DumpFsDrv",
|
"DumpFsDrv",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import gdb
|
||||||
|
|
||||||
|
from lvglgdb.lvgl import curr_inst
|
||||||
|
from lvglgdb.lvgl.misc.lv_image_decoder import LVImageDecoder
|
||||||
|
|
||||||
|
|
||||||
|
class DumpImageDecoder(gdb.Command):
|
||||||
|
"""dump all registered image decoders"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(DumpImageDecoder, self).__init__(
|
||||||
|
"dump image_decoder", gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION
|
||||||
|
)
|
||||||
|
|
||||||
|
def invoke(self, args, from_tty):
|
||||||
|
LVImageDecoder.print_entries(curr_inst().image_decoders())
|
||||||
@@ -37,6 +37,7 @@ from .misc import (
|
|||||||
EVENT_CODE_NAMES,
|
EVENT_CODE_NAMES,
|
||||||
LVAnim,
|
LVAnim,
|
||||||
LVTimer,
|
LVTimer,
|
||||||
|
LVImageDecoder,
|
||||||
LVFsDrv,
|
LVFsDrv,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -81,5 +82,6 @@ __all__ = [
|
|||||||
"EVENT_CODE_NAMES",
|
"EVENT_CODE_NAMES",
|
||||||
"LVAnim",
|
"LVAnim",
|
||||||
"LVTimer",
|
"LVTimer",
|
||||||
|
"LVImageDecoder",
|
||||||
"LVFsDrv",
|
"LVFsDrv",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -73,6 +73,12 @@ class LVGL:
|
|||||||
for timer in LVList(self.lv_global.timer_state.timer_ll, "lv_timer_t"):
|
for timer in LVList(self.lv_global.timer_state.timer_ll, "lv_timer_t"):
|
||||||
yield LVTimer(timer)
|
yield LVTimer(timer)
|
||||||
|
|
||||||
|
def image_decoders(self):
|
||||||
|
from ..misc.lv_image_decoder import LVImageDecoder
|
||||||
|
|
||||||
|
for dec in LVList(self.lv_global.img_decoder_ll, "lv_image_decoder_t"):
|
||||||
|
yield LVImageDecoder(dec)
|
||||||
|
|
||||||
def fs_drivers(self):
|
def fs_drivers(self):
|
||||||
from ..misc.lv_fs import LVFsDrv
|
from ..misc.lv_fs import LVFsDrv
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from .lv_event import (
|
|||||||
)
|
)
|
||||||
from .lv_anim import LVAnim
|
from .lv_anim import LVAnim
|
||||||
from .lv_timer import LVTimer
|
from .lv_timer import LVTimer
|
||||||
|
from .lv_image_decoder import LVImageDecoder
|
||||||
from .lv_fs import LVFsDrv
|
from .lv_fs import LVFsDrv
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
@@ -56,5 +57,6 @@ __all__ = [
|
|||||||
"EVENT_CODE_NAMES",
|
"EVENT_CODE_NAMES",
|
||||||
"LVAnim",
|
"LVAnim",
|
||||||
"LVTimer",
|
"LVTimer",
|
||||||
|
"LVImageDecoder",
|
||||||
"LVFsDrv",
|
"LVFsDrv",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
|
from lvglgdb.value import Value, ValueInput
|
||||||
|
|
||||||
|
|
||||||
|
class LVImageDecoder(Value):
|
||||||
|
"""LVGL image decoder wrapper"""
|
||||||
|
|
||||||
|
def __init__(self, decoder: ValueInput):
|
||||||
|
super().__init__(Value.normalize(decoder, "lv_image_decoder_t"))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self) -> str:
|
||||||
|
n = self.super_value("name")
|
||||||
|
return n.string() if int(n) else "(unnamed)"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def info_cb(self) -> Value:
|
||||||
|
return self.super_value("info_cb")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def open_cb(self) -> Value:
|
||||||
|
return self.super_value("open_cb")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def close_cb(self) -> Value:
|
||||||
|
return self.super_value("close_cb")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def get_area_cb(self) -> Value:
|
||||||
|
return self.super_value("get_area_cb")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def custom_draw_cb(self) -> Value:
|
||||||
|
return self.super_value("custom_draw_cb")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def user_data(self) -> Value:
|
||||||
|
return self.super_value("user_data")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def print_entries(decoders):
|
||||||
|
"""Print image decoders as a PrettyTable."""
|
||||||
|
table = PrettyTable()
|
||||||
|
table.field_names = ["#", "name", "info_cb", "open_cb", "close_cb"]
|
||||||
|
table.align = "l"
|
||||||
|
|
||||||
|
for i, dec in enumerate(decoders):
|
||||||
|
table.add_row(
|
||||||
|
[
|
||||||
|
i,
|
||||||
|
dec.name,
|
||||||
|
dec.info_cb.format_string(symbols=True),
|
||||||
|
dec.open_cb.format_string(symbols=True),
|
||||||
|
dec.close_cb.format_string(symbols=True),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if not table.rows:
|
||||||
|
print("No registered image decoders.")
|
||||||
|
else:
|
||||||
|
print(table)
|
||||||
Reference in New Issue
Block a user