viewrendered2 plugin

409 views
Skip to first unread message

Peter Mills

unread,
Feb 25, 2014, 4:31:38 AM2/25/14
to leo-e...@googlegroups.com
Hi all

As mentioned in my previous post I'll attempt to elaborate on the plugin I've used to make Leo more useful to me, in case it is useful for others also.  Apologies for the very long post, but I wanted get get all its features and warts exposed here to get some feedback on whether others see this as useful or that this is only valuable to me.  If it's useful to others then it may be worth polishing up quite a bit.

Why a better viewrendered plugin?
--------------------------------------------------
I like to use reStructuredText (reST) for all of my note-taking, idea development, project and task management and automation of desktop activities (e.g. initiating a backup).  You could say it is the control centre of my daily activities, including calculating and showing dashboards of where I am and where I'm going.

This means I need a tool which seamlessly shows me the full-fidelity browser-rendered version of what I am writing and be able to print my notes for meetings, cut and paste nicely formatted output to my office e-mails and documents, as well as show some of the material as a slideshow.

The existing *viewrendered* plugin couldn't seem to do what I needed (especially math) and I was almost ready to abandon Leo again.  This time I bit the bullet and created a more capable renderer in viewrendered2 (VR2).  Initially I made a plugin that rendered, on demand, to my normal web browser.  This worked well, but I really thought live rendering like "viewrendered" would be better, and for that I needed close control over scroll positions etc. that I couldn't get with an external browser.  So the plugin became much more complex as I merged it with the existing viewrendered plugin, but was ultimately more powerful and useful to me.

Objectives
--------------
* Show a "full" html representation of any reST node or tree, without an
  @rst root node, including more features than the existing viewrendered plugin:

  - proper html layout
  - math (mathjax, etc.)
  - clickable URLs
  - clickable hyperlinks within the page (e.g. TOC)
  - good quality zoom
  - cut and paste html with ctl-C
  - s5 slideshows
  - javascript
  - svg images
  - configurable css

* Allow showing of node tree rather than just the current node.  This can give
  a better overview perspective of the tree contents.

* Be able to lock the rendering on the root node of a tree, to view the effect
  editing a sub-node within the larger html document.

* Provide proper rendering of any combination of node types in a tree, so long as
  they have been properly designated by @language directives (i.e. reST, text,
  code, css, ...).

* Allow viewing (and printing) of an entire source file from an @file type root node.

