new: users can now customize the faces via config.yml (ui.faces)

This commit is contained in:
Simone Margaritelli 2019-10-20 17:13:05 +02:00
parent 99e0a31ea8
commit cd5d783c52
3 changed files with 89 additions and 61 deletions

View File

@ -160,6 +160,26 @@ personality:
# ui configuration # ui configuration
ui: ui:
# here you can customize the faces
faces:
look_r: '( ⚆_⚆)'
look_l: '(☉_☉ )'
sleep: '(⇀‿‿↼)'
sleep2: '(≖‿‿≖)'
awake: '(◕‿‿◕)'
bored: '(-__-)'
intense: '(°▃▃°)'
cool: '(⌐■_■)'
happy: '(•‿‿•)'
excited: '(ᵔ◡◡ᵔ)'
motivated: '(☼‿‿☼)'
demotivated: '(≖__≖)'
smart: '(✜‿‿✜)'
lonely: '(ب__ب)'
sad: '(╥☁╥ )'
friend: '(♥‿‿♥)'
broken: '(☓‿‿☓)'
debug: '(#__#)'
# ePaper display can update every 3 secs anyway, set to 0 to only refresh for major data changes # ePaper display can update every 3 secs anyway, set to 0 to only refresh for major data changes
# IMPORTANT: The lifespan of an eINK display depends on the cumulative amount of refreshes. If you want to # IMPORTANT: The lifespan of an eINK display depends on the cumulative amount of refreshes. If you want to
# preserve your display over time, you should set this value to 0.0 so that the display will be refreshed only # preserve your display over time, you should set this value to 0.0 so that the display will be refreshed only

View File

@ -16,3 +16,8 @@ SAD = '(╥☁╥ )'
FRIEND = '(♥‿‿♥)' FRIEND = '(♥‿‿♥)'
BROKEN = '(☓‿‿☓)' BROKEN = '(☓‿‿☓)'
DEBUG = '(#__#)' DEBUG = '(#__#)'
def load_from_config(config):
for face_name, face_value in config.items():
globals()[face_name.upper()] = face_value

View File

@ -22,6 +22,9 @@ class View(object):
def __init__(self, config, impl, state=None): def __init__(self, config, impl, state=None):
global ROOT global ROOT
# setup faces from the configuration in case the user customized them
faces.load_from_config(config['ui']['faces'])
self._render_cbs = [] self._render_cbs = []
self._config = config self._config = config
self._canvas = None self._canvas = None