From 6b86115a130a2b3473a66bcb220949d174be8d95 Mon Sep 17 00:00:00 2001 From: sTiKyt Date: Tue, 11 Aug 2020 21:02:26 +0300 Subject: [PATCH] Fix --- Defs/ActionManager/simple_informant.py | 27 +++++++++++++++++++++++++- views/EULA_view.py | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Defs/ActionManager/simple_informant.py b/Defs/ActionManager/simple_informant.py index 540ba39..b393bae 100644 --- a/Defs/ActionManager/simple_informant.py +++ b/Defs/ActionManager/simple_informant.py @@ -21,6 +21,31 @@ from Defs.ImportManager.unsorted_will_be_replaced import try_to_run_command default_palette = theme.default_palette + +def license_handler(): + """ Checks if eula.txt exists, creates one if it doesn't. Checks if "eula = True" is inside. + + Returns: + boolean: Returns True if "eula = True" is inside eula.txt, False by default. + """ + eula = pathlib_Path("eula.txt") + if eula.exists(): + with open("eula.txt", "r") as f: + if "eula = True" in f.read(): + print("Found your license agreement, proceeding...") + return True + else: + print("Please read and accept license.") + return False + else: + eula.touch(mode=0o777, exist_ok=True) + eula = open("eula.txt", "w") + eula.write(localization.write_eula + "eula = False") + eula.close() + print("Please accept EULA.") + return False + + def exit_message(port=80): # Message when HiddenEye exit """Displays preconfigured message when HiddenEye execution ends or user tries to leave app. @@ -206,7 +231,7 @@ def port_selector(): # Requests port input from user return port_selector() else: return choice - except ValueError: + except: return port_selector() diff --git a/views/EULA_view.py b/views/EULA_view.py index 6c69cfe..0cb0955 100644 --- a/views/EULA_view.py +++ b/views/EULA_view.py @@ -6,7 +6,7 @@ class EULAView: self.EULA_messages = { "eula_found": _("EULA is found"), "eula_is_confirmed": _("You accepted EULA"), - "eula_is_not_confirmed": _("You didn't accept EULA"), + "eula_is_not_confirmed": _("You didn't accept EULA, please open eula.txt"), "eula_not_found": _("EULA isn't found"), "eula_is_invalid": _("EULA is not valid"), "eula_start_of_file": _("# Please read and accept EULA below\n eula = False")