← Back to team overview

kicad-developers team mailing list archive

Re: Current state of ActionPlugin

 

Le 11/01/2017 à 17:36, Jean-Samuel Reynaud a écrit :
>>> Pay a particular attention to the fact plugins can be *now* updated (when the source file has
>>> changed), and therefore menus can also be updated.
>>> the "PCB_EDIT_FRAME::createActionPluginMenus()" method calls Connect, but Disconnect is never called
>>> by destructors.
>>> It can create issues when updating scripts, because it could be called more than once.
>>
>> If you need to update the menus when a script file changes, you would
>> have to connect a wxFileWatcherEvent to the appropriate wxMainFrame
>> object to monitor the loaded script file and update the menus
>> accordingly.  It can be done but I would proceed with caution here.
>>
> Is it really necessary to add a file watcher ? Once python plugins are
> loaded, python subsystem run the plugin as it was at start time (As I
> understand).
> I had perform a little test for that. If you modify a plugin while
> pcbnew is running, this is always the "old" version that is running. Not
> sure that is true for all OS...

I am thinking you are talking only about tests on footprint wizards.

On Windows, the newer is reloaded (as long as you run onUpdatePythonModulesClick).
This is easy to see if the description string in the footprint plugin is modified.

> So menu are not supposed to change even if file change.
> An other point: if I implement that file watching, I should also
> implement a "directory watcher". In case a new plugins is installed
> during pcbnew is running ;)
> Perhaps an "update button": like onUpdatePythonModulesClick for
> footprint plugins ?

>From my experience when debugging a footprint wizard module:
An "update button" is certainly enough: it is mainly for python script developers when they are
writing and debugging a python script, not for an user who just uses a script.
An automatic update is not useful, and perhaps not good.

The update button was asked since a long time, and I perfectly understand this wish.
(The old way was: closing and rerun kicad)
It is intended to reload python modules during their development.

Remark: onUpdatePythonModulesClick updates all loaded python modules.
Of course only python modules which are newer than the currently loaded are reloaded.
Therefore onUpdatePythonModulesClick will also update the action plugins.

-- 
Jean-Pierre CHARRAS


Follow ups

References