mattblovell / kodi_panel

Front panel LCD display for Kodi (via JSON-RPC)
MIT License
12 stars 5 forks source link

Status screen does not show field with dynamic flag set #32

Closed nico1080 closed 3 years ago

nico1080 commented 3 years ago

Text fields from [[STATUS_LAYOUT.fields]] with dynamic = 1 will not display on status screen. Eg this fields will display only if dynamic = 1 is commented or if dynamic = 0

[[STATUS_LAYOUT.fields]]
name = "System.Time(hh:mm:ss)"
posx = 250
posy = 80
font = "font7S"
fill = "color_7S"
#dynamic = 1

Video and audio section seems to work OK.

Weirdly, all text fields will get updated even if dynamic = 1 is commented or if dynamic = 0

mattblovell commented 3 years ago

The dynamic flag is not needed for status screen fields.

The text_fields() function has a dynamic argument that defaults to False.

The status_screen() function invokes text_fields() as follows (around Line 1311 or so):

text_fields(image, draw,
            layout, kodi_status,
            ScreenMode.STATUS, "STATUS_LAYOUT")

which means that the dynamic argument to the function is left at that default False.

The text_fields() function then filters out any element that has dynamic set (to something that TOML + Python interprets as True).

The looping that updates the status screen ends up redrawing everything on every invocation (i.e., there is no static vs dynamic division, as exists for audio or video screens).

mattblovell commented 3 years ago

I went ahead and modified text_fields() to ignore the dynamic flag for a STATUS screen.

See commit 6651f0a8d43bf1df669645fe359d1fc91222fbe4

Closing issue. Please reopen if the above doesn't fix matters.