* Be able to *export* any of these renderings to a full web-browser to take advantage
  of the large rendering window (especially for slideshows, as well as printing, saving output.
  
* Be able to integrate automatically executed code nodes intermingled with
  reST nodes to provide an automatic calculation-based "Notebook" or "Report"
  type output.

* Don't increase the dependencies of Leo.

Implementation
----------------------
VR2 is implemented mostly as an ~600 line expansion of the update_rst method in the viewrendered.py plugin.  The text-oriented class used for rendering in VR1 has been replaced by the QWebView class which provides the full rendering functionality of a real web-browser.  To make this flexible, a toolbar has been attached to the top with a few controls.

Because I wanted to retain compatibility with VR1, I created the viewrendered2.py plugin, but retained all the class naming which occurred within VR1.  This means that it remains compatible with the existing mechanisms (like free_layout) of showing and creating panes for VR1.  I tried this with an expectation that it would fail, but it appears to work without any unintended side-effects.

Tooltips have been added where Qt allows, with the philosophy that a user shouldn't need a manual to use this pane.

VR2 has been used a lot under Windows 7 and a little under Ubuntu 13.10.

Issues / Limitations
----------------------------
I use VR2 every few minutes every working day.  However, VR2 is likely to still have a lot of rough edges and, in particular, bugs that show up with different work flows or css folder layouts etc.  In fact, VR2 is still a work in progress and therefore still being fiddled with, so bugs creep in regularly.

But overall, my perception of its deficiencies are:

* Does not handle reST headings within the node bodies well (sometimes very slow
  render, blocking Leo).

  - VR2 attempts to reconcile reST headings that originate from explicit
    headings within the nodes against reST headings that are automatically
    generated by the node hierarchy.  In many cases, this is impossible,
    resulting in many errors which drastically slows down rendering.
  - Recommend not using headings within the nodes themselves, leaving the node
    hierarchy to do this automatically.

* If the node triggers one of the special viewrendered node header types  (@md,
  @image, @movie, @html) VR2 simply defaults to the old handlers for those
  types.  This means it jumps back to whatever pane type VR1 uses, so the
  features of VR2 disappear.  I suspect that VR2 could incorporate these types
  into the new version and retain these new features.  I should look at that.
    
* Doesn't integrate with rst3 plugin, especially honouring @others etc.
  There are some conflicts in objectives, so this may never be fully resolved.
  It would probably make sense for rst3 settings to get used for VR2 as well,
  along with additional VR2 specific settings.  Currently, VR2 has its own
  @settings-style settings.  The rst3 code is not used.
  
* For slideshow purposes, a patch to docutils s5_writer is required to be able
  to handle an arbitrary hierarchy of nodes (forces all headings to start a new
  slide).  Otherwise, only the 2nd level nodes (from the root) force a new slide.
  
* The integration of VR2 code into the existing viewrendered plugin code is
  rudimentary.  I took the shortcut of not trying to understand this code well
  and confining my integration to the rst rendering only.  Better integration
  would be a good future step.

With the plugin being able to execute javascript etc. there may be some form
of security issue, but I can't see it myself (given that Leo can execute
arbitrary python code anyway).  Any thoughts?

Future?
-----------
* Expand the export button if pandoc is installed, adding optional
  output formats such as docx, odt, plus additional slideshow formats. 
* Use new reST functionality to replace other media viewrendered methods
  for images, svg, movies, etc.
* Integrate better with rst3?

Conclusion
----------------
* I've attached the source as well as a bunch of screenshots.  Feel free to try out the source by putting viewrendered2 into your @enabled-plugins instead of the usual viewrendered.  I'd be interested in whether it works or not - expect bugs to show up!
* I'm looking for feedback on whether this appears useful to others and not just me.  If so, it should probably be polished a bit more before being used widely.  Perhaps greater understanding of the existing viewrendered plugin operation would help me here.

Feedback is welcome.

Peter.
VR2test2.png
view_of_multi-node_code.png
zoomed_out.png
wikipedia.png
notebook.png

Peter Mills

unread,
Feb 25, 2014, 5:42:58 AM2/25/14
to leo-e...@googlegroups.com
Oops, forgot the plugin code.

Peter.
viewrendered2.py

Jacob Peck

unread,
Feb 25, 2014, 8:44:43 AM2/25/14
to leo-e...@googlegroups.com
Impressive work, Peter! Thanks for this!

:)

-->Jake
> --
> 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+...@googlegroups.com.
> To post to this group, send email to leo-e...@googlegroups.com.
> Visit this group at http://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/groups/opt_out.

HaveF

unread,
Feb 25, 2014, 8:43:49 PM2/25/14
to leo-e...@googlegroups.com
Wow, Peter!

That's very nice!
Especially, the render whole tree and notebook feature! I love it.

Edward K. Ream

unread,
Feb 26, 2014, 8:20:14 AM2/26/14
to leo-editor
On Tue, Feb 25, 2014 at 4:42 AM, Peter Mills <peter.m...@gmail.com> wrote:
Oops, forgot the plugin code.

​I pushed the unmodified viewrendered2.py to Leo's git repo.

Apparently you did not use Leo to make the additions: there is a line containing << >> which prevents Leo from writing the @file node.

I'll correct this problem, put class WebViewPlus in its own tree, and add @file viewrendered2.py to LeoPluginsRef.leo.  Probably today.

Edward

Edward K. Ream

