140 Commits

Author SHA1 Message Date
Nyall Dawson
3688035942 Ensure filename is shown when an exception occurs in a dropped Py script 2024-04-18 11:32:28 +10:00
Nyall Dawson
3ac4fd4ca8 Ensure __file__ is set when running python scripts dropped onto QGIS 2024-04-18 11:32:28 +10:00
Thomas Bonfort
42f8b56745 Avoid error when plugin loaded with QGIS_NO_OVERRIDE_IMPORT 2024-02-23 08:54:14 +10:00
Nyall Dawson
0f01dd3360 Stronger message 2024-01-19 19:44:48 +10:00
Nyall Dawson
c16a1e2b3d Update enums 2024-01-19 19:44:48 +10:00
Nyall Dawson
69df78e4fc Block PyQt5 imports in qt 6 builds, and vice versa 2024-01-19 19:44:48 +10:00
Nyall Dawson
8a4d42bbc0 Fix sip import 2024-01-19 19:44:48 +10:00
Nyall Dawson
e4e63ce5f9 [processing] When running qgis_process commands, defer the model
provider loading until after ALL plugins have been loaded

This avoids the model provider from refreshing all the model
algorithms multiple times, once for each non-default plugin installed
which implements a processing provider.
2023-12-07 16:20:25 +10:00
Nyall Dawson
98c19b38ac Cleanup qgis.utils.home_plugin_path 2023-11-25 07:40:02 +10:00
Harrissou Sant-anna
d6b5b070d8 Remove unicode string notifier from python files 2022-12-11 08:58:21 +01:00
nicogodet
a0397805f2
use QUrl.fromLocalFile 2022-02-28 11:30:12 +01:00
nicogodet
401bd915d7
fix url on windows
Co-authored-by: xcaeag <xavier.culos@gmail.com>
2022-02-28 11:15:14 +01:00
Nyall Dawson
dde113d358 Refactor logic from .py drop handler Processing script detection
to also allow for retrieving just the class of detected algorithms
instead of always running the algorithm
2021-12-15 15:24:23 +10:00
jfbourdon
297ee72568 definition annotation 2021-10-22 10:34:13 +10:00
jfbourdon
dfe2638de5 add return value 2021-10-22 10:34:13 +10:00
Germán Carrillo
c1dcb2c717 Plugin dependencies followup: load dependent plugins after their dependencies on QGIS startup 2021-09-07 09:07:50 +10:00
Etienne Trimaille
735a0adb90 Add some Python annotations in qgis.utils 2021-05-04 13:04:48 +10:00
Nyall Dawson
1040fe8705 Don't silently swallow exceptions in python context managers
Notably this causes processing modules to silently fail to load
without any warnings if the required dependancies (such as pyscopg2)
are not installed
2021-03-04 07:39:47 +10:00
GeoJulien
4d8660375d Remove trailing space 2021-01-12 06:02:57 +10:00
GeoJulien
74fb453f99 fix confused copy/paste 2021-01-12 06:02:57 +10:00
GeoJulien
05d836b4ce Use QDesktopServices instead of deprecated iface.openUrl 2021-01-12 06:02:57 +10:00
Maxime Liquet
fc02207f58
Less intrusive Python import hook
Fixes https://github.com/qgis/QGIS/issues/40564
2020-12-12 18:59:08 +01:00
Juergen E. Fischer
ef0c4722ed only _AddDllDirectory existing directories (fixes OSGeo4W#649) 2020-11-09 15:01:12 +01:00
Nyall Dawson
64bf347d7e Fix dropping processing script algorithm .py file on QGIS no longer
triggers the algorithm to execute
2020-10-06 17:03:35 +10:00
Juergen E. Fischer
44b4a75a0a fix #38720 2020-09-15 09:51:00 +02:00
Juergen E. Fischer
d411d66b3d windows: map python PATH changes to Add/RemoveDllDirectory (followup f17097b1a465c; fixes #38372) 2020-08-21 21:02:26 +02:00
Matthias Kuhn
a7e0831dcf Code style 2020-05-05 22:38:37 +02:00
Alexander Bruy
b524929d20 remove condition 2020-04-21 14:47:56 +03:00
Alexander Bruy
0e59d13af5 fix deprecation warning in qgis.utils caused by deprecating
imp.new_module() call in Python 3.4 (fix #32786)
2020-04-21 14:47:56 +03:00
Nyall Dawson
061e8587cd When an error occurs while loading a plugin, tag it as a Critical message
instead of just a Warning message
2020-04-16 16:02:41 +10:00
Alex
eda36d4796 Allow using spatialite function on geopackge in dbmanager
Enables Spatialite's amphibious mode for Geopackages, allowing the use of geospatial functions on geopackages in the DB manager.
2019-11-14 10:41:36 -05:00
Bas Couwenberg
2628c480c5 Don't include revision in sources.
Prevent changes to files that weren't changed between releases.
This eases review of the changes between releases significantly.
2019-05-17 16:47:47 +02:00
Alessandro Pasotti
46a4435e65 Use a function to access plugins_metadata_parser global object 2019-05-10 10:21:05 +02:00
Mathieu Pellerin
eacc506a5a Add a REGEXP function in spatialite_connect() python function
This enables DB Manager and the Spatialite Execute SQL algorithm
to use the 'string REGEXP pattern' syntax.
2019-05-06 22:07:00 +07:00
Nyall Dawson
c0105bdfcf Fix exception when reloading plugins 2019-04-26 16:56:30 +10:00
David Marteau
6af744da82 Remove plugin module path when unloading
Unloading plugin must remove added module path
    in order to prevent wrong package import when reloading
2019-04-24 16:09:09 +02:00
Juergen E. Fischer
3d7c711db0 fix #21872 (refs #21774; partly reverts e57d1e06f0 and 507e327c0c)
src/python/qgspythonutilsimpl.cpp:596 produces "lost sys.stdout" when
qgis.utils.updateAvailablePlugins() returns.
2019-04-17 22:30:01 +02:00
Alessandro Pasotti
e57d1e06f0 Fix plugin loading from zip (dependencies followup) 2019-04-09 15:21:09 +02:00
Juergen E. Fischer
eabf56bfb3 fix #21774 2019-04-05 01:15:16 +02:00
Alessandro Pasotti
b85d5af0c0 Add test for plugin dependencies
Also made minor changes to the function and
class names, to be more consistent with QGIS
naming conventions.
2019-03-18 09:20:06 +01:00
Nyall Dawson
2f82bab1d9 Add Python utils method to start a Processing specific plugin
This command adds a plugin to active plugins and calls initProcessing(),
initializing only Processing related components of that plugin.

The new initProcessing() hook should be implemented by plugins
which provide Processing providers or algorithm, and should only
implement code which is required to load the provider and algorithms.
Strictly no GUI related code should be used here, that MUST
be moved out of initializers and deferred to the plugin's
initGui implementation.
2019-03-02 12:06:59 +10:00
Nathan Woodrow
87d2da13fb
[FEATURE][needs-docs] Add new @alg decorator for nicer python processing scripts. (#8586)
@alg()
@alg.help()
@alg.input()
@alg.output()
2018-12-10 16:35:52 +10:00
Ted Meyer
a1d6f29e87 Use time.process_time() instead of time.clock()
time.clock is set to be deprecated in python3.8,
and was replaced by time.process_time in python3.3
2018-10-25 20:48:48 +10:00
Chris Mayo
70a37bf981 Tidy installer_data.py and utils.py
- Fix unused and missing imports
- Only import configparser is needed for Python 3
- Unnecessary string u prefix for Python 3
- Comment typo
2018-09-06 05:56:09 +10:00
Nyall Dawson
36cfaac8af Even more descriptive error 2018-06-29 10:46:09 +10:00
Marco Bernasocchi
96764beff2 more informative error message 2018-06-29 10:46:09 +10:00
Nyall Dawson
dbac3b4922 [python] Block imports of PyQt4 modules
Prevents crashes when PyQt4 modules are imported in QGIS 3.x.
This instantly segfaults QGIS. Throwing an exception makes it
easier to identify the cause as a faulty plugin, and shows
exactly where the bad import is located.
2018-06-29 10:46:09 +10:00
Nyall Dawson
4e38d0696e Documentation 2018-06-06 06:27:33 +10:00
Nyall Dawson
40a2062ec1 [python] Don't install error hook by default
This error hook should only ever be used from QGIS app, never
from standalone scripts and applications, so we should default
to not using it and only install it when initializing python
from app.

Otherwise default behavior for standalone scripts based on
PyQGIS is to silently swallow exceptions - this leaves script
developers *no clues* to go off to debug their applications,
meaning that errors which would usually take a couple of seconds
to fix become horrible exercises in frustration for those
unaware of QGIS' exception handling and the
QGIS_DISABLE_MESSAGE_HOOKS environment variable.

Refs #19111
2018-06-06 06:27:33 +10:00
Matthias Kuhn
cb008699df
Merge pull request #6101 from letmaik/patch-1
Fix tracking of imported modules (and plugin reloading)
2018-05-07 11:25:17 +02:00