[core] Each module can now access theme data

Add a method "theme()" to the generic module to have access to the theme
information.

Specifically, "theme().get(widget, attribute, default_value)" can be
used to retrieve theming for a widget with an arbitrary attribute.

This is in response to #412 - thanks to @bbernhard for the suggestion!
This commit is contained in:
Tobias Witek 2019-08-01 20:41:13 +02:00
parent 93606315e3
commit eb72d59ed1
2 changed files with 10 additions and 0 deletions

View file

@ -105,6 +105,9 @@ class Theme(object):
if icon is None:
return self._get(widget, "prefix", None)
def get(self, widget, attribute, default_value=""):
return self._get(widget, attribute, default_value)
def padding(self, widget):
"""Return padding for widget"""
return self._get(widget, "padding", "")