unread,
Feb 26, 2014, 8:55:46 AM2/26/14
to leo-editor
On Wed, Feb 26, 2014 at 7:20 AM, Edward K. Ream <edre...@gmail.com> wrote:

​> ​
Apparently you did not use Leo to make the additions

​Rev c1879031106... corrects a *big* problem with viewrendered2.py.  It contained the same sentinels (gnx's) as viewrendered.py, which means that when I added @file viewrendered2.py to leoPy.leo all unmodified nodes in the two files became clones of each other!  In turn, this meant that saving viewrendered2.py also altered viewrendered.py

The fix was easy, once I understood what was happening.  I copied and pasted the entire @file viewrendered2.py tree, thereby changing all the sentinels.

> I'll correct this problem, put class WebViewPlus in its own tree, and add @file viewrendered2.py to LeoPluginsRef.leo.

Now these steps can be done safely, without changing viewrendered.py.

EKR

Edward K. Ream

unread,
Feb 26, 2014, 9:32:19 AM2/26/14
to leo-e...@googlegroups.com
On Wednesday, February 26, 2014 7:55:46 AM UTC-6, Edward K. Ream wrote:

>> I'll correct this problem, put class WebViewPlus in its own tree, and add @file viewrendered2.py to LeoPluginsRef.leo.

> Now these steps can be done safely, without changing viewrendered.py.

Rev e5ff5596de54... puts the WebViewPlus class in its own tree.  This resulted in an unreadable diff, so please test thoroughly.

I am aware of the problem with tooltip text: there is a do-nothing adjuster method that will deal with the problem asap.

EKR

Edward K. Ream

unread,
Feb 26, 2014, 9:43:57 AM2/26/14
to leo-editor
On Wed, Feb 26, 2014 at 8:32 AM, Edward K. Ream <edre...@gmail.com> wrote:

I am aware of the problem with tooltip text: there is a do-nothing adjuster method that will deal with the problem asap.

​Done.  Also updated leoPluginsRef.py to include viewrendered2.py.  This concludes my packaging work on this very important plugin.

Please let me know immediately if I have introduced any problems.

EKR

Matt Wilkie

unread,
Feb 26, 2014, 3:26:05 PM2/26/14
to leo-e...@googlegroups.com
{{enthusiastic applause!}} Thank you for sharing this very interesting and exciting work. The possibility of being able to view a completely rendered tree, plus export, is very attractive.

-matt


--

Peter Mills

unread,
Feb 26, 2014, 7:00:30 PM2/26/14
to leo-e...@googlegroups.com
Thanks for tidying this up Edward.  Since I was using Spyder to develop it, I had been wondering how I could get the sentinals back in order.  I still have a bunch of minor bug fixes, corrections and further features that should be done here, so I would still like to contribute to VR2.  So having no idea of git and GitHub at this point, I assume I should get a GitHub account (as HaveF has suggested), install git, and of course use Leo to make any changes.  What sort of access approvals do I need and are you willing to have a newbie play in your sandpit?
 
Peter

Fidel N

unread,
Feb 27, 2014, 1:09:23 AM2/27/14
to leo-e...@googlegroups.com
Hey Peter, I recently started with git too, I would recomend this tuto first, its like a 2 minute thing, but gives you a clear view for starters,then you can study further into what you want:


Then, you can actually make a clone of Leo repository, edit what you want,then do a pull request, so those will be approved later, meaning, you dont need special permissons to do that :)

lewis

unread,
Feb 27, 2014, 5:31:14 AM2/27/14
to leo-e...@googlegroups.com
Thanks for your work on the plugin Peter.
Edward, can you clarify how to enable this new plugin. It isn't listed in leoSettings.leo file.

If I enable it in myLeoSettings.leo it doesn't appear in the menu list of plugins.
Here is the logfile:
Leo Log Window
Leo 4.11 final, build 16c5c24e341c (branch: master), 2014-02-27 08:10:57
Python 3.3.5, qt version 4.8.5
Windows 6, 1, 7601, 2, Service Pack 1
'@focused-border-unfocus-color' from style-sheet comment definition, please use regular @string / @color type @settings.
Abbreviations off
syntax error importing plugin: leo.plugins.viewrendered2
loadOnePlugin: can not load enabled plugin: leo.plugins.viewrendered2
reading: C:\Users\lewis\.leo\myLeoSettings.leo

