Esempio n. 1
0
 def action(self):
     choices = Tools.get_choose_dict(
         data={"choose": list(self.actions.keys())})
     Tools.print_choose_dict(choices)
     user_input = input()
     if user_input not in choices.keys():
         Tools.print_error("Пожалуйста введите корректные данные.")
     else:
         self.context.next(self.actions[choices[user_input]]())
Esempio n. 2
0
 def action(self):
     choices = Tools.get_choose_dict(
         data={"choose": list(self.actions.keys())})
     Tools.print_choose_dict(choices)
     user_input = input()
     if user_input not in choices.keys():
         Tools.print_error("Пожалуйста введите корректные данные.")
     elif choices[user_input] == "Выбрать категорию":
         go_to = self.handle_download()
         self.context.next(go_to() if go_to is not None else self.
                           actions[choices[user_input]]())
     else:
         self.context.next(self.actions[choices[user_input]]())
Esempio n. 3
0
 def action(self):
     choices = Tools.get_choose_dict(
         data={"choose": list(self.actions.keys())})
     Tools.print_choose_dict(choices)
     user_input = input()
     if user_input not in choices.keys():
         Tools.print_error("Пожалуйста введите корректные данные.")
     elif choices[user_input] == "Начать ввод":
         raw_data = input()
         if os.path.isfile(raw_data):
             files = {"data": open(raw_data, "rb")}
             self.context.api.create_file(files)
         else:
             self.context.api.create_user_input(raw_data)
         self.context.next(self.actions[choices[user_input]]())
     else:
         self.context.next(self.actions[choices[user_input]]())
Esempio n. 4
0
 def get_choises(self, choices):
     choices["choose"].extend(list(base_actions.keys()))
     choices = Tools.get_choose_dict(choices)
     Tools.print_choose_dict(choices)
     return choices