Example #1
0
 def run(self, command_item, buffer_name=''):
     variable_name = command_item['variable_name']
     variable_value = Config().get_variable(variable_name)
     PTS.info("RUN_COMMAND_STRING", variable_name, buffer_name,
              command_item)
     if variable_value:
         return CommandHandler().run_command(variable_value, buffer_name)
     return None
Example #2
0
 def run(self, command_item, buffer_name=''):
     command_item_buffer_name = command_item.get("buffer_name", "")
     cci = ConfigCommandItem()
     cci.command = command_item['name']
     cci.calling_buffer_name = buffer_name
     cci.buffer_name = command_item_buffer_name or buffer_name
     PTS.info("RUN_CONFIG_COMMAND", cci.command, cci.buffer_name,
              command_item)
     ConfigCommand().run_config_command(cci)
Example #3
0
 def run(self, command_item, buffer_name=''):
     buffer_name = buffer_name or command_item.get("buffer_name", '')
     command_value = command_item['command']
     interpolated_command_value = Interpolate.interpolate_variables(
         command_value)
     PTS.info("RUN_COMMAND", interpolated_command_value, buffer_name,
              command_item)
     return CommandHandler().run_command(interpolated_command_value,
                                         buffer_name)
Example #4
0
 def __run_config_command_action(self, command_action, config_command_item):
     ok_to_run = self.__condition.is_ok_to_run(command_action.when_condition)
     if len(command_action.when_condition) > 0:
         PTS.info("WHEN_CONDITION", command_action.action_name, config_command_item.buffer_name, "Run: " + str(ok_to_run) + ", To Run: " + str(command_action.action_value.get("name", "")) + ", Condition: '" + str(command_action.when_condition) + "'")
     if ok_to_run:
         action_args = self.__converter.to_action_args(command_action.action_value, command_action.event_input_args, command_action.buffer_name)
         lines = Action.run_action(command_action.action_name, action_args)
         buffer_cache = ConfigCommandBufferCache(config_command_item.buffer_name)
         buffer_cache.set(lines, config_command_item, command_action, action_args)
Example #5
0
 def run(self, command_item, buffer_name=''):
     PTS.info("RUN_COMMAND_WITH_MATCH", command_item["command"], buffer_name, command_item)
     self.__set_locals(command_item, buffer_name)
     self._lines = CommandHandler().run_command(self._command_item_command)
     if self._try_set_var:
         self.__get_match()
     if self._try_set_array_var:
         self.__get_array_match()
     self.__try_set_variable()
     PTS.info("*RUN_COMMAND_WITH_MATCH", str(command_item["command"]), str(buffer_name), "Match: '" + str(self._regex_match) + "', Var: '" + str(self._try_set_var) + "', Result: '" + str(self._match_result) + str(self._try_set_array_var) + "'")
Example #6
0
 def run(self, command_item, buffer_name=''):
     if buffer_name:
         template_paths = Ph.get_paths_for_plugin('templates')
         template_filename = command_item.get("filename", '')
         PTS.info("DISPLAY_TEMPLATE", template_filename, buffer_name, command_item)
         for templates_path in template_paths:
             template_filename_path = os.path.join(templates_path, template_filename)
             if os.path.isfile(template_filename_path):
                 self.__process_template_file(buffer_name, templates_path, template_filename)
                 break
Example #7
0
 def run(self, command_item, buffer_name=''):
     self.__set_locals(command_item, buffer_name)
     if self._event_input_args:
         self._event_input_args = self.__get_interpolated_args(
             self._event_input_args)
     if self._function_args:
         self._function_args = self.__get_interpolated_args(
             self._function_args)
     PTS.info("RUN_EDITOR_FUNCTION", self._function_name, buffer_name,
              command_item)
     return self.__run_command()
 def run(self, command_item, buffer_name=''):
     PTS.info("RUN_COMMAND_WITH_MATCH_GROUP", command_item["command"],
              buffer_name, command_item)
     self.__set_locals(command_item, buffer_name)
     self._lines = CommandHandler().run_command(
         self._command_item["command"])
     temp_dict = {}
     for key, value in self._match_dictionary.items():
         temp_dict[key] = self.__get_match(value)
     self._match_dictionary.update(temp_dict)
     for key, value in self._match_dictionary.items():
         Config().set_variable(key, value["result"])
Example #9
0
 def run(self, command_item, buffer_name='', command_args=None):
     self.__set_locals(command_item, buffer_name, command_args or {})
     self.__set_function_module_locals()
     self.__update_command_args()
     self.__run_function_update_variable()
     PTS.info("RUN_PYTHON_FUNCTION", self._function_name, buffer_name, command_item)