Thanks
Lewis

Edward K. Ream

unread,
Feb 27, 2014, 7:18:24 AM2/27/14
to leo-editor
On Wed, Feb 26, 2014 at 6:00 PM, Peter Mills <peter.m...@gmail.com> wrote:

I assume I should get a GitHub account (as HaveF has suggested), install git, and of course use Leo to make any changes.  What sort of access approvals do I need and are you willing to have a newbie play in your sandpit?

Yes, you should get a GitHub account.  Let me know when you have it set up and I'll give you write access.  I've already made many refactorings to the code.  You will want to start with the latest code and review what I did.  There are several more changes I will make today.

After yesterday's work, I understand the new code literally line by line.  Imagine my surprise when I realized that it doesn't support anything "fancy", it simply supports a full-featured html browser.  All the usual suspects, Ville, Terry, et. al., probably realized the implications long ago: all the features shown in your screen shots (especially VR2test2.png) come from html itself, aided by docutils, matplotlib, mathjax etc.

Could you share the Leo outlines (and css, if relevant) used to generate your example screen shots?  I'd like to see exactly how they were created. Using the VR2 plugins is easy, but I want to make sure everyone (including me) understands how to get the most of what you have created.

Thanks.

Edward

Reinhard Engel

unread,
Feb 27, 2014, 7:43:52 AM2/27/14
to leo-e...@googlegroups.com
Lewis, 
I just happened to read your post.
Goto 'File|Settings...'.
Open '@settings|Plugins|@enabled-plugins'.
Add viewrendered2.py to the list '# Recommended plugins in the body pane.

God luck!
Reinhard

lewis

unread,
Feb 27, 2014, 4:23:31 PM2/27/14
to leo-e...@googlegroups.com
Reinhard,

I had done exactly as you suggested and it gives the error message
'syntax error importing plugin: leo.plugins.viewrendered2
loadOnePlugin: can not load enabled plugin: leo.plugins.viewrendered2
'

Viewrendered2 does not appear in output from selecting
Plugins > Print-plugins-info:
 ...
 leo.plugins.mod_http        myLeoSettings.leo
 leo.plugins.viewrendered    myLeoSettings.leo
 leo.plugins.plugins_menu    myLeoSettings.leo
 ...

Regards
Lewis

Reinhard Engel

unread,
Feb 27, 2014, 6:35:02 PM2/27/14
to leo-e...@googlegroups.com
Probably a stupid question:
You did put viewrendered.py into the plugins folder?
Or may be there really is a syntax error in your version of this plugin.

Regards
Reinhard

lewis

unread,
Feb 27, 2014, 8:34:31 PM2/27/14
to leo-e...@googlegroups.com
It's a good question :)
I'm running the latest build (ddfc2646f465) and have confirmed that viewrendered2.py is in the plugins folder

Is viewrendered2.py intended as a replacement of viewrendered.py or an additional plugin?

Lewis

Peter Mills

unread,
Feb 27, 2014, 9:03:26 PM2/27/14
to leo-e...@googlegroups.com

On Friday, February 28, 2014 11:34:31 AM UTC+10, lewis wrote:
It's a good question :)
I'm running the latest build (ddfc2646f465) and have confirmed that viewrendered2.py is in the plugins folder

Is viewrendered2.py intended as a replacement of viewrendered.py or an additional plugin?

Lewis
Viewrendered2 is a replacement for viewrendered.  It is unlikely to work if you have both enabled.

Fidel N

unread,
Feb 28, 2014, 3:33:46 AM2/28/14
to leo-e...@googlegroups.com
Wow I think that should be written somewhere near the plugins activation node in leosettings. Someone could think that viewrendered is actually necesary for being able to use Viwrendered2. Or an auto-ignore vr activation if vr2 is active.

