Пример #1
0
 def perform_command(self, command: Suggestion):
     """
     Executes a command
     :param command: Suggestion object
     :return:
     """
     try:
         if command.parameter == "":
             command.function(self.manager)
         else:
             command.function(self.manager, command.parameter)
     except:
         print("[Error] Command failed to execute")
Пример #2
0
 def execute_function(self, suggestion: Suggestion):
     """
     Executes a command
     :param suggestion: Suggestion Object
     """
     try:
         if suggestion.title == "Authentication":  # opens Auth UI, needs changed at some point
             self.auth_ui.show()
         elif suggestion.parameter == "":  # executes Suggestion's function
             suggestion.function(self.manager)
         else:  # executes Suggestion's function with a string parameter
             suggestion.function(self.manager, suggestion.parameter)
     except:
         print("[Error] Command failed to execute")
Пример #3
0
 def perform_command(self, item: Suggestion):
     """
     Executes a command
     :param command: Suggestion object
     """
     try:
         if item.title == "Authentication":  # opens Auth UI, needs changed at some point
             self.auth_ui.show()
         elif item.parameter == "":  # executes Suggestion's function
             item.function(self.manager)
         else:  # executes Suggestion's function with a string parameter
             item.function(self.manager, item.parameter)
     except:
         print("[Error] Command failed to execute")