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

Nyall Dawson nyall.dawson at gmail.com
Wed Jul 24 15:49:33 PDT 2019


On Tue, 23 Jul 2019 at 19:51, Áron Gergely <aron.gergely at rasterra.nl> wrote:
>
>
> >> 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!

Ok. That's been merged and will be backported for 3.8.2. Additionally,
I've fixed one of your original issues in
https://github.com/qgis/QGIS/pull/30911 where we avoid plugin's bad
layer handlers being clobbered by the inbuilt one immediately after
the plugin load completes.

Nyall

>
> Best regards,
> Aron
>
>


More information about the QGIS-Developer mailing list