From 8f61b99f370891b13f0aa0e22ad68864ffa60b1e Mon Sep 17 00:00:00 2001 From: Coltonton <41667601+Coltonton@users.noreply.github.com> Date: Sun, 16 Apr 2023 04:59:30 -0400 Subject: [PATCH] Merge branch 'pre-1.2-release' * Multi-install Feature * Condense installer code to run in dedicated functions * Cleanup naming scheme to theme_xxxx.py * ReDo Restore Code * Remove traces of APK :( * LOTS of cleanup / makinging proper / tons of neat logic * Easter eggs??? Fake plastic ones maybe in this economy... * I'm sure, and I know im forgetting ALOT yes its been a few years. * TODO - V2 & V3?????!!! --- .gitignore | 1 + RELEASES.MD | 8 +- support/support_functions.py | 373 +++++++++++++++++------------ support/support_variables.py | 28 ++- theme_install.py | 250 +++++++++++-------- theme_restore.py | 179 ++++++++++++++ theme_restore_.py | 272 --------------------- theme_utils.py => theme_utility.py | 115 ++++----- 8 files changed, 626 insertions(+), 600 deletions(-) create mode 100755 theme_restore.py delete mode 100755 theme_restore_.py rename theme_utils.py => theme_utility.py (72%) diff --git a/.gitignore b/.gitignore index ee00bd5..2a55869 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ Boot Logo Tools/OnePlus3TInjector/Thumbs.db test-theme-backups support/__pycache__ contributed-themes/DEV +mydev *.db *.DS_Store *.DS_Store diff --git a/RELEASES.MD b/RELEASES.MD index 2e31492..03df900 100644 --- a/RELEASES.MD +++ b/RELEASES.MD @@ -1,10 +1,14 @@ -Version 2.0.0 (2021-XX-XX) +Version 1.2.0 (2023-04-16) ======================== +* Multi-install Feature * Condense installer code to run in dedicated functions * Cleanup naming scheme to theme_xxxx.py * ReDo Restore Code * Remove traces of APK :( -* TODO - Auto Logic Finish!!! +* LOTS of cleanup / makinging proper / tons of neat logic +* Easter eggs??? Fake plastic ones maybe in this economy... +* I'm sure, and I know im forgetting ALOT yes its been a few years. +* TODO - V2 & V3?????!!! Version 1.1.1 (2020-01-01) diff --git a/support/support_functions.py b/support/support_functions.py index 0f62648..68af26e 100755 --- a/support/support_functions.py +++ b/support/support_functions.py @@ -3,10 +3,13 @@ from os import path from datetime import datetime from support.support_variables import * + os.chdir(os.path.dirname(os.path.realpath(__file__))) # __file__ is safer since it doesn't change based on where this file is called from -## ================= Shared ================= ## -def get_device_theme_data(onprocess='null'): +######################################################### +##===================== Shared ======================= ## +######################################################### +def get_device_theme_data(onprocess='null'): # Get and set the data based on device DebugPrint('Getting Device Data...', 'sf') devicedata = dict # Crude device detection, *shrug* it works! LeEco does not have tristate! @@ -43,32 +46,53 @@ def get_device_theme_data(onprocess='null'): cycle = cycle +1 return devicedata -def is_affirmative(): # Ask user for confirmation - DebugPrint('Asking to confirm', 'sf') - u = input('[1.Yes / 2.No]: ').lower().strip() - DebugPrint('Got {} (lower.strip)'.format(u), 'sf') - if u in ['i guess', 'sure', 'fine', 'whatever']: - print("WTF do you mean {}... I'm going to assume NO so i dont brick ya shi...".format(u)) - if u not in ['yes', 'ye', 'y', '1', "j", "ja", "si"]: - print('Not Installing....') - if u in ['yes', 'ye', 'y', '1', "j", "ja", "si"]: - return 1 - else: - return 0 - -def make_backup_folder(): - DebugPrint('Getting backup Folder congig') +def is_affirmative(key1="Yes", key2="No", output="Not installing..."): # Ask user for confirmation + #DebugPrint('Asking to confirm', 'sf') + key1_l = key1.lower().strip() # lowercase key1 for compare + key2_lf = key2.lower().strip()[0] # lowercase first char key2 for compare + key1_lf = key1_l[0] if key1_l[0] not in ["n", key2_lf] else "y" # Get first letter key1(lower), if is "n" (same as no) or same as key2 ignore... + afirm = input('[1.{} / 2.{}]: '.format(key1,key2)).lower().strip() + DebugPrint('Got {}'.format(afirm), 'sf') + if ((afirm in IS_AFFIRMATIVE_YES) or (afirm in [key1_l, key1_lf])): + return True + if afirm in IS_AFFIRMATIVE_UNSURE: + print("WTF do you mean {}... I'm going to assume NO so I dont brick ya shi...".format(afirm)) + if afirm in ['i dont talk to cops without my lawyer present']: # Do you like your eggs real or plastic? + print("Attaboy Ope!") # Please tell me you watched the Andy Griffith Show... I was only born in '99... + + if output != "silent": print('{}'.format(output)) + time.sleep(1.5) + return False + +def make_backup_folder(): # Generate the backup dir + DebugPrint('Getting backup Folder congig', fromprocess_input="sf") # Check if theme backup folder doesnt exist then create if not os.path.exists(BACKUPS_DIR): - DebugPrint('It doesent exist... Creating at {}'.format(BACKUPS_DIR), 'sf') + DebugPrint('It doesent exist... Creating at {}'.format(BACKUPS_DIR), fromprocess_input="sf") os.mkdir(BACKUPS_DIR) - # Create session backup folder named with date & time - backup_dir = datetime.now().strftime('{}/backup.%m-%d-%y--%I:%M.%S-%p'.format(BACKUPS_DIR)) + # Create session backup folder + while True: + print("\n*\nDo You wish to name your backup or use default? ") + if is_affirmative(key1="Custom", key2="Default", output="silent"): + usersChoice = input("Enter: backup.") + backup_dir = '{}/backup.{}'.format(BACKUPS_DIR, usersChoice) + if path.exists('{}'.format(backup_dir)): + print("Directory already exists... Overwrite Data?") + if is_affirmative(key1="Overwrite", key2="Don't Overwrite"): + os.removedirs(backup_dir) + break + else: + print("Please try again...") + else: + break + else: + backup_dir = datetime.now().strftime('{}/backup.%m-%d-%y--%I:%M.%S-%p'.format(BACKUPS_DIR)) + break os.mkdir(backup_dir) # Create the session backup folder - DebugPrint('Created session backup folder at ' + backup_dir, 'sf') + DebugPrint('Created session backup folder at {}'.format(backup_dir), fromprocess_input="sf") return backup_dir -def print_text(showText, withver=0): # This center formats text automatically +def print_text(showText, withver=0): # This center formats text automatically max_line_length = max([len(line) for line in showText]) + 4 print(''.join(['+' for _ in range(max_line_length)])) for line in showText: @@ -77,11 +101,7 @@ def print_text(showText, withver=0): # This center formats text automatically print('+{}+'.format(' ' * padding_left + line + ' ' * (padding - padding_left))) print(''.join(['+' for _ in range(max_line_length)])) -def print_version(ver=''): - - print('Eon Custom Themes Version '+ EON_CUSTOM_THEMES_VER) - -def selector_picker(listvar, printtext): +def selector_picker(listvar, printtext): # Part of @sshane's smart picker options = list(listvar) # this only contains available options from self.get_available_options if not len(options): print('No options were given') @@ -97,25 +117,40 @@ def selector_picker(listvar, printtext): selected_option = listvar[indexChoice] return selected_option +def backup_overide_check(backup_dir, theme_type): # Check if there was a backup already this session to prevent accidental overwrites + if path.exists('{}/{}'.format(backup_dir, theme_type)): + print('\nIt appears you already made a(n) {} install this session'.format(theme_type)) + print('continuing will overwrite the last {} backup'.format(theme_type)) + print('the program made this session already!!!') + print('Would you like to continue and overwrite previous?') + if not is_affirmative(): + print('Not installed.......') + return True + else: + os.mkdir('{}/{}'.format(backup_dir, theme_type)) + return False + +######################################################### ## ============= Installer Support Funcs ============= ## +######################################################### # Created by @ShaneSmiskol some modifications by coltonton -def installer_chooser(): - return 'Do_Self' +'''def installer_chooser(): # Choose what installer to use (DEPRICATED) + DebugPrint("installer_chooser() called", fromprocess_input="sf") + return 'Do_Self' ''' -def get_aval_themes(): # Auto discover themes and let user choose! +def get_aval_themes(): # Auto discover themes and let user choose! + DebugPrint("get_aval_themes() called", fromprocess_input="sf") try: available_themes = [t for t in os.listdir(CONTRIB_THEMES)] except FileNotFoundError: print("\nCRITICAL ERROR: Run this program using 'exec ./theme_install.py' ++++++\n") - DebugPrint("File Not Found or doesnt have access") + DebugPrint("File Not Found or doesnt have access", fromprocess_input="sf") available_themes = [t for t in os.listdir(CONTRIB_THEMES)] available_themes = [t for t in available_themes if os.path.isdir(os.path.join(CONTRIB_THEMES, t))] if DEVMODE: - DebugPrint("Found all these directorys: ", multi=1) - DebugPrint(available_themes, multi=2) - DebugPrint("Are Excluded in support.support_variables.py: ", multi=1) - DebugPrint(EXCLUDED_THEMES, multi=2) + DebugPrint("Found all these directorys: ", multi=available_themes, fromprocess_input="sf") + DebugPrint("Are Excluded in support.support_variables.py: ", multi=EXCLUDED_THEMES, fromprocess_input="sf") available_themes = [t for t in available_themes if t not in EXCLUDED_THEMES] lower_available_themes = [t.lower() for t in available_themes] print('\n*\nAvailable themes:') @@ -126,12 +161,12 @@ def get_aval_themes(): # Auto discover themes and let user choose! print('Type `exit` or enter 0 to exit.') while 1: theme = input('\nChoose a theme to install (by name or index): ').strip().lower() - DebugPrint("User entered: {}".format(theme)) + DebugPrint("User entered: {}".format(theme), fromprocess_input="sf") print() #if theme in ['restore', 'r']: # return 'restore' if theme in ['exit', 'e', '0', 'stop']: - DebugPrint("Got Exit") + DebugPrint("Got Exit", fromprocess_input="sf") exit() if theme in ['devmode']: return 'devmode' @@ -154,23 +189,22 @@ def get_aval_themes(): # Auto discover themes and let user choose! print('Is this correct?') print('[Y/n]: ', end='') if input().lower().strip() in ['yes', 'ye', 'y', '1', "j", "ja", "si"]: - DebugPrint("You entered: {}".format(input)) + DebugPrint("You entered: {}".format(input), fromprocess_input="sf") return theme else: print('Unknown theme, try again!') - DebugPrint("Did not match") + DebugPrint("Did not match", fromprocess_input="sf") def mark_self_installed(): # Creates a file letting the auto installer know if a self theme installed - pass - DebugPrint("Marking as self installed to /storage/emulated/0/eon_custom_themes_self_installed'") - if DEVMODE: return - if not path.exists ('/storage/emulated/0/eon_custom_themes_self_installed'): + DebugPrint("mark_self_installed() called", fromprocess_input="sf") + DebugPrint("Marking as self installed to /storage/emulated/0/eon_custom_themes_self_installed'", fromprocess_input="sf") + if Dev_DoInstall() and not path.exists ('/storage/emulated/0/eon_custom_themes_self_installed'): f = open("/storage/emulated/0/eon_custom_themes_self_installed.txt", "w") f.close def get_OP_Ver_Loc(): # Get OpenPilot Version & Location - global OP_VER - global OP_LOC + DebugPrint("mark_self_installed() called", fromprocess_input="sf") + #Get Location Information while True: if path.exists('/data/openpilot'): print("\n*\nOpenPilot Location Auto-Detected as /data/openpilot") @@ -183,83 +217,103 @@ def get_OP_Ver_Loc(): # Get OpenPilot Version & Location while True: if response == "1": - OP_LOC = '/data/openpilot' + OP_Location = '/data/openpilot' if response == "2" or DEVMODE is True and response == "2": print('What Is The Correct OpenPilot directory?') - OP_LOC = input('/data/') - if OP_LOC in ["override", "o"]: - OP_LOC = input('Enter Full Path To OpenPilot ex. /data/openpilot: ') + #print("Enter 'overide' to choose a location other then /data/") + OP_Location = input('/data/') + if OP_Location in ["override", "o"]: + OP_Location = input('Enter Full Path To OpenPilot ex. /data/openpilot: ') else: - OP_LOC = "/data/{}".format(OP_LOC) + OP_Location = "/data/{}".format(OP_Location) - print("Looking For {}".format(OP_LOC)) + print("Looking For {}/releases.md to auto determine version...".format(OP_Location)) - if os.path.isfile("{}/RELEASES.md".format(OP_LOC)) is True: - print("I Found Valid OpenPilot Software!") + if os.path.isfile("{}/RELEASES.md".format(OP_Location)) is True: + print("I Found an OpenPilot Software Release!") break else: - print("You typed {}".format(OP_LOC)) + print("You typed {}".format(OP_Location)) print("Hmm I could not find that or an error occured... Try Again...") - OPVER = '' - file = open(('{}/RELEASES.md'.format(OP_LOC)), 'r') - file.seek(10) - while True: - temp = file.read(1) - if(temp != " "): - OPVER = OPVER + temp - else: - OP_VER = float(OPVER) - break + #Start Getting Version Information + filesize = os.path.getsize('{}/RELEASES.md'.format(OP_Location)) + DebugPrint("Got {} bytes".format(filesize), fromprocess_input="sf") + if filesize < 26: + print("\n*") + print("Invalid RELEASES.md found in {}. File size invalid.".format(OP_Location)) + print("Please see issue #28 on my repo https://github.com/Coltonton/eon-custom-themes/issues/28") + print("\n*") + print("Auto-detection failed please manually enter...") + OP_Version=input("OpenPilot Version 0.") + else: + OP_Version = '' + file = open(('{}/RELEASES.md'.format(OP_Location)), 'r') + OP_Version = file.readline(13) + OP_Version = OP_Version.strip("Version 0.") + file.close() - print("\n*\nOpenPilot Version Auto-Detected as {} from {}".format(OP_VER, OP_LOC)) + print("OpenPilot Version Auto-Detected as 0.{} from {}".format(OP_Version, OP_Location)) OP_info_dict = { - "OP_Version": OP_VER, - "OP_Location": OP_LOC + "OP_Version": OP_Version, + "OP_Location": OP_Location } return OP_info_dict - +######################################################### ##================= Installer Code =================== ## -def INSTALL_BOOT_LOGO(eon_type, backup_dir, install_from_path): - if eon_type == 'OP3T': - boot_logo_device_path = '/dev/block/sde17' - boot_lego_name = 'LOGO' - elif eon_type == 'LeEco': - boot_logo_device_path = '/dev/block/bootdevice/by-name/splash' - boot_lego_name = 'SPLASH' - os.system('cp {} {}/{}'.format(boot_logo_device_path, backup_dir, boot_lego_name)) # Make Backup - os.system('dd if={} of={}'.format(install_from_path, boot_logo_device_path)) # Replace - print('Boot Logo installed! Original file(s) backed up to {}'.format(backup_dir, boot_lego_name)) - -def INSTALL_BOOTANIMATION(backup_dir, install_from_path, color=''): +######################################################### +def INSTALL_BOOT_LOGO(DeviceData, backup_dir, install_from_path, re=False): #INSTALL_BOOT_LOGO + DebugPrint("INSTALL_BOOT_LOGO() called", multi=[DeviceData["BOOT_LOGO_PATH"], DeviceData["BOOT_LOGO_THEME_NAME"], backup_dir, install_from_path], fromprocess_input="sf") + DebugPrint("Installing Boot Logo...", fromprocess_input="sf") + os.system('cp {} {}/{}'.format(DeviceData["BOOT_LOGO_PATH"], backup_dir, DeviceData["BOOT_LOGO_THEME_NAME"])) # Make Backup + os.system('dd if={} of={}'.format(install_from_path, DeviceData["BOOT_LOGO_PATH"])) # Replace + if re == False: + print('#Boot Logo installed! Original file(s) backed up to {}'.format(backup_dir, DeviceData["BOOT_LOGO_THEME_NAME"])) + elif re == True: + print('#Boot Logo re-installed from backup! Current file(s) backed up to {}'.format(backup_dir, DeviceData["BOOT_LOGO_THEME_NAME"])) + +def INSTALL_BOOTANIMATION(backup_dir, install_from_path, color='', re=False): #INSTALL_BOOTANIMATION + DebugPrint("INSTALL_BOOTANIMATION() called".format([backup_dir, install_from_path, color]), fromprocess_input="sf") + DebugPrint("Installing Boot Animation...", fromprocess_input="sf") os.system('mount -o remount,rw /system') # /system read only, must mount as rw os.system('mv /system/media/bootanimation.zip {}/bootanimation.zip'.format(backup_dir)) # Backup os.system('cp {}/{}bootanimation.zip /system/media/bootanimation.zip'.format(install_from_path, color)) # Replace - os.system('chmod 666 /system/media/bootanimation.zip') # Need to chmod to edet permissions to 666 - print('\nBoot Animation installed! Original file(s) backed up to {}'.format(backup_dir)) - -def INSTALL_QT_SPINNER(backup_dir, opver, opdir, install_from_path, con_output): + os.system('chmod 666 /system/media/bootanimation.zip') + if re == False: # Need to chmod to edet permissions to 666 + print('#Boot Animation installed! Original file(s) backed up to {}'.format(backup_dir)) + elif re == True: + print('#Boot Animation Re-installed! Current file(s) backed up to {}'.format(backup_dir)) + +def INSTALL_QT_SPINNER(backup_dir, OP_INFO, install_from_path, con_output='', re=False): #INSTALL_QT_SPINNER + DebugPrint("INSTALL_QT_SPINNER() called".format([backup_dir, OP_INFO["OP_Location"], OP_INFO["OP_Version"], install_from_path]), fromprocess_input="sf") + flags=[] # Check if theme contributer provided a spinner logo - if path.exists('{}/img_spinner_comma.png'.format(install_from_path)): #Contibuter Did Provide - os.system('mv /data/{}/selfdrive/assets/img_spinner_comma.png {}/spinner'.format(opdir, backup_dir)) #Backup spinner logo - os.system('cp {}/img_spinner_comma.png /data/{}/selfdrive/assets'.format(install_from_path, opdir)) #Replace spinner logo supplied custom - custom_logo = True #Add custom_logo flag + if path.exists('{}/img_spinner_comma.png'.format(install_from_path)): #Contibuter Did Provide + DebugPrint("Installing logo...", fromprocess_input="sf") + os.system('mv {}/selfdrive/assets/img_spinner_comma.png {}/spinner'.format(OP_INFO["OP_Location"], backup_dir)) #Backup spinner logo + os.system('cp {}/img_spinner_comma.png {}/selfdrive/assets'.format(install_from_path, OP_INFO["OP_Location"])) #Replace spinner logo supplied custom + flags.append("custom_logo") #Add custom_logo flag # Check if theme contributer provided a spinner track - if path.exists('{}/img_spinner_track.png'.format(install_from_path)): #Contibuter Did Provide - os.system('mv /data/{}/selfdrive/assets/img_spinner_track.png {}/spinner'.format(opdir, backup_dir)) #Backup spinner track - os.system('cp {}/img_spinner_track.png /data/{}/selfdrive/assets'.format(install_from_path, opdir)) #Replace spinner track supplied custom - custom_track = True #Add custom_track flag #Add custom_C flag #Add custom_C flag - #if path.exists('{}/spinner.c'.format(install_from_path)) and opver == OP_VER <= 7.8: #Contibuter Did Provide - #os.system('mv /data/{}/selfdrive/common/spinner.c {}/spinner'.format(opdir, backup_dir)) #Backup spinner.c - #os.system('cp {}/spinner.c /data/{}/selfdrive/common'.format(install_from_path, opdir)) #Replace spinner.c with supplied custom - #custom_c = True #Add custom_C flag - - + if path.exists('{}/img_spinner_track.png'.format(install_from_path)): #Contibuter Did Provide + DebugPrint("Installing track...", fromprocess_input="sf") + os.system('mv {}/selfdrive/assets/img_spinner_track.png {}/spinner'.format(OP_INFO["OP_Location"], backup_dir)) #Backup spinner track + os.system('cp {}/img_spinner_track.png {}/selfdrive/assets'.format(install_from_path, OP_INFO["OP_Location"])) #Replace spinner track supplied custom + flags.append("custom_track") #Add custom_trackflag + # Check if theme contributer provided a spinner.c #Add custom_C flag #Add custom_C flag + #if path.exists('{}/spinner.c'.format(install_from_path)) and opver == OP_VER <= 7.8: #Contibuter Did Provide + #DebugPrint("Installing spinner.c...", fromprocess_input="sf") + #os.system('mv {}/selfdrive/common/spinner.c {}/spinner'.format(opdir, backup_dir)) #Backup spinner.c + #os.system('cp {}/spinner.c {}/selfdrive/common'.format(install_from_path, opdir)) #Replace spinner.c with supplied custom + #flags.append("custom_c") + if re == False: # Need to chmod to edet permissions to 666 + print('#OpenPilot Spinner installed! Original file(s) backed up to {}'.format(backup_dir)) + elif re == True: + print('#OpenPilot Spinner Re-installed! Current file(s) backed up to {}'.format(backup_dir)) #Add custom_C flag ## ================= Restor-er Code ================= ## # Created by @ShaneSmiskol modified version of get_aval_themes() to get all backups by Coltonton -def get_user_backups(exclude): +def get_user_backups(exclude): #Gets users backups in /sdcard/theme-backups available_backups = [t for t in os.listdir(BACKUPS_DIR)] available_backups = [t for t in available_backups if os.path.isdir(os.path.join(BACKUPS_DIR, t))] available_backups = [t for t in available_backups if t not in exclude] @@ -277,7 +331,6 @@ def get_user_backups(exclude): while 1: backup = input('\nChoose a backup to install (by index value): ').strip().lower() - print() if backup in ['exit', 'Exit', 'E', 'e', '0']: exit() if backup in ['r', 'R' and default_restore_exists == 1]: @@ -292,80 +345,102 @@ def get_user_backups(exclude): print('Please enter only Index number value!!') continue +def restore_comma_default(DeviceData, backup_dir): # Restore the device default theme + print('\nSelected to restore Comma-Default theme. Continue?') + print('Process is fully automagic!') + if not is_affirmative(): + return None -## ====================== Misc ====================== ## -def backup_overide_check(backup_dir, theme_type): - #Check if there was a backup already this session to prevent accidental overwrites - if path.exists('{}/{}'.format(backup_dir, theme_type)): - print('\nIt appears you already made a(n) {} install this session'.format(theme_type)) - print('continuing will overwrite the last {} backup'.format(theme_type)) - print('the program made this session already!!!') - print('Would you like to continue and overwrite previous?') - if not is_affirmative(): - print('Not installed.......') - return True - else: - os.mkdir('{}/{}'.format(backup_dir, theme_type)) - return False + print('Please wait..... This should only take a few moments!\n') + + #Boot-Logo + install_from_path = '{}/Comma-Default/{}'.format(CONTRIB_THEMES, DeviceData["BOOT_LOGO_THEME_PATH"]) + INSTALL_BOOT_LOGO(DeviceData, backup_dir, install_from_path) + + #Boot-Animation + install_from_path = '{}/Comma-Default/'.format(CONTRIB_THEMES) + INSTALL_BOOTANIMATION(backup_dir, install_from_path) + + print('\nThank you come again! - Boot Logo & Boot Animation factory restored!!') + exit() + +######################################################### +## ====================== Misc ======================= ## +######################################################### +'''def set_running(data): + with open('person.txt', 'w') as json_file: + json.dump(data, json_file) + +def get_running(): + with open('./support/vars.json', 'r') as f: + datadict = json.load(f) + x = datadict['Launched Program'] + return x +''' +def REBOOT(): #Reboot EON Device + print('\nRebooting.... Thank You, Come Again!!!\n\n########END OF PROGRAM########\n') + os.system('am start -a android.intent.action.REBOOT') # reboot intent is safer (reboot sometimes causes corruption) + sys.exit() + +def QUIT_PROG(): # Terminate Program friendly + print('\nThank you come again! You will see your changes next reboot!\n\n########END OF PROGRAM########\n') + sys.exit() -def setVerbose(a=False): +def str_sim(a, b): # Part of @ShaneSmiskol's get_aval_themes code + return difflib.SequenceMatcher(a=a, b=b).ratio() + +######################################################### +## ==================== DEV/Debug ==================== ## +######################################################### +def setVerbose(a=False): #Set Verbosity (DEPRICATED) if a == True: con_output = ' >/dev/null 2>&1' # string to surpress output else: con_output = '' # string to surpress output print('[DEBUG MSG]: Verbose ' + a) -def DebugPrint(msg, fromprocess_input="null", overide=0, multi=0): - if VERBOSE == True or overide == 1: +def DebugPrint(msg, fromprocess_input="null", overide=0, multi=0): #My own utility for debug msgs + if VERBOSE == True or DEVMODE == True or overide == 1: now = datetime.now() debugtime = now.strftime("%m/%d %I:%M.%S") - runprocess = get_running() + runprocess = "theme_install.py" fromprocess_input = runprocess if fromprocess_input == "null" else fromprocess_input if fromprocess_input == "sf": runprocess = (runprocess.strip(".py")+"/support/support_functions.py") - if multi > 0: - if multi == 1: - print("*[DEBUG][{} {}] || GOT MULTIPLE DATA".format(debugtime, runprocess)) - print("--> {}".format(msg))#] #Debug Msg ()s - elif multi == 0: - print("*[DEBUG][{} {}] || {}".format(debugtime, runprocess, msg))#] #Debug Msg ()s - -def set_running(data): - with open('person.txt', 'w') as json_file: - json.dump(data, json_file) - -def get_running(): - with open('./support/vars.json', 'r') as f: - datadict = json.load(f) - x = datadict['Launched Program'] - return x + if type(multi) == list: + print("\n##[DEBUG][{} {}] || GOT MULTIPLE DATA".format(debugtime, runprocess)) + print("##[DEBUG] {}".format(msg)) + for x in range(len(multi)): + print("--> {}".format(multi[x])), + else: + print("##[DEBUG][{} {}] || {}".format(debugtime, runprocess, msg))#] #Debug Msg ()s -def DEV_CHECK(): +def DEV_CHECK(): #Hault Program If Ran On PC/Mac global DEV_PLATFORM, DEVMODE, VERBOSE # Simple if PC check, not needed but nice to have DEV_PLATFORM = platform.system() - print(DEV_PLATFORM) if DEV_PLATFORM in ['Windows', 'Darwin']: + print(DEV_PLATFORM) print("This program only works on Comma EONS & Comma Two, sorry...") print("Press enter to exit.") u = input('') - if u == "devmode3t": + if u == "override": print('EON DEVMODE enabled, proceed with great caution!') VERBOSE = True DEVMODE = True else: sys.exit() -def REBOOT(): - print('\nRebooting.... Thank You, Come Again!!!') - os.system('am start -a android.intent.action.REBOOT') # reboot intent is safer (reboot sometimes causes corruption) - sys.exit() - -def QUIT_PROG(): - print('\nThank you come again! You will see your changes next reboot!\n') - sys.exit() - -# Created by @ShaneSmiskol -def str_sim(a, b): # Part of Shane's get_aval_themes code - return difflib.SequenceMatcher(a=a, b=b).ratio() \ No newline at end of file +def Dev_DoInstall(): #Function to ask before installing for use in dev to not screw up my computer, and test logic + if DEVMODE == True: + DebugPrint("Developer Mode enabled do you actually want to install?", overide="sf") + DebugPrint("Type 'install' to install or press enter to skip.", overide="sf") + askinstall = input("## ").lower().strip() + if askinstall == "install": + return True + else: + DebugPrint("Install Skipped...", overide="sf") + return False + else: + return True diff --git a/support/support_variables.py b/support/support_variables.py index 941b03c..104a314 100755 --- a/support/support_variables.py +++ b/support/support_variables.py @@ -1,10 +1,13 @@ #!/usr/bin/python # =================== Misc vars =================== ## -SHOW_CONSOLE_OUTPUT = False # Show the console output when 'make' is called? +EON_CUSTOM_THEMES_VER = "1.2" # This Softwares Version +#SHOW_CONSOLE_OUTPUT = False # Show the console output when 'make' is called? VERBOSE = False DEVMODE = False DEV_PLATFORM = "" -EON_CUSTOM_THEMES_VER = "1.2" # This Softwares Version +VALID_BOOT_ANIMATIONS = ['Boot Animation', 'Color Boot Animation', 'White Boot Animation'] +IS_AFFIRMATIVE_YES = ['yes', 'ye', 'y', '1', "j", "ja", "si", "s"] +IS_AFFIRMATIVE_UNSURE = ['i guess', 'sure', 'fine', 'whatever', 'idk', 'why', "uh", "um", "...", "bite me", "eat my shorts"] # ============== Backup related vars ============== ## BACKUPS_DIR = '/storage/emulated/0/theme-backups' if not DEVMODE else './test-theme-backups' @@ -16,10 +19,10 @@ MIN_SIM_THRESHOLD = 0.25 # user's input needs to be this percent or higher similar to a theme to select it # =========== Get OP Ver & Location vars =========== ## -OP_VER = 0.1 -OP_LOC = '' +OP_Version = 0.0 +OP_Location = '' -# ================= Welcome Texts ================= ## +# ===================== Texts ====================== ## WELCOME_TEXT = ['Created By: Colton (Brandon) S. EndLine \\n', 'Special Thanks to @ShaneSmiskol for all the help!!!', 'Free to use! Free to Edit! Free to integrate!', @@ -41,13 +44,15 @@ "'cd /data && git clone https://github.com/Coltonton/eon-custom-themes.git'", "Then cd exec /data/eon-custom-themes/install_theme.py", ' to use the full program! Installing a theme manually', - 'blocks this auto installer from overwriting!'] + 'blocks this auto installer from overwriting!', + 'Version {}'.format(EON_CUSTOM_THEMES_VER)] RESTORE_WELCOME_TEXT = ['Created By: Colton (Brandon) S. EndLine \\n', 'Special Thanks to @ShaneSmiskol for all the help!!!', 'Free to use! Free to Edit! Free to integrate!', 'Design and contribute your themes today!', '(See the developer folder in this repo)', 'It\'s your EON, do what you want!', + 'Version {}'.format(EON_CUSTOM_THEMES_VER), ' ', '*NOTE* this is the backup & default restore program'] UTIL_WELCOME_TEXT = ['Created By: Colton (Brandon) S. EndLine \\n', @@ -56,15 +61,18 @@ 'Design and contribute your themes today!', '(See the developer folder in this repo)', 'It\'s your EON, do what you want!', + 'Version {}'.format(EON_CUSTOM_THEMES_VER), ' ', '*NOTE* this is the theme utility program for misc functions'] - -CLEANUP_TEXT = ['\n\nWelcome to the uninstall - cleanup utility', +CLEANUP_TEXT = ['Welcome to the uninstall - cleanup utility', + 'Version {}'.format(EON_CUSTOM_THEMES_VER), + ' ', "I'm sad to see you go... :", - '\nThis program removes the following files not stored in the main directory:', + 'This program removes the following files not stored in the main directory:', '- WARNING!!!! ALL BACKUPS!!! Stored in /sdcard/theme-backups', '- eon_custom_themes_self_installed.txt in /sdcard used as a marker to the auto installer', - '\nIt does not remove:', + ' ', + 'It does not remove:', '- The main project directory', "- Any installed themes, please run 'Restore Comma-default' from", 'this program to restore the comma-default boot logo and boot animation', diff --git a/theme_install.py b/theme_install.py index 3f97950..f7173ef 100755 --- a/theme_install.py +++ b/theme_install.py @@ -52,19 +52,22 @@ # And incorparate it into your OP Fork? # # # ################################################################################## -from support.support_variables import EON_CUSTOM_THEMES_VER - -import time, os, platform -import json +import time, os from os import path from support.support_functions import * -from support.support_variables import BACKUPS_DIR, BACKUP_OPTIONS, CONTRIB_THEMES, OP_VER, OP_LOC, VERBOSE,SHOW_CONSOLE_OUTPUT, WELCOME_TEXT, DEV_PLATFORM - - +from support.support_variables import * -##======================= CODE START ================================================================ +###################################################################################################### +##======================= CODE START ================================================================# +###################################################################################################### os.chdir(os.path.dirname(os.path.realpath(__file__))) # __file__ is safer since it doesn't change based on where this file is called from +print_text(WELCOME_TEXT) # Print welcome text with the flag for self welcome text +DebugPrint("VERBOSE MODE ON") # Notify if Verbosity Mode is on, DebugPrints only run in dev or verbose mode +DEV_CHECK() # Check if running on unsupported PC/MAC +OpInfo = dict # Init OPInfo Dict +DeviceData = get_device_theme_data() # Init Device Data dict with device info + print_text(WELCOME_TEXT) #Print welcome text with the flag for self welcome text DebugPrint("DEBUG ON") #RunningProcess = json.loads(data.json) @@ -74,25 +77,31 @@ DeviceData = get_device_theme_data() # Get Perams based off detected device class ThemeInstaller: def __init__(self): # Init code runs once. sets up & determines if to run auto or self - get_running() - self.start_loop() # Do self install theme git # Terminate program + #get_running() # Get Running Process + self.start_loop() # Do self install theme git # Terminate program def start_loop(self): # Self Installer loop # Create Backup folder(if nonexistant) and Create session backup and get location self.backup_dir = make_backup_folder() + + #Main Program (loop) while 1: - self.selected_theme = get_aval_themes() - if self.selected_theme == 'devmode' and DEVMODE == False: + # Auto discover themes and let user choose! + self.selected_theme = get_aval_themes() + if self.selected_theme == 'debug' and VERBOSE == False: VERBOSE == True - DebugPrint("Debug Functionality On!") - elif self.selected_theme == 'devmode' and DEVMODE == True: + DebugPrint("Debug Level Verbose On!") + elif self.selected_theme == 'debug' and VERBOSE == True: VERBOSE = False - DebugPrint("Debug Functionality Off!", 1) + DebugPrint("Debug Level Verbose Off!", 1) if self.selected_theme is None: print('Didn\'t select a valid theme, exiting.') return - OP_INFO = get_OP_Ver_Loc() + + # Check what assets are available for the selected theme self.get_available_options() + + #Goto Installer if self.install_function() == 'exit': return @@ -111,15 +120,14 @@ def get_available_options(self): # Check what assets are available for the if os.path.exists('{}/{}/white_bootanimation.zip'.format(CONTRIB_THEMES, self.selected_theme)): self.theme_options.append('White Boot Animation') # Check if the selected theme has a OpenPilot Spinner asset - #if os.path.exists('{}/{}/spinner'.format(CONTRIB_THEMES, self.selected_theme)): - #self.theme_options.append('OpenPilot Spinner') + if os.path.exists('{}/{}/spinner'.format(CONTRIB_THEMES, self.selected_theme)) : + self.theme_options.append('OpenPilot Spinner') self.theme_options.append('-Main Menu-') self.theme_options.append('-Reboot-') self.theme_options.append('-Quit-') def install_function(self): # Self installer program, prompts user on what they want to do - while 1: theme_types = list(self.theme_options) # this only contains available options from self.get_available_options if not len(theme_types): @@ -129,89 +137,133 @@ def install_function(self): # Self installer program, prompts user on #Ask users what resources to install print('\n*\nWhat resources do you want to install for the {} theme?'.format(self.selected_theme)) + print("NEW! Use commas to seperate multiple selections ex '1,2' for option 1 & 2") for idx, theme in enumerate(theme_types): print('{}. {}'.format(idx + 1, theme)) - indexChoice = int(input("Enter Index Value: ")) - indexChoice -= 1 - - selected_option = self.theme_options[indexChoice] - - #Main logic - if selected_option == 'Boot Logo': - #Confirm user wants to install bootlogo - print('\nSelected to install the {} Boot Logo. Continue?'.format(self.selected_theme)) - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - - print('\nPlease wait....') - - #Check if there was an Boot logo backup already this session to prevent accidental overwrites - #Returns true if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, DeviceData["BOOT_LOGO_NAME"]) == True: - break - - #Backup & install new - install_from_path = ('{}/{}/{}'.format(CONTRIB_THEMES, self.selected_theme, DeviceData["BOOT_LOGO_THEME_PATH"])) - INSTALL_BOOT_LOGO(DeviceData["EON_TYPE"], self.backup_dir, install_from_path) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() - elif selected_option == 'OpenPilot Spinner': - ##Confirm user wants to install Spinner - print('\nSelected to install the {} OP Spinner. Continue?'.format(self.selected_theme)) - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - - ##Check if there was a spinner backup already this session to prevent accidental overwrites - #Returns false if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, 'spinner') == True: - break - - install_from_path = ("{}/{}/spinner".format(CONTRIB_THEMES, self.selected_theme)) - INSTALL_QT_SPINNER(self.backup_dir, OpInfo["OP_VER"], OpInfo["OP_LOC"], install_from_path) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() - elif selected_option == '-Main Menu-' or selected_option is None: - return - elif selected_option == '-Reboot-': - REBOOT() - exit() - elif selected_option == '-Quit-' or selected_option is None: - QUIT_PROG() - elif selected_option == 'Boot Animation' or 'Color Boot Animation' or 'White Boot Animation': - #Confirm user wants to install bootlogo - print('\nSelected to install the {} {}. Continue?'.format(self.selected_theme, selected_option)) - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - - #Check if there was a boot ani backup already this session to prevent accidental overwrites - #Returns true if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, 'bootanimation.zip') == True: - break - - #Set bootAniColor based off the selected option - if 'white_', 'color_', or standard bootanimation - if selected_option == 'Boot Animation': - bootAniColor = '' - elif selected_option == 'Color Boot Animation': - bootAniColor = 'color_' - elif selected_option == 'White Boot Animation': - bootAniColor = 'white_' - - #Backup And install new bootanimation - install_from_path = ('{}/{}'.format(CONTRIB_THEMES, self.selected_theme)) - INSTALL_BOOTANIMATION(self.backup_dir, install_from_path, bootAniColor) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() - + indexChoice = input("Enter Index Value: ") + indexChoice.replace(" ", "") + indexChoiceList = indexChoice.split(",") + + selected_option_list= [] + for x in range(len(indexChoiceList)): + runOne = int(indexChoiceList[x]) + selected_option_list.append(self.theme_options[runOne-1]) + + # Some logic that only allows one boot animation to be installed + onlyOneBootAnimation = [] + for y in range(len(selected_option_list)): # Enumerate through list + if selected_option_list[y] in VALID_BOOT_ANIMATIONS: # If current item is a Valid Boot Animation selection + onlyOneBootAnimation.append(selected_option_list[y]) # Add to a new list to keep track + if len(onlyOneBootAnimation) > 1: # If there was more then one selection + for z in range(len(onlyOneBootAnimation)): # Enumerate through said new list and + selected_option_list.remove(onlyOneBootAnimation[z]) # remove all boot animation selelctions + while True: + print("\n*\nOnly one boot animation is permitted to install, please select for {} theme.".format(self.selected_theme)) + for idx, theme in enumerate(onlyOneBootAnimation): # Enumerate multiple boot animation list + print('{}. {}'.format(idx + 1, theme)) # Print to screen + realAnimationChoice = int(input("Enter Index Value: ")) # Ask user to select one + if realAnimationChoice <= len(onlyOneBootAnimation): # User input was valid + selected_option_list.append(onlyOneBootAnimation[realAnimationChoice-1]) # Add their selection to the stack!! + break + else: # User input was not valid + print("Invalid Index... Try Again...") + + # Some logic to not give stupid results to stupid people i.e. reboot should come after all installs and we really dont need to go to the main menu too... + if "-Reboot-" in selected_option_list: #If Reeboot is selected remove Main Menu, Quit, and ensure its at the end + if "-Main Menu-" in selected_option_list: selected_option_list.remove("-Main Menu-") #Remove Main Menu as we dont need it... + if "-Quit-" in selected_option_list:selected_option_list.remove("-Quit-") #Remove Quit as we dont need it... + selected_option_list.remove("-Reboot-") #Pop Reboot out so we can + selected_option_list.append("-Reboot-") #Put it on the end! + if "-Quit-" in selected_option_list: #If Quit is selected remove Main Menu, and ensure its at the end + if "-Main Menu-" in selected_option_list: selected_option_list.remove("-Main Menu-") #Remove Main Menu as we dont need it... + selected_option_list.remove("-Quit-") #Pop Quit out so we can + selected_option_list.append("-Quit-") #Put it on the end! + if "-Main Menu-" in selected_option_list: #If Main Menu is Selected ensure its at the end + selected_option_list.remove("-Main Menu-") #Pop Quit out so we can + selected_option_list.append("-Main Menu-") #Put it on the end! + + DebugPrint("Selected Options: ", multi=selected_option_list) + + for z in range(len(selected_option_list)): + #Main logic + if selected_option_list[z] == 'Boot Logo': + #Confirm user wants to install bootlogo + print('\n*\nSelected to install the {} Boot Logo. Continue?'.format(self.selected_theme)) + if not is_affirmative(): + print('Not installing...') + time.sleep(1.5) + continue + + print('\nPlease wait....') + + #Check if there was an Boot logo backup already this session to prevent accidental overwrites + #Returns true if okay to proceed. Gets self.backup_dir & asset type name + if backup_overide_check(self.backup_dir, DeviceData["BOOT_LOGO_NAME"]) == True: + break + + #Backup & install new + install_from_path = ('{}/{}/{}'.format(CONTRIB_THEMES, self.selected_theme, DeviceData["BOOT_LOGO_THEME_PATH"])) + if Dev_DoInstall(): + INSTALL_BOOT_LOGO(DeviceData, self.backup_dir, install_from_path) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() + elif selected_option_list[z] == 'OpenPilot Spinner': + ##Confirm user wants to install Spinner + print('\n*\nSelected to install the {} OP Spinner. Continue?'.format(self.selected_theme)) + if not is_affirmative(): + continue + + ##Check if there was a spinner backup already this session to prevent accidental overwrites + #Returns false if okay to proceed. Gets self.backup_dir & asset type name + if backup_overide_check(self.backup_dir, 'spinner') == True: + break + + #Gets OpenPilot Location and Version + OP_INFO = get_OP_Ver_Loc() + DebugPrint("Got OP Location: {} and Version 0.{}".format(OP_INFO["OP_Location"], OP_INFO["OP_Version"])) + + #Backup & Install + install_from_path = ("{}/{}/spinner".format(CONTRIB_THEMES, self.selected_theme)) + #Function to ask before installing for use in dev to not screw up my computer, and test logic + if Dev_DoInstall(): + INSTALL_QT_SPINNER(self.backup_dir, OP_INFO, install_from_path) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() + elif selected_option_list[z] == '-Main Menu-' or selected_option_list[z] is None: + return + elif selected_option_list[z] == '-Reboot-': + REBOOT() + exit() + elif selected_option_list[z] == '-Quit-': + QUIT_PROG() + elif selected_option_list[z] in VALID_BOOT_ANIMATIONS: + #Confirm user wants to install bootlogo + print('\n*\nSelected to install the {} {}. Continue?'.format(self.selected_theme, selected_option_list[z])) + if not is_affirmative(): + continue + + #Check if there was a boot ani backup already this session to prevent accidental overwrites + #Returns true if okay to proceed. Gets self.backup_dir & asset type name + if backup_overide_check(self.backup_dir, 'bootanimation.zip') == True: + break + + #Set bootAniColor based off the selected option - if 'white_', 'color_', or standard bootanimation + if selected_option_list[z] == 'Boot Animation': + bootAniColor = '' + elif selected_option_list[z] == 'Color Boot Animation': + bootAniColor = 'color_' + elif selected_option_list[z] == 'White Boot Animation': + bootAniColor = 'white_' + #Backup And install new bootanimation + install_from_path = ('{}/{}'.format(CONTRIB_THEMES, self.selected_theme)) + if Dev_DoInstall(): + INSTALL_BOOTANIMATION(self.backup_dir, install_from_path, bootAniColor) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() if __name__ == '__main__': ti = ThemeInstaller() diff --git a/theme_restore.py b/theme_restore.py new file mode 100755 index 0000000..10e97e5 --- /dev/null +++ b/theme_restore.py @@ -0,0 +1,179 @@ +#!/usr/bin/python +################################################################################### +# VER 1.2 # + # # + # Permission is granted to anyone to use this software for any purpose, # + # excluding commercial applications, and to alter it and redistribute it # + # freely, subject to the following restrictions: # + # # + # 1. The origin of this software must not be misrepresented; you must not # + # claim that you wrote the original software. If you use this software # + # in a product, an acknowledgment in the product documentation is required. # + # # + # 2. Altered source versions must be plainly marked as such, and must not be # + # misrepresented as being the original software. # + # # + # 3. This notice may not be removed or altered from any source # + # distribution. # + # # + # # + # ==Created by Colton (Brandon) S. (@Coltonton) for the OpenPilot Community=== # + # === http://endoflinetech.com/eon-custom-themes === # + # # + # With a mission to rid all EONS of Comma.ai branding # + # And give the people the freedom, knowlage, and power! # + # & to make their EONS purdy! # + # # + # Grab life by the horns # + # # + # A very special thank you to @ShaneSmiskol for creating the theme picker # + # for his tireless help, and donating the life of his LeEco EON # + # to get the LeEco based EONs supported by this project # + # Although revived least we forget..... # + ################################################################################## + # # + # To Get Started Making Your EON Purdy: # + # # + # SSH into your EON: # + #https://github.com/commaai/openpilot/wiki/SSH#option-3---githubs-official-instructions# # + # # + # Type the following command if using the main project # + # exec /data/eon-custom-themes/theme_install.py # + + # # + # Now follow the prompts and make your selections! # + # Everything will be done automagically!!!!! # + # # + # Don't forget to tell your friends!! # + # Love, Cole (@Coltonton) # + # # + # Did you know that soontm if you have a custom OP fork you can use this # + # program to auto install your custom theme for your users automagiclly? # + # And incorparate it into your OP Fork? # + # # +################################################################################## +import os +import time +from os import path +from support.support_variables import BACKUPS_DIR, BACKUP_OPTIONS +from support.support_functions import * + +###################################################################################################### +##======================= CODE START ================================================================# +###################################################################################################### +os.chdir(os.path.dirname(os.path.realpath(__file__))) # __file__ is safer since it doesn't change based on where this file is called from +print_text(RESTORE_WELCOME_TEXT) # Print welcome text with the flag for self welcome text +DebugPrint("VERBOSE MODE ON") # Notify if Verbosity Mode is on, DebugPrints only run in dev or verbose mode +DEV_CHECK() # Check if running on unsupported PC/MAC +OpInfo = dict # Init OPInfo Dict +DeviceData = get_device_theme_data() # Init Device Data dict with device info + +class ThemeRestorer: + def __init__(self): # Init code runs once. sets up. + self.backup_dir = make_backup_folder() # Create and get backup folder + self.theme_restore_loop() # Start main loop + + def theme_restore_loop(self): # Theme_restorer! + # Backup_restore Loop + while 1: + self.selected_backup = get_user_backups(self.backup_dir) + if self.selected_backup is None: + print('Didn\'t select a backup, exiting.') + return + if self.selected_backup == 'Comma-Default': + self.restore_default_comma() + self.backup_get_available_options() + if self.backup_reinstall_function() == 'exit': + return + + def backup_get_available_options(self): # Check what assets are available for the selected backup + # Check if the selected backup has a boot logo asset + if os.path.exists('{}/{}/{}'.format(BACKUPS_DIR, self.selected_backup, DeviceData["BOOT_LOGO_NAME"])): + BACKUP_OPTIONS.append('Boot Logo') + + # Check if the selected backup has a boot annimation asset + if os.path.exists('{}/{}/bootanimation.zip'.format(BACKUPS_DIR, self.selected_backup)): + BACKUP_OPTIONS.append('Boot Animation') + + # Check if the selected backup has a OpenPilot Spinner asset + if os.path.exists('{}/{}/spinner'.format(BACKUPS_DIR, self.selected_backup)): + BACKUP_OPTIONS.append('OpenPilot Spinner') + + BACKUP_OPTIONS.append('-Main Menu-') + BACKUP_OPTIONS.append('-Reboot-') + BACKUP_OPTIONS.append('-Quit-') + + def backup_reinstall_function(self): # Backuo re-installer program, prompts user on what they want to do + while 1: + options = list(BACKUP_OPTIONS) # this only contains available options from self.get_available_options + if not len(options): + print('The selected backup has no resources available for your device! Try another.') + time.sleep(2) + return + + print('What resources do you want to install for the {} backup?'.format(self.selected_backup)) + for idx, theme in enumerate(options): + print('{}. {}'.format(idx + 1, theme)) + indexChoice = int(input("Enter Index Value: ")) + + selected_option = BACKUP_OPTIONS[indexChoice-1] + + if selected_option == 'Boot Logo': + print('Selected to install the Boot Logo backup. Continue?') + if not is_affirmative(): + continue + + #Backup & install new + install_from_path = ('{}/{}/{}'.format(BACKUPS_DIR, self.selected_backup, DeviceData["BOOT_LOGO_THEME_PATH"], re=True)) + if Dev_DoInstall(): + INSTALL_BOOT_LOGO(DeviceData, self.backup_dir, install_from_path) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() + elif selected_option == 'Boot Animation': + print('Selected to install the Boot Animation backup. Continue?') + if not is_affirmative(): + continue + + #Backup And install new bootanimation + install_from_path = ('{}/{}'.format(BACKUPS_DIR, self.selected_backup)) + if Dev_DoInstall(): + INSTALL_BOOTANIMATION(self.backup_dir, install_from_path, re=True) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() + elif selected_option == 'OpenPilot Spinner': + ##Confirm user wants to install Spinner + print('\nSelected to install the {} OP Spinner. Continue?'.format(self.selected_theme)) + if not is_affirmative(): + continue + + ##Check if there was a spinner backup already this session to prevent accidental overwrites + #Returns false if okay to proceed. Gets self.backup_dir & asset type name + if backup_overide_check(self.backup_dir, 'spinner') == True: + break + + #Gets OpenPilot Location and Version + OP_INFO = get_OP_Ver_Loc() + DebugPrint("Got OP Location: {} and Version 0.{}".format(OP_INFO["OP_Location"], OP_INFO["OP_Version"])) + + #Backup & Install + install_from_path = ("{}/{}/spinner".format(BACKUPS_DIR, self.selected_backup)) + #Function to ask before installing for use in dev to not screw up my computer, and test logic + if Dev_DoInstall(): + INSTALL_QT_SPINNER(self.backup_dir, OP_INFO, install_from_path, re=True) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() + elif selected_option == '-Main Menu-' or selected_option is None: + return + elif selected_option == '-Reboot-': + REBOOT() + elif selected_option == '-Quit-': + QUIT_PROG() + + def restore_default_comma(self): # Restore the devices default theme + restore_comma_default(DeviceData, self.backup_dir) + +if __name__ == '__main__': + bi = ThemeRestorer() diff --git a/theme_restore_.py b/theme_restore_.py deleted file mode 100755 index abe0a3e..0000000 --- a/theme_restore_.py +++ /dev/null @@ -1,272 +0,0 @@ -#!/usr/bin/python -################################################################################### -# VER 1.2 # - # # - # Permission is granted to anyone to use this software for any purpose, # - # excluding commercial applications, and to alter it and redistribute it # - # freely, subject to the following restrictions: # - # # - # 1. The origin of this software must not be misrepresented; you must not # - # claim that you wrote the original software. If you use this software # - # in a product, an acknowledgment in the product documentation is required. # - # # - # 2. Altered source versions must be plainly marked as such, and must not be # - # misrepresented as being the original software. # - # # - # 3. This notice may not be removed or altered from any source # - # distribution. # - # # - # # - # ==Created by Colton (Brandon) S. (@Coltonton) for the OpenPilot Community=== # - # === http://endoflinetech.com/eon-custom-themes === # - # # - # With a mission to rid all EONS of Comma.ai branding # - # And give the people the freedom, knowlage, and power! # - # & to make their EONS purdy! # - # # - # Grab life by the horns # - # # - # A very special thank you to @ShaneSmiskol for creating the theme picker # - # for his tireless help, and donating the life of his LeEco EON # - # to get the LeEco based EONs supported by this project # - # Although revived least we forget..... # - ################################################################################## - # # - # To Get Started Making Your EON Purdy: # - # # - # SSH into your EON: # - #https://github.com/commaai/openpilot/wiki/SSH#option-3---githubs-official-instructions# # - # # - # Type the following command if using the main project # - # exec /data/eon-custom-themes/theme_install.py # - - # # - # Now follow the prompts and make your selections! # - # Everything will be done automagically!!!!! # - # # - # Don't forget to tell your friends!! # - # Love, Cole (@Coltonton) # - # # - # Did you know that soontm if you have a custom OP fork you can use this # - # program to auto install your custom theme for your users automagiclly? # - # And incorparate it into your OP Fork? # - # # -################################################################################## -from support.support_variables import EON_CUSTOM_THEMES_VER -print('EON Custom Themes Version '+ EON_CUSTOM_THEMES_VER) - -import os -import time -from os import path -from support.support_variables import BACKUPS_DIR, BACKUP_OPTIONS, CONTRIB_THEMES -from support.support_functions import get_device_theme_data, get_user_backups, is_affirmative, make_backup_folder, mark_self_installed, print_text - - -##======================= CODE START ================================================================ -os.chdir(os.path.dirname(os.path.realpath(__file__))) # __file__ is safer since it doesn't change based on where this file is called from -print_text('restore') #Print welcome text with the flag for restore welcome text -DeviceData = get_device_theme_data() # Get Perams based off detected device - -class ThemeRestorer: - def __init__(self): # Init code runs once. sets up. - self.backup_dir = make_backup_folder() # Create and get backup folder - self.theme_restore_loop() # Start main loop - - def theme_restore_loop(self): # Theme_restorer! - # Backup_restore Loop - while 1: - self.selected_backup = get_user_backups(self.backup_dir) - if self.selected_backup is None: - print('Didn\'t select a backup, exiting.') - return - if self.selected_backup == 'Comma-Default': - self.restore_default_comma() - self.backup_get_available_options() - if self.backup_reinstall_function() == 'exit': - return - - def backup_get_available_options(self): # Check what assets are available for the selected backup - # Check if the selected backup has a APK asset - #if os.path.exists('{}/{}/spinner'.format(BACKUPS_DIR, self.selected_backup)): - # BACKUP_OPTIONS.append('APK') - - # Check if the selected backup has a boot logo asset - if os.path.exists('{}/{}/{}'.format(BACKUPS_DIR, self.selected_backup, BOOT_LOGO_NAME)): - BACKUP_OPTIONS.append('Boot Logo') - - # Check if the selected backup has a boot annimation asset - if os.path.exists('{}/{}/bootanimation.zip'.format(BACKUPS_DIR, self.selected_backup)): - BACKUP_OPTIONS.append('Boot Animation') - - # Check if the selected backup has a OpenPilot Spinner asset - if os.path.exists('{}/{}/spinner'.format(BACKUPS_DIR, self.selected_backup)): - BACKUP_OPTIONS.append('OpenPilot Spinner') - - # Check if the selected backup has a APK asset - #if os.path.exists('{}/{}/spinner'.format(BACKUPS_DIR, self.selected_backup)): - # BACKUP_OPTIONS.append('APK') - - # if os.path.exists('{}/{}/additional'.format(BACKUPS_DIR, self.selected_backup)): # todo disabled for now - # self.BACKUP_OPTIONS.append('4. Additional Resources') - - BACKUP_OPTIONS.append('-Main Menu-') - BACKUP_OPTIONS.append('-Reboot-') - BACKUP_OPTIONS.append('-Quit-') - - def backup_reinstall_function(self): # Backuo re-installer program, prompts user on what they want to do - while 1: - options = list(BACKUP_OPTIONS) # this only contains available options from self.get_available_options - if not len(options): - print('The selected backup has no resources available for your device! Try another.') - time.sleep(2) - return - - print('What resources do you want to install for the {} backup?'.format(self.selected_backup)) - for idx, theme in enumerate(options): - print('{}. {}'.format(idx + 1, theme)) - indexChoice = int(input("Enter Index Value: ")) - indexChoice -= 1 - - selected_option = BACKUP_OPTIONS[indexChoice] - - # if selected_option == 'APK': - # print('Selected to install the APK backup. Continue?') - # if not is_affirmative(): - # print('Not installing...') - # time.sleep(1.5) - # continue - # os.system('cp /data/openpilot/apk/ai.comma.plus.offroad.apk {}'.format(self.backup_dir)) # Make Backup - # os.system('dd if={}/{}/{} of={}'.format(BACKUPS_DIR, self.selected_backup, BOOT_LOGO_NAME, BOOT_LOGO_PATH)) # Replace - # print('\nBoot Logo re-installed successfully! Original backed up to {}'.format(self.backup_dir)) - # print('Press enter to continue!') - # mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - # input() - - - - # #Confirm user wants to install APK - # print('Selected to install the {} APK backup. Continue?'.format(self.selected_theme)) - # if not is_affirmative(): - # print('Not installing...') - # time.sleep(1.5) - # continue - - # #Check if there was a backup already this session to prevent accidental overwrites - # if path.exists('{}/spinner'.format(self.backup_dir)): - # print('It appears you already made a APK install this session') - # print('continuing will overwrite the last APK backup') - # print('the program made this session already!!!') - # print('Would you like to continue and overwrite previous?') - # if not is_affirmative(): - # print('Not installed, exiting session..... Please re-run program') - # exit() #Exit program if user does not want to overwrite, so they can start a new session - # else: - # os.mkdir('{}/spinner'.format(self.backup_dir)) - - # #Ask user if their OP directory is custom (like arnepilot / dragonpilot) - # print('Do you have an OP fork with a custom directory name? (ex. arnepilot, dragonpilot)') # Ask the user if their OP fork used a diffrent directory. - # if is_affirmative(): # Yes there is a custom OP dir - # print('What is the OP directory name? (case matters, not including /data/)') - # opdir = '/data/{}'.format(input('> ').strip('/')) # get custom dir name, strip slashes for safety - # print('Your openpilot directory is {}'.format(opdir)) - # input('*** Please enter to continue, or Ctrl+C to abort if this is incorrect! ***') - # else: - # opdir = 'openpilot' #op directory is not custom so openpilot - if selected_option == 'Boot Logo': - print('Selected to install the Boot Logo backup. Continue?') - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - os.system('cp {} {}'.format(BOOT_LOGO_PATH, self.backup_dir)) # Make Backup - os.system('dd if={}/{}/{} of={}'.format(BACKUPS_DIR, self.selected_backup, BOOT_LOGO_NAME, BOOT_LOGO_PATH)) # Replace - print('\nBoot Logo re-installed successfully! Original backed up to {}'.format(self.backup_dir)) - print('Press enter to continue!') - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - input() - elif selected_option == 'Boot Animation': - print('Selected to install the Boot Animation backup. Continue?') - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - - os.system('mount -o remount,rw /system') # /system read only, must mount as r/w - os.system('mv /system/media/bootanimation.zip {}/bootanimation'.format(self.backup_dir)) # backup - os.system('cp {}/{}/bootanimation/bootanimation.zip /system/media/bootanimation.zip'.format(BACKUPS_DIR, self.selected_backup)) # replace - os.system('chmod 666 /system/media/bootanimation.zip') - print('\nBoot Animation re-installed successfully! Original backed up to {}'.format(self.backup_dir)) - print('Press enter to continue!') - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - input() - elif selected_option == 'OpenPilot Spinner': - #Confirm user wants to install Spinner - print('Selected to install the {} OP Spinner backup. Continue?'.format(self.selected_theme)) - if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) - continue - - ##Check if there was a spinner backup already this session to prevent accidental overwrites - #Returns false if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, 'spinner') == True: - exit() - - ##Ask user if their OP directory is custom (like arnepilot / dragonpilot) - opdir = op_dir_finder() - - ##Backup & Copy in relevant files - # Check if backup has a spinner logo - if path.exists('{}/{}/spinner/img_spinner_comma.png'.format(CONTRIB_THEMES, self.selected_theme)): #Backup does haz - os.system('mv /data/{}/selfdrive/assets/img_spinner_comma.png {}/spinner'.format(opdir, self.backup_dir)) #Backup logo - os.system('cp {}/{}/spinner/img_spinner_comma.png /data/{}/selfdrive/assets'.format(BACKUPS_DIR, self.selected_backup, opdir)) #Replace logo - # Check if backup has a spinner track - if path.exists('{}/{}/spinner/img_spinner_track.png'.format(CONTRIB_THEMES, self.selected_theme)): #Backup does haz - os.system('mv /data/{}/selfdrive/assets/img_spinner_track.png {}/spinner'.format(opdir, self.backup_dir)) #Backup sprinner track - os.system('cp {}/{}/spinner/img_spinner_track.png /data/{}/selfdrive/assets'.format(BACKUPS_DIR, self.selected_backup, opdir)) #Replace spinner - # Check if backup has a spinner.c - elif path.exists('{}/{}/spinner/spinner.c'.format(CONTRIB_THEMES, self.selected_theme)) and raveRainbow == False: #Backup does haz - os.system('mv /data/{}/selfdrive/common/spinner.c {}/spinner'.format(opdir, self.backup_dir)) #Backup spinner.c - os.system('cp {}/{}/spinner/spinner.c /data/{}/selfdrive/common'.format(BACKUPS_DIR, self.selected_backup, opdir)) #Replace spinner.c - - #Final make new spinner & finish - os.system('cd /data/{}/selfdrive/ui/spinner && make'.format(opdir)) - print('\n{} spinner re-installed successfully! Original backed up to {}'.format(opdir, self.backup_dir)) - print('Press enter to continue!') - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - input() - #elif selected_option == 'OpenPilot UI': - # print('Additional Resources are not an active feature') - # time.sleep(5) - elif selected_option == '-Main Menu-' or selected_option is None: - return - elif selected_option == '-Reboot-': - print('Rebooting.... Enjoy your old theme!!!') - os.system('am start -a android.intent.action.REBOOT') #create an android action to reboot - exit() - elif selected_option == '-Quit-': - print('Thank you come again! You will see your changes next reboot!') - exit() - - def restore_default_comma(self): - print('Selected to restore Comma-Default theme. Continue?') - print('Process is fully automagic!') - if not is_affirmative(): - print('Not restoring...') - time.sleep(1.5) - self.backup_reinstaller_loop() - - os.system('cp {} {}'.format(BOOT_LOGO_PATH, self.backup_dir)) # Make Backup - os.system('dd if=./{}/{}/{} of={}'.format(CONTRIB_THEMES, self.selected_backup, BOOT_LOGO_THEME_PATH, BOOT_LOGO_PATH)) # Replace - print('Factory Boot Logo restored successfully! Custom file(s) backed up to {}\n'.format(self.backup_dir)) - - os.system('mount -o remount,rw /system') # /system read only, must mount as r/w - os.system('mv /system/media/bootanimation.zip {}'.format(self.backup_dir)) # backup - os.system('cp ./{}/{}/bootanimation.zip /system/media/bootanimation.zip'.format(CONTRIB_THEMES, self.selected_backup,)) # replace - os.system('chmod 666 /system/media/bootanimation.zip') - print('Factory Boot Animation restored successfully! Custom file(s) backed up to {}\n'.format(self.backup_dir)) - print('Thank you come again!') - exit() - -if __name__ == '__main__': - bi = ThemeRestorer() diff --git a/theme_utils.py b/theme_utility.py similarity index 72% rename from theme_utils.py rename to theme_utility.py index 0197699..34361c3 100755 --- a/theme_utils.py +++ b/theme_utility.py @@ -62,26 +62,26 @@ import time from os import path from support.support_functions import * -from support.support_variables import CLEANUP_TEXT, CONTRIB_THEMES, SHOW_CONSOLE_OUTPUT, UTIL_WELCOME_TEXT -#====================== Vars =================================== +from support.support_variables import CLEANUP_TEXT, UTIL_WELCOME_TEXT - -#=================== CODE START ================================ +###################################################################################################### +##======================= CODE START ================================================================# +###################################################################################################### os.chdir(os.path.dirname(os.path.realpath(__file__))) # __file__ is safer since it doesn't change based on where this file is called from print_text(UTIL_WELCOME_TEXT) +DEV_CHECK() # Check if running on unsupported PC/MAC +DeviceData = get_device_theme_data() # Init Device Data dict with device info -class ThemeUtil: - def __init__(self): +class ThemeUtility: + def __init__(self): #Init while True: - util_options = ['Install from custom location', 'Restore Comma-default', 'Restore backup', 'Cleanup for uninstall', '-Reboot-', '-Quit-'] + util_options = ['Install from custom location', 'Restore Comma-default', 'Cleanup for uninstall', '-Reboot-', '-Quit-'] selected_util = selector_picker(util_options, 'This Is a Test') if selected_util == 'Install from custom location': self.Install_From_Loc() elif selected_util == 'Restore Comma-default': self.Restore_Comma_Default() - elif selected_util == 'Restore backup': - self.Restore_Backup() elif selected_util == 'Cleanup for uninstall': self.Cleanup_Files() elif selected_util == '-Reboot-': @@ -89,8 +89,7 @@ def __init__(self): elif selected_util == '-Quit-': QUIT_PROG() - def Install_From_Loc(self): #TEST & Cleanup the spare vars - EON_TYPE, BOOT_LOGO_THEME_NAME, BOOT_LOGO_THEME_PATH, BOOT_LOGO_NAME, BOOT_LOGO_PATH = get_device_theme_data() # Get Perams based off detected device + def Install_From_Loc(self): #Install a custom theme from custom location backup_dir = make_backup_folder() theme_options = [] @@ -98,18 +97,17 @@ def Install_From_Loc(self): #TEST & Cleanup the spare vars print('What is the full path to your custom theme folder? ') print('ex. /sdcard/mythemefolder') install_folder = input('?: ') - - op_ver, op_loc = get_OP_Ver_Loc() + # cd /data/eon-custom-themes && exec ./theme_utils.py # /data/eon-custom-themes/contributed-themes/Subaru - if path.exists('{}/LOGO'.format(install_folder)): + if path.exists('{}/OP3T-Logo/LOGO'.format(install_folder)) and DeviceData["EON_TYPE"] == 'OP3T': theme_options.append('OP3T Boot Logo') - if path.exists('{}/SPLASH'.format(install_folder)): + if path.exists('{}/LeEco-Logo/SPLASH'.format(install_folder)) and DeviceData["EON_TYPE"] == 'LeEco': theme_options.append('LeEco Boot Logo') if path.exists('{}/bootanimation.zip'.format(install_folder)): theme_options.append('Boot Animation') - if path.exists('{}/img_spinner_comma.png'.format(install_folder)) or path.exists('{}/img_spinner_track.png'.format(install_folder)) or path.exists('{}/spinner.c'.format(install_folder)): - self.theme_options.append('OP Spinner') + if path.exists('{}/spinner/img_spinner_comma.png'.format(install_folder)) or path.exists('{}/img_spinner_track.png'.format(install_folder)) or path.exists('{}/spinner.c'.format(install_folder)): + theme_options.append('OP Spinner') theme_options.append('-Reboot-') theme_options.append('-Quit-') @@ -127,38 +125,44 @@ def Install_From_Loc(self): #TEST & Cleanup the spare vars indexChoice = int(input("Enter Index Value: ")) indexChoice -= 1 - selected_option = self.theme_options[indexChoice] + selected_option = theme_options[indexChoice] if selected_option in ['Boot Animation', 'OP3T Boot Logo', 'LeEco Boot Logo', 'OP Spinner']: ##Confirm user wants to install asset print('\nSelected to install the Custom {}. Continue?'.format(selected_option)) if not is_affirmative(): - print('Not installing...') - time.sleep(1.5) continue if selected_option == 'Boot Animation': ##Check if there was a boot ani backup already this session to prevent accidental overwrites #Returns false if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, 'bootanimation.zip') == True: + if backup_overide_check(backup_dir, 'bootanimation.zip') == True: break - install_from_path = ("{}/bootanimation.zip".format(install_folder)) - INSTALL_BOOTANIMATION(self.backup_dir, install_from_path) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() + #Backup And install new bootanimation + install_from_path = (install_folder) + if Dev_DoInstall(): + INSTALL_BOOTANIMATION(backup_dir, install_from_path,) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() elif selected_option == 'OP Spinner': ##Check if there was a spinner backup already this session to prevent accidental overwrites #Returns false if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, 'spinner') == True: + if backup_overide_check(backup_dir, 'spinner') == True: break + OP_INFO = get_OP_Ver_Loc() + DebugPrint("Got OP Location: {} and Version 0.{}".format(OP_INFO["OP_Location"], OP_INFO["OP_Version"])) + + #Backup & Install install_from_path = ("{}/spinner".format(install_folder)) - INSTALL_QT_SPINNER(self.backup_dir, op_ver, op_loc, install_from_path, SHOW_CONSOLE_OUTPUT) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() + #Function to ask before installing for use in dev to not screw up my computer, and test logic + if Dev_DoInstall(): + INSTALL_QT_SPINNER(backup_dir, OP_INFO, install_from_path) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() elif selected_option == '-Reboot-': REBOOT() elif selected_option == '-Quit-' or selected_option is None: @@ -166,45 +170,22 @@ def Install_From_Loc(self): #TEST & Cleanup the spare vars elif selected_option == 'OP3T Boot Logo' or selected_option == 'LeEco Boot Logo': ##Check if there was a Boot Logo backup already this session to prevent accidental overwrites #Returns false if okay to proceed. Gets self.backup_dir & asset type name - if backup_overide_check(self.backup_dir, BOOT_LOGO_NAME) == True: + if backup_overide_check(backup_dir, DeviceData["BOOT_LOGO_NAME"]) == True: break - #Do Install - install_from_path = ("{}/{}".format(install_folder, BOOT_LOGO_THEME_NAME)) - INSTALL_BOOT_LOGO(EON_TYPE, self.backup_dir, install_from_path) - mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation - print('Press enter to continue!') - input() - - def Restore_Comma_Default(self): #PERFECT - eon_type, boot_logo_theme_name, boot_logo_theme_path, boot_logo_name, boot_logo_path = get_device_theme_data() # Get Perams based off detected device - - print('\nSelected to restore Comma-Default theme. Continue?') - print('Process is fully automagic!') - if not is_affirmative(): - print('Not restoring...') - time.sleep(1.5) - return None + #Backup & install new + install_from_path = ('{}/{}'.format(install_folder, DeviceData["BOOT_LOGO_THEME_PATH"])) + if Dev_DoInstall(): + INSTALL_BOOT_LOGO(DeviceData, backup_dir, install_from_path) + mark_self_installed() # Create flag in /sdcard so auto installer knows there is a self installation + print('Press enter to continue!') + input() - print('Please wait..... This should only take a few moments!\n') + def Restore_Comma_Default(self): #Restore the default theme for EON backup_dir = make_backup_folder() + restore_comma_default(DeviceData, backup_dir) - #Boot-Logo - install_from_path = '{}/Comma-Default/{}'.format(CONTRIB_THEMES, boot_logo_theme_path) - INSTALL_BOOT_LOGO(eon_type, backup_dir, install_from_path) - - #Boot-Animation - install_from_path = '{}/Comma-Default/'.format(CONTRIB_THEMES) - INSTALL_BOOTANIMATION(backup_dir, install_from_path) - - print('\nThank you come again! - Boot Logo & Boot Animation factory restored!!') - exit() - - def Restore_Backup(self): #TODO - self.backup_dir = make_backup_folder() # Create and get backup folder - BACKUP_OPTIONS = [] - - def Cleanup_Files(self): + def Cleanup_Files(self): #Remove all traces of EON Custom Themes #Print hAllo message print_text(CLEANUP_TEXT) #Confirm user wants to install bootlogo @@ -227,7 +208,5 @@ def Cleanup_Files(self): print('Until we meet again.....') exit() - - if __name__ == '__main__': - tu = ThemeUtil() \ No newline at end of file + tu = ThemeUtility() \ No newline at end of file