On Tue, 28 Apr 2015 03:56:14 -0700 (PDT)
john lunzer <lun...@gmail.com> wrote:

> I'm trying to slosh through bookmarks.py and hack it up to give me my
> own plugin which can add a widget to a pane. 
> 
> I'm sure this isn't the best way to go about this and I was wondering
> if there was a minimal example to show how to achieve a plugin that
> can be added to a pane. I would be grateful for the help.

Regarding adding widgets and ignoring plugins, maximally minimal would
be:

from leo.core.leoQt import QtWidgets
w = QtWidgets.QSlider()
c.free_layout.get_top_splitter().addWidget(w)

Adds slider widget, probably on right hand side, not that noticeable,
you could miss it ;-)

w can be anything of course, a QWidget with a layout containing lots of
other widgets, for example. To make your widget addable from the super
secret right-click on the pane dividers context menu, you need to
implement the "provider" interface defined here:

file://{{g.getBaseDirectory(c)}}/LeoPyRef.leo#Code-->Qt%20gui-->@file%20../plugins/nested_splitter.py-->class%20NestedSplitter%20(QSplitter)-->register_provider

I've posted examples here:
https://github.com/leo-editor/snippets/blob/master/examples/demo_widget.py
(the example is correct, the file:// link is missing some parameters
for the ns_do_context() method)

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to