You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just noticed that the CSS feature targeting keys is not working in 2.2. I think this probably broke with 2.0, since the problem is that CSS.applies is looking for keys -- but since 2.0 the keys on an mGui control are set retroactively, not during the __init__ of any particular widget.
So this does not work:
example = CSS ('named_item', backgroundColor=(1,0,0)
with example:
with FillForm():
named_item = Button('should be red')
but this still does
example = CSS ('named_item', backgroundColor=(1,0,0)
with FillForm() as outer:
named_item = Button('should be red')
example.apply_recursive(outer)
and so does this:
example = CSS ('named_item', backgroundColor=(1,0,0)
with FillForm():
named_item = Button('should be red', css = example)
I'm not sure if its worth resurrecting this feature. It's supposed to be an analogy to the "id" selector in regular CSS. However since a CSS object can be passed directly to a constructor, user can work around it like that. alternatively we could add an explict 'selector' kwarg, but that seems like overkill. I don't make much use of the string id target feature, so I won't mind if we just remove the documentation that talks about it .
What do other people think?
The text was updated successfully, but these errors were encountered:
Such that it updates control.key, then the original example works.
However it does break down if you reuse a name in the parent's scope, as only the most recent binding with get updated, and the others will fall back on their default. But we already have that problem when it comes to adding children to the parent namespace as is.
I don't have a large battery of things to test against right now, but this change doesn't break any of the current examples.
Though none of this fixes the case of using the CSS class as a context manager.
I just noticed that the CSS feature targeting keys is not working in 2.2. I think this probably broke with 2.0, since the problem is that
CSS.applies
is looking for keys -- but since 2.0 the keys on an mGui control are set retroactively, not during the__init__
of any particular widget.So this does not work:
but this still does
and so does this:
I'm not sure if its worth resurrecting this feature. It's supposed to be an analogy to the "id" selector in regular CSS. However since a CSS object can be passed directly to a constructor, user can work around it like that. alternatively we could add an explict 'selector' kwarg, but that seems like overkill. I don't make much use of the string id target feature, so I won't mind if we just remove the documentation that talks about it .
What do other people think?
The text was updated successfully, but these errors were encountered: