[QGIS-Developer] Difficulties with custom bad layer handler in plugin code

Áron Gergely aron.gergely at rasterra.nl
Tue Jul 23 02:51:20 PDT 2019


>> Although my problem (or rather, our problem with Raymond) is similar but
>> not exactly the same:
> Nope - it IS the same ;) You can see it in
> https://github.com/qgis/QGIS/pull/30842

Yes, it's just there is more to it I think. I imagined a qgis with a 
resource sharing system where we would not have broken paths in the 
first place.
It was a comforting thought, so now the lack of it makes me see that as 
my 'real' problem.
Or maybe I am an idealist! :D

> 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)
>
Now aside from my previous thought, this is of course great to have, it 
solves our problem.
Thanks for helping!

Best regards,
Aron




More information about the QGIS-Developer mailing list