Exemplo n.º 1
0
    def Run(self, fname, cmd, args, ftype):
        """Run the given file
        @param fname: File path
        @param cmd: Command to run on file
        @param args: Executable arguments
        @param ftype: File type id

        """
        # Find and save the file if it is modified
        nb = self._mw.GetNotebook()
        for ctrl in nb.GetTextControls():
            tname = ctrl.GetFileName()
            if fname == tname:
                if ctrl.GetModify():
                    ctrl.SaveFile(tname)
                    break

        handler = handlers.GetHandlerById(ftype)
        path, fname = os.path.split(fname)
        if wx.Platform == '__WXMSW__':
            fname = u"\"" + fname + u"\""
        else:
            fname = fname.replace(u' ', u'\\ ')

        self._worker = eclib.ProcessThread(self._buffer, cmd, fname, args,
                                           path, handler.GetEnvironment())
        self._worker.start()
Exemplo n.º 2
0
    def StartProcess(self, cmd):
        """Start a new process thread, the process will be created by
        executing the given command.
        @param cmd: Command string (i.e 'ping localhost')

        """
        proc = eclib.ProcessThread(self, cmd)
        self._threads.append((proc, cmd))
        self._threads[-1][0].start()