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.
This commit is contained in:
Ace 2020-12-07 11:36:01 +01:00
parent 9d4810ce25
commit 6e4060d0ae

View File

@ -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