def features(self, no): from system.features_installation import speed_up, install_speaking_system, install_command_system options = ['Speed Up', 'Speaking Capability', 'Voice Command'] pt = '-' * 22 + "Features Installaion" + '-' * 22 cprint(pt, 'magenta') print() cprint(" All the available options are given below : ", 'yellow') print() # print(bt) for i, w in enumerate(options): cprint(f' {i+1}) {w}', 'blue') cprint(' 0) Cancel', 'red') print() ok = True while ok: ok = False cprint(" Enter the index number : ", 'cyan', end='') no = int(input()) if no == 0: cprint(" Operation cancelled.", 'red') return elif no == 1: cprint(f' You have selected {options[no-1]} .', 'yellow') speed_up() elif no == 2: cprint(f' You have selected {options[no-1]} .', 'yellow') install_speaking_system() elif no == 3: cprint(f' You have selected {options[no-1]} .', 'yellow') install_command_system() else: ok = True cprint(" You have selected wrong index. Please try again.", 'red')
def Interaction(self, no): options = [ 'voice_reply', 'text_reply', 'voice_read_voice_reply', 'text_read' ] pt = '-' * 22 + self.lt[no] + '-' * 22 cprint(pt, 'magenta') cprint(" Select the index to change,", 'yellow') print() for i, w in enumerate(options): cprint(f' {i+1}) {w} : {its[w.lower()]}', 'blue') cprint(' 0) Cancel', 'red') print() ok = True while ok: ok = False cprint(" Enter the index number : ", 'cyan', end='') no = int(input()) if no == 0: cprint(" Operation cancelled.", 'red') return elif no == 1: cprint(f' You have selected {options[no-1]} .', 'yellow') key = options[no - 1] if its[key]: cprint(f' Do you want to turn {key} to False?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = False section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'False' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') else: cprint(f' Do you want to turn {key} to True?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: try: from system.features_installation import install_speaking_system install_speaking_system() except: pass its[key] = True section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'True' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') elif no == 2: cprint(f' You have selected {options[no-1]} .', 'yellow') key = options[no - 1] if its[key]: cprint(f' Do you want to turn {key} to False?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = False section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'False' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') else: cprint(f' Do you want to turn {key} to True?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = True section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'True' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') elif no == 3: cprint(f' You have selected {options[no-1]} .', 'yellow') key = options[no - 1] if its[key]: cprint(f' Do you want to turn {key} to False?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = False section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'False' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') else: cprint(f' Do you want to turn {key} to True?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: try: from system.features_installation import install_command_system, install_speaking_system install_speaking_system() install_command_system() except Exception as e: cprint(e, 'red') its[key] = True section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'True' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') elif no == 4: cprint(f' You have selected {options[no-1]} .', 'yellow') key = options[no - 1] if its[key]: cprint(f' Do you want to turn {key} to False?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = False section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'False' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') else: cprint(f' Do you want to turn {key} to True?(Y/N) : ', 'cyan', end='') confirm = input() if confirm.lower() in yes: its[key] = True section = 'interaction_setting' x = self.obj.read(conf_path, section) x[key] = 'True' self.obj.update(conf_path, x, section) cprint(" Successfully updated.", 'green') else: cprint("Cancelled.", 'red') else: ok = True cprint(" You have selected wrong index. Please try again.", 'red')