示例#1
0
    def execute_command(self, button):

        form = self.view.get_command_form()

        form.clear_validation_errors()

        #Validation of Required Elements
        if (not form.validate()):
            form.set_message_in_message_box(
                ' Validation Error. Please check the marked fields.')
            return False

        #we show the console if it was hidden
        self.view.console_show()

        commandString = form.get_command_name()
        widgets = form.get_widgets()

        #we perform the execution of the command
        for widget in widgets:
            paramString = widget.get_parameter_string()
            if (paramString is not ''):
                commandString = commandString + ' ' + paramString

        self.thread = TiseanRunner()
        self.thread.register_observer(self.view.get_console_updater())
        if (platform.system() is not 'Windows'):
            executionString = './' + commandString
        else:
            executionString = commandString

        self.thread.execute_command(executionString)

        return True