Module albow.core.ui.Predictor
Source code
import logging
from albow.themes.Theme import Theme
from albow.core.ui.Widget import Widget
class Predictor:
def __init__(self, theWidget: Widget):
self.logger = logging.getLogger(__name__)
self.widget = theWidget
def predict(self, kwds, name):
try:
return kwds[name]
except KeyError:
return Theme.getThemeRoot().get(self.widget.__class__, name)
def predict_attr(self, kwds, name):
try:
return kwds[name]
except KeyError:
return getattr(self.widget, name)
def init_attr(self, kwds, name):
try:
return kwds.pop(name)
except KeyError:
return getattr(self.widget, name)
def predict_font(self, kwds, name='font'):
return kwds.get(name) or Theme.getThemeRoot().get_font(self.widget.__class__, name)
Classes
class Predictor (theWidget)
-
Source code
class Predictor: def __init__(self, theWidget: Widget): self.logger = logging.getLogger(__name__) self.widget = theWidget def predict(self, kwds, name): try: return kwds[name] except KeyError: return Theme.getThemeRoot().get(self.widget.__class__, name) def predict_attr(self, kwds, name): try: return kwds[name] except KeyError: return getattr(self.widget, name) def init_attr(self, kwds, name): try: return kwds.pop(name) except KeyError: return getattr(self.widget, name) def predict_font(self, kwds, name='font'): return kwds.get(name) or Theme.getThemeRoot().get_font(self.widget.__class__, name)
Methods
def init_attr(self, kwds, name)
-
Source code
def init_attr(self, kwds, name): try: return kwds.pop(name) except KeyError: return getattr(self.widget, name)
def predict(self, kwds, name)
-
Source code
def predict(self, kwds, name): try: return kwds[name] except KeyError: return Theme.getThemeRoot().get(self.widget.__class__, name)
def predict_attr(self, kwds, name)
-
Source code
def predict_attr(self, kwds, name): try: return kwds[name] except KeyError: return getattr(self.widget, name)
def predict_font(self, kwds, name='font')
-
Source code
def predict_font(self, kwds, name='font'): return kwds.get(name) or Theme.getThemeRoot().get_font(self.widget.__class__, name)