You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assuming you mean python plugins, then you can already load and unload them, its just that if they crash they might leave the system in an unknown state (like a Geany plugin can crash geany).
Assuming you mean python plugins, then you can already load and unload
them, its just that if they crash they might leave the system in an
unknown state (like a Geany plugin can crash geany).
Maybe my observations are wrong, but I've got the feeling that it's not
reloaded from disc. So doing a change on geanypy-plugin is not applied
after deactivating and reactivating plguin.
Ahh, yes, you are right, the module is never unloaded, like Geany itself which opens the dll to get the info for the plugin dialog, geanypy loads the plugin module to get the info for its plugin manager. But this seems to only happen at startup, then the dialog is populated and doesn't seem to be reloaded.
By the way Geanypy continues Geany's confusing terminology where "load" really means activate, since the plugin was already actually loaded to get its info. So in fact load and unload only mean activate and deactivate.
Well, imp.load_source() sort of sounds like it will reload the module if its run again.
You can't actually unload the module because then it won't appear in the plugin manager because its info isn't available. And how do you unload a module anyway? Is it safe to just delete the global module object? So as @codebrainz says maybe just reload it and pray?
And how do you unload a module anyway? Is it safe to just delete the global module object?
Probably, but if it uses any C extensions, I don't think they'll be
unloaded or re-initialized next time they're imported. Also they
probably won't actually be unloaded/collected until nothing refers to
them again, which might not be when the del some_module occurs.
At the moment plugins can only set keybindings when they start.
That means that "master" plugins like Geanypy cannot set keybindings for its child Python plugins since it doesn't know them when it starts.
And as the Geanypy plugin manager is itself a plugin therefore I don't think it can have keybindings at the moment.
A new plugin loading method that will support "native" Python plugins is planned to be added during the 1.26 development period, and so the Python plugins will be part of the normal PM I believe.
I've added a feature on my fork to add a 'refresh' button to the python plugin manager, it saves the activated plugins, unloads all, re-searches for plugins, then restores the plugins that were loaded.
to say the "Geanypy" reload is part of the plugin manager plugin, so that is what needs the keybinding, but I may be wrong since the OP hasn't left a link to the code ;-)
I don't think (IIRC) that the Geany plugin API exports the required functions for adding keybinding actions, even for plugins in C, it only supports adding keybinding actions at plugin startup. This is because the keybinding preference GUI does not allow the number of actions in a section to be changed after creation and so no such API exists.
You could look at changing this, as several other parts of Geany could benefit from "dynamic" actions, eg the build menu. But its not intuitively obvious how to do it without breaking lots of stuff which is why its not been done.
Also plugins should not define actual keys for actions since they can clash with ones a user has defined for Geany actions or ones defined for other plugins. Plugins should only add actions and let the user define the key to use.
It will probably work for adding an action, but where would you allow the
user to define the keybinding? It won't add the action into the Geany
keybinding preferences dialog. Having multiple different places to define
keybindings is not a good user interface.
Also beware that Geany does its own key handling before GTK. It lets
keys it doesn't know about go through to Scintilla and GTK, but if it has
the key defined it will override your accelerator, like if the user or
another plugin defines it.
I'm in work at the minute or I'd give it a go
—
Reply to this email directly or view it on GitHub #19 (comment).
Well a true Python/C hacker might manage it with ctypes ;-P
But the question is where would you get the group pointer, and if you said by running plugin_set_key_group() I'll ask where you get the plugin pointer from?
I think its better to wait for a bit until the new plugin system is added and then help moving Geanypy to work with that.
Activity
[-]Option to complete reload a plugin[/-][+]Option to completly reload a plugin[/+]elextr commentedon Feb 21, 2015
Assuming you mean python plugins, then you can already load and unload them, its just that if they crash they might leave the system in an unknown state (like a Geany plugin can crash geany).
frlan commentedon Feb 21, 2015
Am 21.02.2015 um 02:14 schrieb elextr:
Maybe my observations are wrong, but I've got the feeling that it's not
reloaded from disc. So doing a change on geanypy-plugin is not applied
after deactivating and reactivating plguin.
elextr commentedon Feb 21, 2015
Ahh, yes, you are right, the module is never unloaded, like Geany itself which opens the dll to get the info for the plugin dialog, geanypy loads the plugin module to get the info for its plugin manager. But this seems to only happen at startup, then the dialog is populated and doesn't seem to be reloaded.
By the way Geanypy continues Geany's confusing terminology where "load" really means activate, since the plugin was already actually loaded to get its info. So in fact load and unload only mean activate and deactivate.
codebrainz commentedon Feb 21, 2015
I think doing something like
reload()/imp.reload()isn't going to work, but I'd be happy to be proven wrong :)elextr commentedon Feb 22, 2015
Well,
imp.load_source()sort of sounds like it will reload the module if its run again.You can't actually unload the module because then it won't appear in the plugin manager because its info isn't available. And how do you unload a module anyway? Is it safe to just delete the global module object? So as @codebrainz says maybe just reload it and pray?
codebrainz commentedon Feb 22, 2015
On 15-02-21 04:53 PM, elextr wrote:
Probably, but if it uses any C extensions, I don't think they'll be
unloaded or re-initialized next time they're imported. Also they
probably won't actually be unloaded/collected until nothing refers to
them again, which might not be when the
del some_moduleoccurs.frlan commentedon Jul 10, 2015
Will it be possible to do it with keystroke?
elextr commentedon Jul 10, 2015
At the moment plugins can only set keybindings when they start.
That means that "master" plugins like Geanypy cannot set keybindings for its child Python plugins since it doesn't know them when it starts.
And as the Geanypy plugin manager is itself a plugin therefore I don't think it can have keybindings at the moment.
A new plugin loading method that will support "native" Python plugins is planned to be added during the 1.26 development period, and so the Python plugins will be part of the normal PM I believe.
frlan commentedon Jul 10, 2015
For geanypy I was thinking about a global reload feature; As of the new plugin interface: Yes.
elextr commentedon Jul 10, 2015
@frlan I read:
to say the "Geanypy" reload is part of the plugin manager plugin, so that is what needs the keybinding, but I may be wrong since the OP hasn't left a link to the code ;-)
elextr commentedon Jul 10, 2015
I don't think (IIRC) that the Geany plugin API exports the required functions for adding keybinding actions, even for plugins in C, it only supports adding keybinding actions at plugin startup. This is because the keybinding preference GUI does not allow the number of actions in a section to be changed after creation and so no such API exists.
You could look at changing this, as several other parts of Geany could benefit from "dynamic" actions, eg the build menu. But its not intuitively obvious how to do it without breaking lots of stuff which is why its not been done.
Also plugins should not define actual keys for actions since they can clash with ones a user has defined for Geany actions or ones defined for other plugins. Plugins should only add actions and let the user define the key to use.
elextr commentedon Jul 10, 2015
On 10 July 2015 at 20:00, rob notifications@github.com wrote:
Also beware that Geany does its own key handling before GTK. It lets
keys it doesn't know about go through to Scintilla and GTK, but if it has
the key defined it will override your accelerator, like if the user or
another plugin defines it.
elextr commentedon Jul 11, 2015
Well a true Python/C hacker might manage it with
ctypes;-PBut the question is where would you get the
grouppointer, and if you said by runningplugin_set_key_group()I'll ask where you get thepluginpointer from?I think its better to wait for a bit until the new plugin system is added and then help moving Geanypy to work with that.
codebrainz commentedon Jul 11, 2015
You already answered it :)
(untested pseudo-code)
elextr commentedon Jul 11, 2015
Thats the Geanypy pointer not the non-existent pointer for the Python plugin :)
codebrainz commentedon Jul 11, 2015
I thought that was the one you meant.