mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-10-26 00:04:03 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			99 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			99 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/qgspythonrunner.h                                           *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | |
|  ************************************************************************/
 | |
| 
 | |
| 
 | |
| 
 | |
| class QgsPythonRunner
 | |
| {
 | |
| %Docstring(signature="appended")
 | |
| Utility class for running Python commands from various parts of QGIS.
 | |
| 
 | |
| There is no direct Python support in the core library, so it is expected
 | |
| that application with Python support creates a subclass that implements
 | |
| pure virtual function(s) during the initialization. The static methods
 | |
| will then work as expected.
 | |
| %End
 | |
| 
 | |
| %TypeHeaderCode
 | |
| #include "qgspythonrunner.h"
 | |
| %End
 | |
|   public:
 | |
| 
 | |
|     static bool isValid();
 | |
| %Docstring
 | |
| Returns ``True`` if the runner has an instance (and thus is able to run
 | |
| commands)
 | |
| %End
 | |
| 
 | |
|     static bool run( const QString &command, const QString &messageOnError = QString() );
 | |
| %Docstring
 | |
| Execute a Python statement
 | |
| %End
 | |
| 
 | |
|     static bool runFile( const QString &filename, const QString &messageOnError = QString() );
 | |
| %Docstring
 | |
| Execute a Python ``filename``, showing an error message if one occurred.
 | |
| 
 | |
| :return: true if no error occurred
 | |
| %End
 | |
| 
 | |
|     static bool eval( const QString &command, QString &result /Out/ );
 | |
| %Docstring
 | |
| Eval a Python statement
 | |
| %End
 | |
| 
 | |
|     static bool setArgv( const QStringList &arguments, const QString &messageOnError = QString() );
 | |
| %Docstring
 | |
| Set sys.argv
 | |
| %End
 | |
| 
 | |
|     static void setInstance( QgsPythonRunner *runner /Transfer/ );
 | |
| %Docstring
 | |
| Assign an instance of Python runner so that
 | |
| :py:func:`~QgsPythonRunner.run` can be used. This method should be
 | |
| called during app initialization. Takes ownership of the object, deletes
 | |
| previous instance.
 | |
| %End
 | |
| 
 | |
|   protected:
 | |
|     QgsPythonRunner();
 | |
| %Docstring
 | |
| Protected constructor: can be instantiated only from children
 | |
| %End
 | |
|     virtual ~QgsPythonRunner();
 | |
| 
 | |
|     virtual bool runCommand( QString command, QString messageOnError = QString() ) = 0;
 | |
| %Docstring
 | |
| Runs the given statement.
 | |
| %End
 | |
| 
 | |
|     virtual bool runFileCommand( const QString &filename, const QString &messageOnError = QString() ) = 0;
 | |
| %Docstring
 | |
| Runs the code from the given file.
 | |
| %End
 | |
| 
 | |
|     virtual bool evalCommand( QString command, QString &result ) = 0;
 | |
| %Docstring
 | |
| Evaluates the given expression, producing a result.
 | |
| %End
 | |
| 
 | |
|     virtual bool setArgvCommand( const QStringList &arguments, const QString &messageOnError = QString() ) = 0;
 | |
| %Docstring
 | |
| Sets sys.argv to the given arguments.
 | |
| %End
 | |
| 
 | |
| };
 | |
| 
 | |
| /************************************************************************
 | |
|  * This file has been generated automatically from                      *
 | |
|  *                                                                      *
 | |
|  * src/core/qgspythonrunner.h                                           *
 | |
|  *                                                                      *
 | |
|  * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 | |
|  ************************************************************************/
 |