File: qgsrunprocess.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (161 lines) | stat: -rw-r--r-- 4,635 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsrunprocess.h                                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/







class QgsRunProcess: QObject /NoDefaultCtors/
{
%Docstring(signature="appended")
A class that executes an external program/script.

It can optionally capture the standard output and error from the process
and displays them in a dialog box.

On some platforms (e.g. iOS) , the process execution is skipped
https://lists.qt-project.org/pipermail/development/2015-July/022205.html
%End

%TypeHeaderCode
#include "qgsrunprocess.h"
%End
  public:

    static QgsRunProcess *create( const QString &action, bool capture ) /Factory/;

    static QStringList splitCommand( const QString &command );
%Docstring
Splits the string ``command`` into a list of tokens, and returns the
list.

Tokens with spaces can be surrounded by double quotes; three consecutive
double quotes represent the quote character itself.

.. versionadded:: 3.18
%End

  private:
    QgsRunProcess( const QString &action, bool capture );
    ~QgsRunProcess();
  public slots:
    void stdoutAvailable();
    void stderrAvailable();
    void processError( QProcess::ProcessError );
    void processExit( int, QProcess::ExitStatus );
    void dialogGone();
};


class QgsBlockingProcess : QObject
{
%Docstring(signature="appended")
A thread safe class for performing blocking (sync) execution of external
processes.

This class should be used whenever a blocking process run is required.
Unlike implementations which rely on QApplication.processEvents() or
creation of a QEventLoop, this class is completely thread safe and can
be used on either the main thread or background threads without issue.

Not available on some platforms (e.g. iOS)
https://lists.qt-project.org/pipermail/development/2015-July/022205.html

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgsrunprocess.h"
%End
  public:

    QgsBlockingProcess( const QString &program, const QStringList &arguments );
%Docstring
Constructor for the given ``program``, with the specified list of
``arguments``.

After construction, call :py:func:`~QgsBlockingProcess.run` to start the
process execution.
%End


    void setStdOutHandler( SIP_PYCALLABLE / AllowNone / );
%Docstring
Sets a handler function to call whenever content is written by the
process to stdout.
%End
%MethodCode
    Py_BEGIN_ALLOW_THREADS

    sipCpp->setStdOutHandler( [a0]( const QByteArray &arg )
    {
      SIP_BLOCK_THREADS
      Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QByteArray, NULL ) );
      SIP_UNBLOCK_THREADS
    } );

    Py_END_ALLOW_THREADS
%End


    void setStdErrHandler( SIP_PYCALLABLE / AllowNone / );
%Docstring
Sets a ``handler`` function to call whenever content is written by the
process to stderr.
%End
%MethodCode
    Py_BEGIN_ALLOW_THREADS

    sipCpp->setStdErrHandler( [a0]( const QByteArray &arg )
    {
      SIP_BLOCK_THREADS
      Py_XDECREF( sipCallMethod( NULL, a0, "D", &arg, sipType_QByteArray, NULL ) );
      SIP_UNBLOCK_THREADS
    } );

    Py_END_ALLOW_THREADS
%End

    int run( QgsFeedback *feedback = 0 );
%Docstring
Runs the process, and blocks until execution finishes.

The optional ``feedback`` argument can be used to specify a feedback
object for cancellation/process termination.

After execution completes, the process' result code will be returned.
%End

    QProcess::ExitStatus exitStatus() const;
%Docstring
After a call to :py:func:`~QgsBlockingProcess.run`, returns the process'
exit status.
%End

    QProcess::ProcessError processError() const;
%Docstring
After a call to :py:func:`~QgsBlockingProcess.run`, returns the process'
reported error.

Returns QProcess.UnknownError if no error occurred.
%End

};




/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsrunprocess.h                                             *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/