lewis

unread,
Feb 28, 2014, 3:42:10 AM2/28/14
to leo-e...@googlegroups.com
OK thanks.
I renamed viewrendered2.py as viewrendered.py so it will load by default.
I tried this on 2 machines but it still fails to load. Here is the log from laptop running Vista:
Leo Log Window
Leo 4.11 final, build ddfc2646f465 (branch: master), 2014-02-28 19:09:23
Python 3.3.5, qt version 4.8.5
Windows 6, 0, 6002, 2, Service Pack 2
leoID=lewis (in C:\Users\Neal\.leo)
load dir: C:\Python33\Lib\site-packages\leo-editor\leo\core
global config dir: C:\Python33\Lib\site-packages\leo-editor\leo\config
home dir: C:\Users\Neal
reading settings in C:\Python33\Lib\site-packages\leo-editor\leo\config\leoSettings.leo
docutils loaded
reading settings in C:\Users\Neal\.leo\myLeoSettings.leo
http serving enabled at 127.0.0.1:8130, version 0.99
reading settings in C:\Users\Neal\.leo\workbook.leo
Abbreviations off
syntax error importing plugin: leo.plugins.viewrendered
loadOnePlugin: can not load enabled plugin: leo.plugins.viewrendered

Is the plan to eventually replace the old viewrendered with v2? Theglobal leosettings enables viewrendered by default which requires performing a file rename.

Thanks
Lewis

lewis

unread,
Feb 28, 2014, 3:57:55 AM2/28/14
to leo-e...@googlegroups.com
It's worth noting that it doesn't appear in the menu list of plugins, or when selecting Plugins > Print-plugins-info.
Hope it helps.

Regards
Lewis

lewis

unread,
Feb 28, 2014, 4:23:27 AM2/28/14
to leo-e...@googlegroups.com
Using vr2, start leo, select F1 key. Here is the traceback:
[snip]
syntax error importing plugin: leo.plugins.viewrenderedloadOnePlugin: can not load enabled plugin: leo.plugins.viewrendered

loadOnePlugin: can not load enabled plugin: leo.plugins.viewrenderedexception executing command

exception executing commandTraceback (most recent call last):


Traceback (most recent call last):  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoCommands.py", line 535, in doCommand
    val = command(event)


  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoCommands.py", line 535, in doCommand
    val = command(event)  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoEditCommands.py", line 7445, in help
    self.c.putHelpFor(rst_s)


  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoEditCommands.py", line 7445, in help
    self.c.putHelpFor(rst_s)  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoCommands.py", line 1152, in putHelpFor
    assert vr # For unit testing.


  File "C:\Python33\Lib\site-packages\leo-editor\leo\core\leoCommands.py", line 1152, in putHelpFor
    assert vr # For unit testing.AssertionError


AssertionError
[end]

Lewis

Peter Mills

unread,
Feb 28, 2014, 5:30:19 AM2/28/14
to leo-e...@googlegroups.com


On Friday, February 28, 2014 7:23:27 PM UTC+10, lewis wrote:
Using vr2, start leo, select F1 key. Here is the traceback:
AssertionError
[end]

Lewis
Hi Lewis

I don't know which version of viewrendered2.py (my original or Edward's git version) you are testing so its hard to pinpoint a problem that others don't seem to be having. I would expect that the reason the viewrendered2 plugin is not showing up in the plugin list is because of the error that occurred on loading - it didn't load, so it still doesn't exist in Leo.  I believe this essentially causes the Assertion error above.  The reason it doesn't load shows up as a syntax error - this syntax error certainly doesn't exist in my version.  However, this will depend on the version of viewrendered2 you have and also potentially which version of Python you have.  I have NOT tested this plugin on Python 3 (just in case you have this version) or on versions before 2.7.

