On Sun, 17 Jul 2011 17:00:26 -0700
SegundoBob <[email protected]> wrote:
> I hope that someone, who knows more than I about PyQt4 and Leo-Editor,
> will tell me if I'm misusing PyQt4 or Leo-Editor.
>
> In particular, note that I create a new pop-up menu on each button click
> and I never explicitly free the discarded menus. So far as I can tell,
> this does not cause a "memory leak," but it worries me.
I don't think you need to worry about that, if there are no references
left to the thing in question the python garbage collector should
dispose of it. The problem is more often the other way around, where
certain conditions can lead to the Qt C++ object being deleted while
you still have a python reference to its wrapper. But that causes a
traceback, so no need to worry about that either.
I would consider rolling your Node-Visit-History Navigator into the
nav_qt plugin, just because they go together and we should probably
take any chance we can to limit the number of plugins, they're
multiplying like rabbits (and I'm as guilty as anyone, of course).
You could put the context menu on the arrow buttons that plugin already
provides. That's what I'd do anyway, it's up to you of course.
> Is there some way to assign a shortcut keystroke to a command
> implemented in a plugin that allows a user to change the shortcut
> keystroke assigned to the command? I don't know any way to do this. My
> testing indicates that a shortcut specifier in myLeoSettings is silently
> ignored if the command it assigns is defined in a plugin or is not
> defined anywhere.
I think if you plugin provides a command like this (at top level in
module):
@g.command('my-new-command')
def do_thing(event):
c = event.get('c')
if not c:
return
c.my_plugin_controller.do_thing()
then a binding like
my-new-command = Ctrl-B
in the @shortcuts node in the @keys node in the @settings node should
work. I have a couple of things running that way.
Also, pick command names with a common prefix:
clonenav-next
clonenav-prev
etc. - makes them easier to find with Alt-X tab expansion and keeps the
namespace clean.
Cheers -Terry
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.