Leo Themes with VR3

35 views
Skip to first unread message

Thomas Passin

unread,
Nov 4, 2020, 5:26:18 PM11/4/20
to leo-editor
It has been pointed out that VR3 does not pick up dark Leo themes, like the current default EKRDark.  Viewrendered, on the other hand, does.  I've been looking at addressing this, and could use some help on a few things.

First of all, I haven't been able to see how the Leo theme gets applied to VR.  So far as I can see, VR emits html that has no css styling at all; presumably the pane somehow uses the theme's style sheet.  But when I disable the normal stylesheet in VR3, the dark theme is not applied.  You can see that it is applied to the overall pane itself (for example the toolbar, which is a QT Widget), but as the browser first paints you can see the background change from the theme's dark to the usual light background.  Yet the code for loading and displaying the browser in the pane is basically identical between the two plugins.

Somewhere I'm overlooking a difference.  If anyone can help with this, I'd much appreciate it.

Second, even if the theme were to be applied, VR3 colorizes code blocks using pygments.  One would have to programmatically switch css style sheets for pygments to be something compatible with a dark theme.  There are dark pygmentize themes out there, though I don't know if they cover all the languages that VR3 can render.  Probably they do but it needs checking. 

With this route, VR3 could have a dark theme and a light theme, but it couldn't adjust to an arbitrary user-supplied Leo theme.  I'm thinking that this would be acceptable.  I'd like some guidance here -  am I on track with this way of thinking?

Tom

Viktor Ransmayr

unread,
Nov 6, 2020, 2:50:38 PM11/6/20
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Mittwoch, 4. November 2020 um 23:26:18 UTC+1:
It has been pointed out that VR3 does not pick up dark Leo themes, like the current default EKRDark.  Viewrendered, on the other hand, does.  I've been looking at addressing this, and could use some help on a few things.

First of all, I haven't been able to see how the Leo theme gets applied to VR.  So far as I can see, VR emits html that has no css styling at all; presumably the pane somehow uses the theme's style sheet.  But when I disable the normal stylesheet in VR3, the dark theme is not applied.  You can see that it is applied to the overall pane itself (for example the toolbar, which is a QT Widget), but as the browser first paints you can see the background change from the theme's dark to the usual light background.  Yet the code for loading and displaying the browser in the pane is basically identical between the two plugins.

Somewhere I'm overlooking a difference.  If anyone can help with this, I'd much appreciate it.

 Disclaimer: I have not done any check at the source code level of both plugins.

However, I'd like to make you aware of an error message from the log-pane, when executing the 'rst3' command, which as far as I understand it, does require 'some' rendering (?VR plugin?) capabilities:

###

Leo Log Window
Leo 6.2.1 final
Python 3.8.6, PyQt version 5.15.0
linux
setting leoID from os.getenv('USER'): 'user'
current dir: /home/user/PyVE/PyPI/Leo-stable
load dir: /home/user/PyVE/PyPI/Leo-stable/lib64/python3.8/site-packages/leo/core
global config dir: /home/user/PyVE/PyPI/Leo-stable/lib64/python3.8/site-packages/leo/config
home dir: /home/user
reading settings in /home/user/PyVE/PyPI/Leo-stable/lib64/python3.8/site-packages/leo/config/leoSettings.leo
reading settings in /home/user/.leo/myLeoSettings.leo
reading settings in /home/user/Documents/SL2020.leo
read outline in 0.29 seconds

wrote recent file: /home/user/.leo/.leoRecentFiles.txt
 saved: SL2020.leo
wrote: /home/user/Documents/SL/2020/11/CW45/LE-2020-11-06.html.txt
stylesheet not found <- !!!
 /home/user/Documents/default.css <- !!!

@path: /home/user/Documents
open path: /home/user/Documents
wrote: /home/user/Documents/SL/2020/11/CW45/LE-2020-11-06.html
rst3: 1 files in 0.05 sec.

###

I've tried to attempt to disable any renderer, i.e. the 'VR' as well as the 'VR3' plugin in the 'myLeoSettings' file.

The result was somewhat surprising (at least to me) in that the menu / user action 'Help > Open help Topics > Help' continues to work.

My current working theory is that as a user I can't disable **each & every** plugins.

That is, there's still a set of '?mandatory core?' plugins, which Leo keeps active at all time.

That's all that I can provide as a response from my side for now.

With kind regards,

Viktor

Thomas Passin

unread,
Nov 6, 2020, 3:44:31 PM11/6/20
to leo-editor
That's not a message from VR3.  The stylesheets for VR3 are contained in the leo/plugins/viewrendered3 directory.  You can override that by the setting @string vr3-rst-stylesheet, or vr3-md-stylesheet for Markdown,  so you could check to see if that setting exists in your myLeoSettings.leo file.  I have not checked the VR source code to see what css stylesheet it normally uses.

As for disabling the VR plugin, if I understand correctly, Edward has arranged that it gets loaded even if not listed in @enabled-plugins so that it will be available to display help and plugin information.  If VR3 has been loaded, it will be used instead used.

However, I noticed just now that if I remove VR and VR3 from the enabled list, and VR still pops up to display plugin info, that my key binding to it doesn't work. (it also popped up as a freestanding window, not what one really wants in most cases).
Reply all
Reply to author
Forward
0 new messages