Recently we have had discussions about how Trillum (and some other 
applications) can render graphics and text together.  Some of these 
applications have outlines and even clones similar to how Leo uses them.  A 
number of people have said that they wish that Leo could do the same.  

Here are two of the discussion threads:
A Leo relative in the wild: Trilium Notes 
<https://groups.google.com/g/leo-editor/c/Dwl-3fTLQeY>
ENB: VR panes and the NestedSplitter plugin 
<https://groups.google.com/g/leo-editor/c/MsfiyNpE5oU>

Typically one can edit in an editing view or display a fully rendered view 
that you don't edit directly.

In the discussion I pointed out that the Viewrendered3 plugin can take care 
of the mixed rendering tasks. You need to learn a bit of Markdown or 
RestructuredText (or Asciidoc) and then you can embed images, math 
formulas, and so on.  It would be possible to write scripts to simplify 
some of these details, but it's pretty easy as is.  With VR3 you have an 
additional pane for the VR3 display.  To make it more like Trillium, etc., 
and to save screen real estate, the VR3 display should display on top of 
the body pane.  You would swap it in or out depending on whether you want 
to edit or not.

I have devised a script that can do this swap.  You can put it into a 
button for easy activation, or you could make it into a command in the 
Settings tree and bind it to a keystroke.  With a tiny change to the script 
it will work for the Viewrendered plugin as well (but not in current *devel* 
versons).  
But VR has a more limited range for rendering that VR3.

When this script has been used, the other ways of showing and hiding the 
VR3 pane don't work.  I will see if there is a way to work around this 
without needing to change VR3's code.  In the meantime, give the script 
below a try.  You can copy it to a new node in your Workbook and create a 
button for it.

@language python
"""Toggles the body frame between the body editor and
a Viewrendered3 rendered view.
"""
from leo.core.leoQt import QtWidgets
import leo.plugins.viewrendered3 as v3

flc = c.free_layout  # free layout controller
top = flc.get_top_splitter()
if top:
    bfw = top.find_child(QtWidgets.QWidget, "bodyFrame")
    kids = bfw.children()

qf0 = kids[0]
stacked_layout = qf0.children()[0]

h = c.hash()
if stacked_layout.count() == 1:
    v3.controllers[h] = vr3 = v3.ViewRenderedController3(c)
    stacked_layout.addWidget(vr3)
    vr3.show()
else:
    vr3 = v3.controllers.get(h)

if stacked_layout.currentIndex() == 0:
    stacked_layout.setCurrentWidget(vr3)
else:
    stacked_layout.setCurrentIndex(0)


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e3f61ef9-7206-4420-8d43-b150cd557e91n%40googlegroups.com.

Reply via email to