[Qgis-developer] Changes to python/utils.py

Martin Dobias wonder.sk at gmail.com
Tue May 29 23:04:37 PDT 2012


On Wed, May 30, 2012 at 1:44 AM, Larry Shaffer <larrys at dakotacarto.com> wrote:
>> I would like to keep the "hard" reload as a default since you can
>> trust it to do its work. The "live" reload could be eventually added,
>> too, as an option for the brave ones :-)
>
> By 'keep the "hard" reload ' do you mean the current reload function,
> or the basic reload function of a reloader.py-upgraded utils.py?

Actually I was referring to the current method: unload + load plugin again.


> By 'live' I'm guessing you are referring to the 'automatic detection
> of module changes,' i.e. monitor.py . I don't think that live
> reloading would be that useful for QGIS plugin development. I'm mostly
> looking at this module's functionality as a more complete basic plugin
> reloader. Live reloading and __reload__() functions are secondary, and
> will probably cause more problems than they solve.

By live reloading I meant the reloading you proposed with reloader
module, without monitoring of files. I thought that your main reason
for introducing the reloader was the ability to keep plugin state
while reloading (with __reload__() method) - if not, where is the
added value of it?


>> Btw. Plugins should not alter sys.path. I know that some do it, but
>> that's a bad idea.
>
> I think sometimes this is necessary. For example, my Plugin Editor
> plugin contains several third-party packages that only work when on a
> sys.path. Plugin maintenance/support-wise, I would rather know the
> embedded packages, though maybe outdated, will continue to work, and
> new versions can be tested before being upgraded.

Yeah, with some 3rd party packages it makes sense. Unfortunately some
plugins simply add a plugin subdirectory that is an ordinary path of
the plugin.

Regards
Martin


More information about the Qgis-developer mailing list