Ultimately, if folk believe that the new reST rendering components of viewrendered2 are better than viewrendered, I don't really see any point to retaining the original.  However, at this point in time, it's probably worth a few people testing and commenting on it before that decision should be considered.

Peter

Peter Mills

unread,
Feb 28, 2014, 6:19:16 AM2/28/14
to leo-e...@googlegroups.com
You guys have left me in your wake with all your suggestions, tidying up code (thanks Edward) and discussion of other mods.  Unfortunately, I'll make this worse over the next two weeks since I'll be travelling overseas with poorer communication options.

Since there seem to be several people testing Viewrendered2, there is a problem in that the plugin itself doesn't have a good docstring for the plugin help functionality.  I'll fix this with a pull request sometime.  However, I've put a rough version of the additional manual materials below - hopefully this will help in the short term.

I've also added the example Leo outline (VR2test.leo) that I used to generate the screenshots.  Note that the @thin file included shouldn't be refreshed from disk since this won't be in your file system at this location, but I think it should still show what is intended.

I think there was a question about the css that I used to make the html look the way I like (it should still work fine without this css stuff though!).  I've attached css.zip, which should be unzipped and the resulting css folder placed in the same folder as VR2test.leo.  Much of this already comes from Leo, but the leo_vr.css is the main one for this.  VR2test.leo has a built-in setting to find this css file if you include this css directory as described.

Also, for those more adventurous, the slideshow option outputs an s5 html slideshow which requires the correct javascript and support files.  I've attached ui.zip from which the 'ui' folder should also be placed into the VR2test.leo folder.  I think this is still the normal s5 support folder unmodified by me.  However, it should be noted that without a specific patch I created, docutils doesn't really produce nice slides out of arbitrary tree of nodes.

Note that the text below is valid reST and if you paste it into a node, should produce a more readable version in viewrendered or viewrendered2.


Preliminaries
============
* Viewrendered2 is a replacement for Viewrendered.  They can't co-exist.
* The existing viewrendered commands are still valid and no additional commands have been added.
* Extra settings specific to Viewrendered2 have been added.
* I have not tested the plugin on Python 3.

Using the Toolbar
=================

:Go Back: Browser-style navigation
:Go Forward: Browser-style navigation
..
:Reload: Force an update the rendering of the selection node or tree.  This button is used to manually update the This can be also be used to revert to the original view after having followed a web-link in the pane.
..

:Options toolbutton: Shows a menu of rendering options as follows:
..

  :Whole tree: Check this to render the whole tree rather than the node.
  :Verbose logging: Provide more verbose logging of the rendering process.
  :Auto-update: Check to automatically rerender when changes are made.
  :Lock to node: Lock the rendered node/tree while another node is editted.
  :Show as slideshow: Show a tree as an s5 slideshow (requires s5 support files).
  :Visible code: Show the code designated by ``@language`` directives.
  :Execute code: Execute ``@language`` code blocks and show the output.  When this option is switched on, "Auto-update" is switched off automatically.  This helps to prevent unexpected execution of node code when navigating the outline.
  :Code output reST: Assume code execution text output is reStructuredText.
..

:Export button: Show this in the default web-browser.
  If the default browser is not already open it will be started.  Exporting is useful for full-screen slideshows and also for using the printing and saving functions of the browser.  Exporting leaves the file ``leo.html`` in the current ``path`` of the root node for the render.  This is what the browser renders and this can also be used to save for other purposes.

:Title: The title of the root of the node or tree being rendered is shown on the right of the toolbar so that the title node can still be identified, even if the rendered title has been scrolled out of view.


Keyboard Shortcuts
==================

:``ctl-c``:  Copy highlighted html from the pane to the clipboard
:``ctl-+``:  Zoom in
:``ctl--``:  Zoom out
:``ctl-0``:  Zoom to original size


Notebook Execution
==================

