From 46713b6e73c39acae59d5db5ab92e0672604d775 Mon Sep 17 00:00:00 2001 From: XxKingsxX-Pinu Date: Mon, 4 Mar 2024 19:59:34 +1000 Subject: [PATCH 1/4] Update view.py --- pwnagotchi/ui/view.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 8bcaa5ce..6818268f 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -23,7 +23,20 @@ ROOT = None class View(object): 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 faces.load_from_config(config['ui']['faces']) @@ -98,6 +111,11 @@ class View(object): self._state.has_element(key) 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) def remove_element(self, key): From bbb46128febe5fe53ab4f1551d4451d059941bb0 Mon Sep 17 00:00:00 2001 From: Rai <58925163+rai68@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:39:20 +1000 Subject: [PATCH 2/4] Update view.py Signed-off-by: Rai <58925163+rai68@users.noreply.github.com> --- pwnagotchi/ui/view.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 6818268f..166b7931 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -28,7 +28,8 @@ class View(object): self.invert = 0 self._black = 0xFF self._white = 0x00 - if 'invert' in config['ui'] and config['ui']['invert'] == 1 or True: + if 'invert' in config['ui'] and config['ui']['invert'] == True: + logging.error(config['ui']['invert']) self.invert = 1 BLACK = 0x00 WHITE - 0xFF @@ -67,7 +68,7 @@ class View(object): 'line1': Line(self._layout['line1'], color=BLACK), 'line2': Line(self._layout['line2'], color=BLACK), - 'face': Text(value=faces.SLEEP, position=(config['ui']['faces']['position_x'], config['ui']['faces']['position_y']), color=BLACK, font=fonts.Huge, png=config['ui']['faces']['png']), + 'face': Text(value=faces.SLEEP, position=(20, 20), color=BLACK, font=fonts.Huge), # 'friend_face': Text(value=None, position=self._layout['friend_face'], font=fonts.Bold, color=BLACK), 'friend_name': Text(value=None, position=self._layout['friend_name'], font=fonts.BoldSmall, color=BLACK), @@ -389,7 +390,7 @@ class View(object): state = self._state changes = state.changes(ignore=self._ignore_changes) if force or len(changes): - self._canvas = Image.new('1', (self._width, self._height), WHITE) + self._canvas = Image.new('1', (self._width, self._height), self._white) drawer = ImageDraw.Draw(self._canvas) plugins.on('ui_update', self) From f2cf34a8b95cd1f13472d7499cfadc0e113b6d0a Mon Sep 17 00:00:00 2001 From: Rai <58925163+rai68@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:39:55 +1000 Subject: [PATCH 3/4] Update view.py Signed-off-by: Rai <58925163+rai68@users.noreply.github.com> --- pwnagotchi/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 166b7931..cbbdde40 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -29,7 +29,7 @@ class View(object): self._black = 0xFF self._white = 0x00 if 'invert' in config['ui'] and config['ui']['invert'] == True: - logging.error(config['ui']['invert']) + logging.debug("INVERT BLACK/WHITES:" + config['ui']['invert']) self.invert = 1 BLACK = 0x00 WHITE - 0xFF From de2cdaa3c9c9834fe40b3a5292030cc718210b04 Mon Sep 17 00:00:00 2001 From: Rai <58925163+rai68@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:41:19 +1000 Subject: [PATCH 4/4] Update view.py Signed-off-by: Rai <58925163+rai68@users.noreply.github.com> --- pwnagotchi/ui/view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index cbbdde40..1a90c998 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -68,7 +68,7 @@ class View(object): 'line1': Line(self._layout['line1'], color=BLACK), 'line2': Line(self._layout['line2'], color=BLACK), - 'face': Text(value=faces.SLEEP, position=(20, 20), color=BLACK, font=fonts.Huge), + 'face': Text(value=faces.SLEEP, position=(config['ui']['faces']['position_x'], config['ui']['faces']['position_y']), color=BLACK, font=fonts.Huge, png=config['ui']['faces']['png']), # 'friend_face': Text(value=None, position=self._layout['friend_face'], font=fonts.Bold, color=BLACK), 'friend_name': Text(value=None, position=self._layout['friend_name'], font=fonts.BoldSmall, color=BLACK),