Beispiel #1
0
    def __init__(self):
        self.create_views()
        _correct_choices = [
            str(num) for num in range(len(self.init_options_data))
        ]
        self.views["intro"].display_intro()
        while True:
            self.views["init"].display()
            self.set_choice(_correct_choices)
            clear_screen()
            if self.choice == "1":
                self.views[
                    "Start with new profile"].display_text_from_my_texts()
                _name = self.take_input_from_user_clear_screen()
                self.user = User(_name)
                break
            elif self.choice == "2":
                self.user = self.load_user_profile(
                )  # import User data from file
                self.views["Load profile"].display_text_from_my_texts(
                    name=True)
                break
            else:
                self.views["About program"].display_text_from_my_texts()
                pause()

        self.set_name_for_views(
            self.user.name)  # all views have acces to User name now
Beispiel #2
0
 def display_graphics(self):
     if self.texts:
         mytools.clear_screen()
         try:
             mytools.display_text_with_asci_graphics(
                 self.texts[0], self.texts[1])
         except:
             print("Missed second text..")
             mytools.pause()
Beispiel #3
0
 def take_task_id_from_user(self):
     if len(self.user.tasks.my_tasks) == 1:
         _task_id = 0
     else:
         self.views["take task id"].display_custom_text(
             self.user.get_all_my_tasks())
         self.views["take task id"].display_text_from_my_texts(name=True)
         _correct_choices = [
             str(x) for x in range(len(self.user.tasks.my_tasks))
         ]
         self.set_choice(_correct_choices)
         _task_id = int(self.choice)
         clear_screen()
     return _task_id
Beispiel #4
0
    def display(self):
        mytools.clear_screen()
        if self.is_main:
            self.display_custom_text(self.name + ", what do you want to do?")
        else:
            self.display_custom_text(
                "Welcome in ToDo program. What do you want to do?")
        for number, choice in enumerate(self.choices):
            if choice not in self.special_choices.values():
                print("({}){:.>50}".format(number + 1, choice))

        for choice in self.special_choices:
            print("({}){:.>50}".format(choice, self.special_choices[choice]))
        print("\n")
Beispiel #5
0
 def menu_loop(self):
     """Execute main menu."""
     _correct_choices = [
         str(num) for num in range(len(self.main_options_data))
     ]
     _correct_choices.append("I")  # for "get task id by task name" option
     _correct_choices.append("S")  # for "save my profile" option
     while True:
         self.views["main"].display()
         self.set_choice(_correct_choices)
         clear_screen()
         if self.choice == "1":
             _text = str(self.user.get_all_my_tasks())
             self.views["display tasks"].display_custom_text(_text)
         elif self.choice == "2":
             self.add_new_task()
         elif self.choice == "3":
             self.remove_task()
         elif self.choice == "4":
             self.mark_task_as_done()
         elif self.choice == "5":
             self.mark_task_as_todo()
         elif self.choice == "6":
             self.get_task_full_description()
         elif self.choice == "7":
             self.change_task_name()
         elif self.choice == "8":
             self.change_task_description()
         elif self.choice == "9":
             self.remove_all_tasks()
         elif self.choice == "I":
             self.get_task_id_by_task_name()
         elif self.choice == "S":
             self.save_user_profile_to_file()
         elif self.choice == "0":
             self.views["exit program"].display_text_from_my_texts(
                 name=True, animating=True)
             exit()
         pause()
Beispiel #6
0
 def get_info_about_completion_of_the_action(self):
     clear_screen()
     self.views["succes"].display_text_from_my_texts()
     _text = str(self.user.get_all_my_tasks())
     self.views["succes"].display_custom_text(text=_text)
Beispiel #7
0
 def take_input_from_user_clear_screen():
     while True:
         _input = input()
         if _input:
             clear_screen()
             return _input
Beispiel #8
0
 def display_intro(self):
     mytools.clear_screen()
     self.display_graphics()
     mytools.pause()