15 Commits

Author SHA1 Message Date
Sandro Mani
3abd80cffa Update qgspathresolver.sip.in 2021-07-10 06:35:19 +10:00
Nyall Dawson
711a615be3 Fix raises sphinx format 2021-06-25 10:50:04 +10:00
Sandro Mani
001d363b2e Implement project file attachments 2021-06-22 09:04:48 +02:00
Sandro Mani
f202c72bdd Fix incorrect note that setting a new path preprocessor replaces any existing processor 2021-06-19 09:45:12 +10:00
Sandro Mani
c09be939f1 Add QgsPathResolver::setPathWriter and QgsPathResolver::removePathWriter 2021-06-19 09:45:12 +10:00
Nyall Dawson
4ff3f447dc Don't try to insert links in raises blocks in PyQGIS docs
These aren't formatted correctly if we do
2021-06-10 11:03:43 +10:00
Nyall Dawson
8359281012 Fix formatting of exception blocks in PyQGIS docs 2021-06-10 11:03:43 +10:00
Denis Rouzaud
35c557a234 run sipify 2021-05-26 14:30:54 +02:00
Denis Rouzaud
ba8a445850 run sipify 2021-03-22 21:13:52 +01:00
Nyall Dawson
81a9db9f57 [sipify] Fix creation of cross references 2020-06-15 13:43:58 +10:00
Harrissou Sant-anna
63f5fa9c86 Fix code sample rendering in pyqgis doc 2019-08-28 12:07:27 +10:00
Nyall Dawson
24fb1196c5 [needs-docs] Revise QgsPathResolver::setPathPreprocessor API
Allow path preprocessors to be chained and don't force replace
any existing ones.

Processors can be removed via a call to QgsPathResolver::removePathPreprocessor,
using the unique ID returned by the original call to setPathPreprocessor
2019-08-23 06:35:12 +10:00
Nyall Dawson
83a842d44f Ensure ownership of path preprocessor is transferred 2019-07-25 08:41:28 +10:00
Nyall Dawson
2237c6ae99 [API][FEATURE] Allow setting a custom path pre-processor for QgsPathResolver
QgsPathResolver::setPathPreprocessor allows setting a custom path pre-processor
function, which allows for manipulation of paths and data sources prior
to resolving them to file references or layer sources.

The processor function must accept a single string argument (representing the
original file path or data source), and return a processed version of this path.

The path pre-processor function is called before any bad layer handler.

Example - replace an outdated folder path with a new one:

  def my_processor(path):
    return path.replace('c:/Users/ClintBarton/Documents/Projects', 'x:/Projects/')

  QgsPathResolver.setPathPreprocessor(my_processor)

Example - replace a stored database host with a new one:

  def my_processor(path):
    return path.replace('host=10.1.1.115', 'host=10.1.1.116')

  QgsPathResolver.setPathPreprocessor(my_processor)

Example - replace stored database credentials with new ones:

  def my_processor(path):
    path= path.replace("user='gis_team'", "user='team_awesome'")
    path = path.replace("password='cats'", "password='g7as!m*'")
    return path

  QgsPathResolver.setPathPreprocessor(my_processor)
2019-07-25 08:41:28 +10:00
Denis Rouzaud
7df2593caf move auto generated sip file in dedicated folder 2018-05-14 10:23:37 -04:00