def change_dir(self, folder_name = ""): if(folder_name == ""): speak("Specify the folder name Sir.") print("Specify the folder name Sir.") elif(os.path.isdir(self.DIR+"\\"+folder_name)): self.DIR = self.DIR+"\\"+folder_name speak("changed the directory.") print(self.DIR) elif(folder_name == "Go back..."): self.DIR = os.path.dirname(self.DIR) speak("changed the directory.") print(self.DIR)
def remove_folder(self, folder_name = ""): if(folder_name == ""): speak("Specify the folder name Sir.") print("Specify the folder name Sir.") elif(os.path.exists(self.DIR+"\\"+folder_name)): speak("Do you want to delete the folder "+folder_name) print("Do you want to delete the folder "+folder_name) print("waiting for confirmation.....say yes or no.") command = takeCommand().lower() while('yes' not in command and 'no' not in command): command = takeCommand().lower() if('yes' in command): shutil.rmtree(self.DIR+"\\"+folder_name) speak("deleted the folder "+folder_name) else: speak("I think the folder do not exist sir. Look whether we are in the right directory.") print(self.DIR)
def show_reminder(reminder): # print("enter in show reminders function") notification = ToastNotifier() speak(reminder) notification.show_toast(f"Reminder", reminder, duration=10)
def get_details_about_reminder(): flag = 0 speak("What shall I remind you about") while (flag == 0): rem = takeCommand().lower() if rem != "none": flag = 1 speak(rem) flag = 0 speak("on which date") while (flag == 0): d = takeCommand().lower() if (d != "none"): ext = ["th", "st", "nd", "rd"] for ex in ext: if ex in d: d = d.replace(ex, "") break flag = 1 speak(d) speak("At what time") flag = 0 while (flag == 0): t = takeCommand().lower() if (t != "none"): for i in range(len(t)): if (t[i] == "."): t = t[0:i] t = t + "m" break t = t.replace(" ", "") s = 0 flag = 1 speak(t) if (d in rem_list): a = rem_list[d] a.extend([t, rem]) rem_list[d] = a else: rem_list[d] = [t, rem]
def Start(self): query = "" while(True): if("list contents" in query): self.list_dir_contents() elif("change directory" in query): content = self.list_dir_contents() content[len(content.keys())+2] = 'Go back...' speak("tell me which folder number you want to move to.") print("tell me which folder number you want to move to.") #command = takeCommand().lower() command = input("change dir") if(int(command) in content.keys()): self.change_dir(content[int(command)]) else: speak("please tell the correct option") elif("delete" in query and "file" in query): content = self.list_dir_contents() speak("tell me which file number you want to delete.") print("tell me which file number you want to delete.") #command = takeCommand().lower() command = input("delete") if(int(command) in content.keys()): self.remove_file(content[int(command)]) else: speak("please tell the correct option") elif("delete" in query and "folder" in query): content = self.list_dir_contents() speak("tell me which folder number you want to delete.") print("tell me which folder number you want to delete.") #command = takeCommand().lower() command = input("delete") if(int(command) in content.keys()): self.remove_folder(content[int(command)]) else: speak("please tell the correct option") elif("stop" in query): break speak("tell me what we have to do.") query = takeCommand().lower()