X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c1718b2c8a1ae4e7f2a6f421cc398a21dfdb07cb..9e477492e29e03c02827b1e42a16cb09a13f5149:/wxPython/src/_process.i?ds=sidebyside diff --git a/wxPython/src/_process.i b/wxPython/src/_process.i index 52f778d493..7a9b5759f4 100644 --- a/wxPython/src/_process.i +++ b/wxPython/src/_process.i @@ -17,7 +17,7 @@ %newgroup %{ -%} +%} //--------------------------------------------------------------------------- @@ -78,7 +78,8 @@ IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate); %} -%name(Process)class wxPyProcess : public wxEvtHandler { +%rename(Process) wxPyProcess; +class wxPyProcess : public wxEvtHandler { public: // kill the process with the given PID static wxKillError Kill(int pid, @@ -98,12 +99,20 @@ public: static wxPyProcess *Open(const wxString& cmd, int flags = wxEXEC_ASYNC); - %pythonAppend wxPyProcess "self._setCallbackInfo(self, Process)" + %pythonAppend wxPyProcess setCallbackInfo(Process) "; self.this.own(False)" wxPyProcess(wxEvtHandler *parent = NULL, int id = -1); + ~wxPyProcess(); void _setCallbackInfo(PyObject* self, PyObject* _class); - void base_OnTerminate(int pid, int status); + + DocDeclStr( + long , GetPid() const, + "get the process ID of the process executed by Open()", ""); + + + void OnTerminate(int pid, int status); + %MAKE_BASE_FUNC(Process, OnTerminate); // call Redirect before passing the object to wxExecute() to redirect the // launched process stdin/stdout, then use GetInputStream() and @@ -111,7 +120,7 @@ public: void Redirect(); bool IsRedirected(); - + // detach from the parent - should be called by the parent if it's deleted // before the process it started terminates void Detach(); @@ -128,6 +137,14 @@ public: // return True if any input is available on the child process stdout/err bool IsInputAvailable() const; bool IsErrorAvailable() const; + + %property(ErrorStream, GetErrorStream, doc="See `GetErrorStream`"); + %property(InputStream, GetInputStream, doc="See `GetInputStream`"); + %property(OutputStream, GetOutputStream, doc="See `GetOutputStream`"); + + %property(InputOpened, IsInputOpened); + %property(InputAvailable, IsInputAvailable); + %property(ErrorAvailable, IsErrorAvailable); }; //--------------------------------------------------------------------------- @@ -139,6 +156,9 @@ public: int GetPid(); int GetExitCode(); int m_pid, m_exitcode; + + %property(ExitCode, GetExitCode, doc="See `GetExitCode`"); + %property(Pid, GetPid, doc="See `GetPid`"); }; @@ -164,7 +184,12 @@ enum // under Unix, if the process is the group leader then killing -pid kills // all children as well as pid - wxEXEC_MAKE_GROUP_LEADER = 4 + wxEXEC_MAKE_GROUP_LEADER = 4, + + // by default synchronous execution disables all program windows to avoid + // that the user interacts with the program while the child process is + // running, you can use this flag to prevent this from happening + wxEXEC_NODISABLE = 8 }; @@ -177,11 +202,15 @@ long wxExecute(const wxString& command, %typemap(in,numinputs=0) wxKillError* rc ( wxKillError temp ) { $1 = &temp; } -%typemap(argout) wxKillError* rc +%typemap(argout) wxKillError* rc { PyObject* o; o = PyInt_FromLong((long) (*$1)); +#if SWIG_VERSION < 0x010328 $result = t_output_helper($result, o); +#else + $result = SWIG_Python_AppendOutput($result, o); +#endif } int wxKill(long pid, wxSignal sig = wxSIGTERM, wxKillError* rc, int flags = wxKILL_NOCHILDREN);