Simple scripts can re-style the tree and body editor, over-riding the 
current theme's settings.  These changes only last until the outline is 
loaded again, but they can be very helpful when your want to tweak a theme.

Say you want to try a different font size for the tree.  Normally you would 
need to load up the theme's outline, edit it, and restart Leo.  That's 
awkward, slow, and you can't really compare before and after.

These scripts let you change any of Qt's CSS properties, not just font 
size.  Want to see what the tree would look like using Times New Roman? No 
Problem.  Italics? Sure.  First, the tree:

gui = g.app.gui
tw = gui.find_widget_by_name(c, 'treeWidget')
# Change font of both label and headline editor
style = '* {font-size: 9.5pt;}'
tw.setStyleSheet(style)

Note that you can use half-point sizes, as shown here. The particular 
properties specified here will change, leaving the others set by the theme 
untouched. You can change the property value and run the script again right 
away.

Here's the equivalent for the body editor:

gui = g.app.gui
body_editor = gui.find_widget_by_name(c,'richTextEdit')
style = '* {font-size: 9.5pt;}'
body_editor.setStyleSheet(style)

For the font family, the CSS style is

style = '* {font-family: 'Times New Roman";}'

If you know your CSS, you can change any CSS properties supported by Qt. We 
use the universal selector ("*") so we don't need to figure out the exact 
object name to use, which can sometimes be a problem.  These styles will 
only affect the object you are styling and its children. It won't affect 
any other objects.

-- 
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/af1954b7-a101-4b13-93cf-b19ad722f9ecn%40googlegroups.com.

Reply via email to