A form of "Notebook" functionality can be achieved by setting the *code options* in the Options toolbutton menu.  A Notebook is defined here as a Leo node tree containing a combination of reST nodes and code nodes that, when rendered with Viewrendered2, shows the formatted output combination of text, code, and executed code output text.  Multiple code nodes share the same namespace during execution, so any variables or objects created in one node are available to all subsequent nodes.  However, an individual node's code-execution output appears in the correct position (node with the tree) in the rendered output.

Potential use cases are:

:Documented calculations: ("Visible code" checked, "Execute code" checked, "Code outputs reST" unchecked)
  
  Calculations are documented in formatted text, calculations are performed as part of the viewing operation ("Reload" button), the code is shown, but the output is simple text.  Charts and other images generated by the code are explicitly saved as a file and shown within the formatted text described by reST (e.g. using ``.. image::`` directives).  Code and reST nodes are distinguished by the ``@language`` directives in force at the node.  The headings of nodes containing code are shown.

:Dashboards or Reports: ("Visible code" unchecked, "Execute code" checked, "Code outputs reST" checked)

  This mode aims to have a polished rendered output by not showing any of the code, but does show its execution output.  The code is specifically designed to output reST and so has the full range of reST formatting capability.  The node headers containing the code are *NOT* shown.


Settings
========

- ``@bool vr_verbose = False``

  The initial state of "Verbose logging" on the Options toolbutton.

- ``@bool vr_auto_update = True``

  The initial state of "Auto-update" on the Options toolbutton.

- ``@bool vr_lock_node = False``

  The initial state of "Lock to node" on the Options toolbutton.

- ``@bool vr_slideshow = False``

  The initial state of "Show as slideshow" on the Options toolbutton.
  
- ``@bool vr_visible_code = True``

  The initial state of "Visible code" on the Options toolbutton.

- ``@bool vr_execute_code = False``

  The initial state of "Execute code" on the Options toolbutton.

- ``@bool vr_rest_code_output = False``

  The initial state of "Code outputs reST" on the Options toolbutton.

  
**System Settings**
  
- ``@string vr_stylesheet_path =``
  
  The complete path to the stylesheet file.  If the path is an empty string, then the docutils default stylesheet will be used.

- ``@string vr_math_output = mathjax``
  
  The docutils math rendering type in the html.  See docutils options.
  
- ``@int vr_halt_level = 6``

  The level of docutils processing error for rendering to halt.  See docutils documentation.

- ``@int vr_report_level = 5``

  The level of docutils processing error for reporting to occur.  See docutils documentation.

- ``@bool vr_smart_quotes = True``

  The level of docutils processing error for reporting to occur.  See docutils documentation.
  
- ``@bool vr_embed_stylesheet = True``

  The docutils option of whether to embed the stylesheet in the html output.
  
- ``@bool vr_xml_declaration = False``

  The docutils option of whether to include the xml declaration.  Setting to False helps compatibility with MS Office importing.  It doesn't affect the rendering in the Viewrendered2 pane.

VR2test.leo
css.zip
ui.zip

Terry Brown

unread,
Feb 28, 2014, 8:55:43 AM2/28/14
to leo-e...@googlegroups.com
viewrendered2.py contains some Python3 incompatibility

from StringIO import StringIO

exec code in scope

commenting those out allow it to load in Python3, although of course
parts will be broken.

Jake - nodediff.py has the StringIO issue in Py3 too.

Cheers -Terry

Jacob Peck

unread,
Feb 28, 2014, 9:21:14 AM2/28/14
to leo-e...@googlegroups.com
I'll look into that. Thanks for the heads up.

-->Jake
> Cheers -Terry
>

Jacob Peck

unread,
Feb 28, 2014, 9:45:36 AM2/28/14
to leo-e...@googlegroups.com
On 2/28/2014 8:55 AM, Terry Brown wrote:
> Jake - nodediff.py has the StringIO issue in Py3 too.
Fixed, I hope.

Also squashed an unrelated bug in mod_scripting that kept @plugin nodes
from working.

-->Jake

Peter Mills

