From 840e6c9e1d0f4c2419943f7ad5db885ec0943344 Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Sun, 21 Jul 2019 21:13:28 +0200 Subject: [PATCH] fix(display): Refactor open & close Signed-off-by: Rahix <rahix@rahix.de> --- pycardium/modules/py/display.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pycardium/modules/py/display.py b/pycardium/modules/py/display.py index ade83c13..2f7f85a8 100644 --- a/pycardium/modules/py/display.py +++ b/pycardium/modules/py/display.py @@ -15,6 +15,12 @@ class Display: disp.clear().update() """ + def __init__(self): + """ + Opens the display. Will fail the display can't be locked + """ + sys_display.open() + def __enter__(self): return self @@ -26,10 +32,10 @@ class Display: """ Opens the display. Will fail the display can't be locked """ - sys_display.open() return cls() - def close(self): + @staticmethod + def close(): """ Closes and unlocks the display. To be able to use it again, it is necessary to open and lock it again with Display.open() @@ -126,3 +132,4 @@ class Display: return self open = Display.open +close = Display.close -- GitLab