X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/214c4fbea5875368cc21a082d20cb082cd38cb3c..f6342fb5e6524edffa219d5843536ea279bba4df:/wxPython/src/_process.i diff --git a/wxPython/src/_process.i b/wxPython/src/_process.i index 7c26a92e8b..55e45309a9 100644 --- a/wxPython/src/_process.i +++ b/wxPython/src/_process.i @@ -17,7 +17,7 @@ %newgroup %{ -%} +%} //--------------------------------------------------------------------------- @@ -99,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 @@ -112,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(); @@ -129,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); }; //--------------------------------------------------------------------------- @@ -140,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`"); }; @@ -170,7 +189,15 @@ enum // 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 + wxEXEC_NODISABLE = 8, + + // by default, the event loop is run while waiting for synchronous execution + // to complete and this flag can be used to simply block the main process + // until the child process finishes + wxEXEC_NOEVENTS = 16, + + // convenient synonym for flags given system()-like behaviour + wxEXEC_BLOCK = wxEXEC_SYNC | wxEXEC_NOEVENTS }; @@ -183,7 +210,7 @@ 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));