unread,
Feb 28, 2014, 5:15:41 PM2/28/14
to leo-e...@googlegroups.com


On Thursday, February 27, 2014 10:18:24 PM UTC+10, Edward K. Ream wrote:
On Wed, Feb 26, 2014 at 6:00 PM, Peter Mills <peter.m...@gmail.com> wrote:
Yes, you should get a GitHub account.  Let me know when you have it set up and I'll give you write access. 

Done: pmills
(I will need to study git a bit before I do anything though)
 
Could you share the Leo outlines (and css, if relevant) used to generate your example screen shots?  I'd like to see exactly how they were created. Using the VR2 plugins is easy, but I want to make sure everyone (including me) understands how to get the most of what you have created.

Done.  Elsewhere in this thread I've posted a "manual" of sorts to help everyone test it.  A more refined version should find its way into the docstring at some time.  As you've suggested I've also posted there the VR2test.leo that I've used, along with a couple of support directories, so that everyone can see a bit more of how I use the plugin.
 

Thanks.

Edward

lewis

unread,
Mar 1, 2014, 5:54:52 AM3/1/14
to leo-e...@googlegroups.com
Hi Peter,

Viewrendered2 works for me using python 2.7.6. Nice work, it has some beautiful features.

Unfortunately still no luck running with python 3.3.5

Regards
Lewis

Edward K. Ream

unread,
Mar 1, 2014, 6:37:38 AM3/1/14
to leo-editor
​On Fri, Feb 28, 2014 at 5:19 AM, Peter Mills <peter.m...@gmail.com> wrote:

I've put a rough version of the additional manual materials below - hopefully this will help in the short term.

​Indeed it does.  Many thanks for the attachments.​
 

I've also added the example Leo outline (VR2test.leo) that I used to generate the screenshots.  Note that the @thin file included shouldn't be refreshed from disk since this won't be in your file system at this location, but I think it should still show what is intended.

​Very helpful.  In the future, I recommend changing @thin to @@thin in this kind of situation: that way Leo doesn't issue a warning about @ignore when attempting to load the file.​
 

I think there was a question about the css that I used to make the html look the way I like (it should still work fine without this css stuff though!).  I've attached css.zip, which should be unzipped and the resulting css folder placed in the same folder as VR2test.leo.  Much of this already comes from Leo, but the leo_vr.css is the main one for this.  VR2test.leo has a built-in setting to find this css file if you include this css directory as described.

Note that the text below is valid reST and if you paste it into a node, should produce a more readable version in viewrendered or viewrendered2.

​Excellent documentation.  I'll make this the VR2 docstring.

BTW, it does seem prudent to merge the VR and VR2 plugins.  For example, selecting a plugin is supposed to show its docstring with the VR plugin, but that doesn't work when VR2 is enabled.  I'll look into this soon.

Edward

Peter Mills

unread,
Mar 1, 2014, 5:24:54 PM3/1/14
to leo-e...@googlegroups.com
Thanks Edward
I think that VR2 should definitely replace VR1, even in name, as it really is an evolution of the same plugin. I would suggest that when we get the basic level of bugs fixed, that this happen, but not before? I know there is a level of confusion created by having two options, but maybe a few more bugs need sorting out before it's production ready? (Like the HTML rendering that someone just discovered).

Note that my published version of VR2 worked fine for the plugin help (scrolledMessage) - there was a specific change I needed to make for this to work. Perhaps a bug has crept in with the reorganisation. I won't have any time over the next week while travelling to make any contributions of substance so I can't look into this myself :-)

duf...@gmail.com

unread,
May 10, 2014, 5:39:04 AM5/10/14
to leo-e...@googlegroups.com

Reading this made me think: are most Leo plugins written in Python 2.x or 3.x?
I am asking because, being a newbie, I am afraid I may encounter compatibility problems like the one pointed out by Terry, without even realizing it.
Which Python version do you recommend for ensuring the least problematic user experience, 2.7 or 3.3?
Reply all
Reply to author
Forward
0 new messages