So what you would do here is implement a custom pre-processor which
detects some hardcoded path to the plugin resource, and swaps it out
with the actual path to the python plugin. E.g.
def my_processor(path):
if path.endswith('my_plugins_super_north_arrow.svg'):
return os.path.join(os.path.dirname(__file__),
'resources/my_plugins_super_north_arrow.svg')
return path
QgsPathResolver.setPathPreprocessor(my_processor)
Basically - whenever a path ending in
'my_plugins_super_north_arrow.svg' is requested, it gets (silently)
modified to point to a subfolder off your plugin's actual runtime
location. You'd just need to make sure the intercepted resources have
a distinct enough name to not clash with other (non-plugin) paths!
(e.g. don't just check for "north_arrow.svg"!).
Nyall
Thanks Nyall!
That sounds exactly what would work for us. I guess we could use a very
unique subdirectory name for storing all the not so unique files and
find them that way.
For "normal" users this will be available from 3.10 right?
Kind regards,
Raymond
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer