Example #1
0
 def handle_execute_from_shell(self, cmd_line):
     """
     Handles all commands that take a filename and 0 or more extra arguments.
     Passes the command to backend.
     
     (Debugger plugin may also use this method)
     """
     command, args = parse_shell_command(cmd_line)
     
     if len(args) >= 1:
         get_workbench().get_editor_notebook().save_all_named_editors()
         cmd = ToplevelCommand(command=command,
                            filename=args[0],
                            args=args[1:])
         
         if os.path.isabs(cmd.filename):
             cmd.full_filename = cmd.filename
         else:
             cmd.full_filename = os.path.join(self.get_cwd(), cmd.filename)
             
         if command in ["Run", "run", "Debug", "debug"]:
             with tokenize.open(cmd.full_filename) as fp:
                 cmd.source = fp.read()
             
         self.send_command(cmd)
     else:
         raise CommandSyntaxError("Command '%s' takes at least one argument", command)
Example #2
0
 def _handle_cd_from_shell(self, cmd_line):
     command, args = parse_shell_command(cmd_line)
     assert command == "cd"
     
     if len(args) == 1:
         self.send_command(ToplevelCommand(command="cd", path=args[0]))
     else:
         raise CommandSyntaxError("Command 'cd' takes one argument")
Example #3
0
 def _handle_reset_from_shell(self, cmd_line):
     command, args = parse_shell_command(cmd_line)
     assert command == "Reset"
     
     if len(args) == 0:
         self.send_command(ToplevelCommand(command="Reset"))
     else:
         raise CommandSyntaxError("Command 'Reset' doesn't take arguments")
Example #4
0
 def handle_execute_from_shell(self, cmd_line):
     """
     Handles all commands that take a filename and 0 or more extra arguments.
     Passes the command to backend.
     
     (Debugger plugin may also use this method)
     """
     command, args = parse_shell_command(cmd_line)
     
     if len(args) >= 1:
         get_workbench().get_editor_notebook().save_all_named_editors()
         self.send_command(ToplevelCommand(command=command,
                            filename=args[0],
                            args=args[1:]))
     else:
         raise CommandSyntaxError("Command '%s' takes at least one argument", command)