130 Commits

Author SHA1 Message Date
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
Denis Rouzaud
3dc3d9d1b2 unite QgsMessageLog::Level and QgsMessageBar::MessageLevel in Qgis::MessageLevel
make enum items lower case
remove unused QgsMessageLog::None and All
2018-02-06 08:56:40 -04:00
Maik Riechert
19592dc8d7
Fix tracking of imported modules
__import__(name, ..., fromlist, ...) always returns the top-level package if `import x.y.z` is used (here `x`), and the module given by `name` if `from x.y.z import a` is used, here `x.y.z`. Differentiating between these two cases can be done by looking at the `fromlist` argument. By not tracking modules correctly, plugin unloading/reloading was broken if a module hierarchy within a plugin was used and `from` was not exclusively used.
2018-01-18 23:26:36 +00:00
Juergen E. Fischer
24e6366815 mod_spatialite added to osgeo4w 2017-11-05 21:03:08 +01:00
Juergen E. Fischer
e523780945 add loading of spatialite on windows and remove remaining references to
pyspatialite (followup 39816cf84)
2017-10-29 20:32:43 +01:00
gacarrillor
6402160526 Use sqlite3 instead of pyspatialite for SpatiaLite connections 2017-10-29 10:46:54 -05:00
David Marteau
40b916c7a3 Disable message hook and import override at runtime 2017-10-17 09:40:22 +02:00
Nyall Dawson
acbba3a387 Fix excepthook handling in standalone scripts 2017-09-24 07:47:45 +10:00
Nathan Woodrow
df7c3df473 Revert "Ignore some python warnings for now"
Doesn't work on all platforms

This reverts commit f0e53db254f38071e87b993b580ea050b19f4b17.
2017-09-04 14:22:24 +10:00
Nathan Woodrow
f0e53db254 Ignore some python warnings for now
shhhh Qt5
2017-09-04 12:30:26 +10:00
Mario Baranzini
78af413dcc Remove python future compatibility layer 2017-08-07 10:27:15 +02:00