Update view.py

This commit is contained in:
XxKingsxX-Pinu
2024-03-04 19:59:34 +10:00
parent aa2b09fb21
commit 46713b6e73

View File

@ -23,7 +23,20 @@ ROOT = None
class View(object): class View(object):
def __init__(self, config, impl, state=None): def __init__(self, config, impl, state=None):
global ROOT global ROOT, BLACK, WHITE
self.invert = 0
self._black = 0xFF
self._white = 0x00
if 'invert' in config['ui'] and config['ui']['invert'] == 1 or True:
self.invert = 1
BLACK = 0x00
WHITE - 0xFF
self._black = 0x00
self._white = 0xFF
# setup faces from the configuration in case the user customized them # setup faces from the configuration in case the user customized them
faces.load_from_config(config['ui']['faces']) faces.load_from_config(config['ui']['faces'])
@ -98,6 +111,11 @@ class View(object):
self._state.has_element(key) self._state.has_element(key)
def add_element(self, key, elem): def add_element(self, key, elem):
if self.invert is 1 and elem.color:
if elem.color == 0xff:
elem.color = 0x00
elif elem.color == 0x00:
elem.color = 0xff
self._state.add_element(key, elem) self._state.add_element(key, elem)
def remove_element(self, key): def remove_element(self, key):