Improve layout inspector with built in css_identifier_styled

It now shows [name=...] if applicable, and styles each part differently.
And it's less code!
This commit is contained in:
Isaiah Odhner 2023-04-20 20:50:13 -04:00
parent 48f0303a54
commit 986db57e17

View File

@ -1770,12 +1770,7 @@ class PaintApp(App):
widget.styles.background = Color.from_hsl(i / 10, 1, 0.3)
if not event.ctrl:
widget.styles.border = ("round", Color.from_hsl(i / 10, 1, 0.5))
title = widget.__class__.__name__
if widget.id:
title += "#" + widget.id
if widget.classes:
title += "." + ".".join(widget.classes)
widget.border_title = title
widget.border_title = widget.css_identifier_styled
# `textual run --dev paint.py` will search for a
# global variable named `app`, and fallback to