-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to completly reload a plugin #19
Comments
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). |
Am 21.02.2015 um 02:14 schrieb elextr:
Maybe my observations are wrong, but I've got the feeling that it's not |
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. |
I think doing something like |
Well, 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? |
On 15-02-21 04:53 PM, elextr wrote:
Probably, but if it uses any C extensions, I don't think they'll be |
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. Works nice as you can keep the python plugin manager open and just hit refresh to reload your python plugin when you're working on it. I'd also recommend running geany from a terminal with -vv to get debug output |
Will it be possible to do it with keystroke? |
Oooo I'm not sure, I haven't got that far with my plugin development knowledge yet. |
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. |
For geanypy I was thinking about a global reload feature; As of the new plugin interface: Yes. |
@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 ;-) |
Yeah the manager is in python but since its part of the C plugin, it shouldn't be too hard to get the signal in C and call a function in the python code. I'll look at it tonight. I'll see if its possible for the python to add a keybinding first as im sure that'd be a useful example for developing plugins. I've found the bit of code in the codenav plugin that uses a keybinding so that'll help me figure out what I'm looking for. |
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. |
Yeah, I'm pretty new to the project so thank you for your experience. I'm wondering could it be done in pygtk like in thsi example: I'm in work at the minute or I'd give it a go |
On 10 July 2015 at 20:00, rob [email protected] wrote:
Also beware that Geany does its own key handling before GTK. It lets
|
I see what you mean, unless the keybindings_set_item |
Well a true Python/C hacker might manage it with But the question is where would you get the 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. |
You already answered it :) from ctypes import *
mod = CDLL(handle=None)
geany_plugin_ptr = c_void_p.in_dll(mod, "geany_plugin") (untested pseudo-code) |
Thats the Geanypy pointer not the non-existent pointer for the Python plugin :) |
I thought that was the one you meant. |
On developing a plugin it would be quiet useful to complete unload and load a given plugin instead of restarting Geany complete.
The text was updated successfully, but these errors were encountered: