I am writing this here, rather than in #350: themes not working as 
documented <https://github.com/leo-editor/leo-editor/issues/350>, so that 
more people will see this discussion. Anyone who wants to use themes will 
want to read the following carefully.

*Background*

I have download all final versions of Leo from 4.11 onward to 5.4. The *only 
*difference between 4.11 and all later versions is that from 5.0 onward 
there is that there is a separate *themes.leo* file in the leo/config 
folder. All themes.leo files contain separate *theme scripts *(a script, 
*not* an @button node), for each separate theme. Afaik, there has never 
been a button that creates themes.

>From September 2014 onward, Leo has had a StyleSheetManager class, accessed 
via c.styleSheetManager. All theme scripts reference 
g.expand_css_constants, but that no longer exists.  Instead, scripts should 
call c.styleSheetManager.expand_css_constants. When that is done, theme 
script create @data qt-gui-plugin-style-sheet node as advertised.

However, making that stylesheet active by calling:

    g.app.gui.frameFactory.masterFrame.setStyleSheet(
        c.styleSheetManager.expand_css_constants(nd.b))

does not (yet) produce the desired theme. It's probably no big deal, but 
the effect is unsettling. The appearance of themes.leo changes drastically, 
at least with my defaults.

*Proposed changes*

1. Replace all theme *scripts *in themes.leo by a *single *@button node at 
the top level. The user should select the desired *theme tree* before 
running the @button script (clicking the button). The @button script will 
ensure that the user has, in fact, selected a theme tree. It may be 
convenient to mark "the good parts" with @theme.

2. *Aside*: I had to change @language css to @language python in order to 
run the theme script.  No big deal, but it will be best to create an 
organizer node for the rest of the data nodes that contains nothing but 
@language css.  This reorganization may affect the theme script, but any 
required changes will be worth the cos--it's intolerable not to color text 
correctly.

2. A separate top-level @button script will copy theme data to 
myLeoSettings.leo.

*Summary*

The themes data and scripts moved from leoSettings.leo to themes.leo for 
Leo 5.0 and have remained largely (completely?) unchanged ever since.

A refactoring of Leo's code broke the scripts in themes.leo ca. September, 
2014.

An @button node in themes.leo will generate theme data. A separate @button 
node will copy theme data to myLeoSettings.leo.

Much of the confusion re #350 stems from out-of-date docs. I'll update the 
docs in leoSettings.leo, themes.leo and on Leo's web site once all the 
details become clear.

Comments, corrections and questions, please.

Edward

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to