From 6e4060d0ae4414eb5450ffa68b24f9bbb8201047 Mon Sep 17 00:00:00 2001 From: Ace Date: Mon, 7 Dec 2020 11:36:01 +0100 Subject: [PATCH] Switch to guided installation of driver Do not rely or use setup_state.txt to determine if installation was successful, instead check existence of zip file. Do not install the driver files automatically when initialising Driver class, instead, ask the user to enter two commands in the Terminal. Removed setup function for 9.7", improved installer. --- inkycal/display/drivers/9_in_7.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/inkycal/display/drivers/9_in_7.py b/inkycal/display/drivers/9_in_7.py index 7a09650..c4642ce 100644 --- a/inkycal/display/drivers/9_in_7.py +++ b/inkycal/display/drivers/9_in_7.py @@ -5,8 +5,7 @@ Copyright by aceisace """ from inkycal.custom import images, top_level -from subprocess import call, run -from os import chdir +from os.path import exists from PIL import Image # Display resolution @@ -19,12 +18,13 @@ class EPD: def __init__(self): """9.7" epaper class""" - with open(driver_dir+'setup_state.txt', 'r') as file: - setup_state = int(file.readline().rstrip()) + # Check if zipped folders are present, if yes, assume + # drivers have not been installed yet - if setup_state == 0: - print('installing additional drivers...') - self.setup() + if exists(f'{driver_dir}IT8951.zip'): + print('Additional steps are required to install drivers for 9.7" E-Paper. ' + 'Please run the following command in Terminal, then retry:\n' + f'bash {driver_dir}install.sh') def init(self): pass @@ -45,14 +45,6 @@ class EPD: #print(command) return command - def setup(self): - """Runs the required setup for 9.7" epaper displays""" - run(["chmod", "+x", driver_dir+"install.sh"]) - call(driver_dir+"install.sh") - - with open(driver_dir+'setup_state.txt', 'w') as file: - file.write('1') - def sleep(self): pass