On Thu, 11 Sep 2014 01:50:25 -0700 (PDT)
"Edward K. Ream" <[email protected]> wrote:
> ===== 2. Simplifying Qt style sheets.
>
> In the last thread, Terry said the following:
>
> QQQ
> I think we can shoot for the best of both worlds here. The template
> system can provide a tree of simple Leo settings for all the simple
> design elements (colors, fonts, font sizes, border widths, etc.) If
> you want a gradient fill that changes when you hover over a widget,
> *then* you'd need to hack the stylesheet yourself, but for the core
> stuff, a simple user editable tree (Leo outline) of settings should
> be possible.
> QQQ
>
> If I understand Terry's general idea, it is that we can break the
> daunting task of creating Qt stylesheets into simpler pieces, which
> then either get composed into a single stylesheet or get passed
> individually to particular widgets.
My idea is that users not need to touch Qt stylesheet syntax at all,
just edit simple settings, in the Leo @settings sense, along the lines
of what already happens in the dark theme and to some degree I can't
remember in the default theme. So there are settings like this:
Settings for theme
colors
@color text-foreground = @solarized-base0
@color text-background = @solarized-base03
fonts
@string font-family = Droid Sans Mono, DejaVu Sans Mono
@string font-size-body = 20px
This is an abbreviated copy paste from the current dark theme outline.
There should be a hierarchical menu under the Settings menu to jump
people to the right place in this tree, not that it's hard to
navigate. You can use "pink" and "#2342fe" as color names in place of
the @solarized-base0 defined elsewhere, too.
That's all the user has to deal with. Note there're also "font-picker"
and "color-picker" buttons so you can pick the values for those things
interactively. No stylesheet knowledge / editing involved.
The template mechanism recompiles(*) and re-applies the stylesheet using
the values above every time you select "Reload Styles" from the
Settings menu (as long as you're viewing a settings file, typically
mySettings.leo. Restarting Leo not needed.
The above is the entirety of what I think the average user needs to
deal with. The missing part, the hierarchical menu under the Settings
menu, is non-trivial because it needs to handle copying material from
leoSettings.leo to myLeoSettings.leo, although now I think about it I
was worried about making that copy selective enough, but for styling
simply copying all the style settings is probably not a problem.
End of user level info.
(*) I realize the "recompile" and re-apply part is brushing a lot of
detail devs. need to know under the carpet - also people who want to
edit stylesheets themselves.
Settings -> Reload Styles does the following:
1 search the outline for "themes", select the last one in outline
order if more than one's found.
2 "compile" a new `@data qt-gui-plugin-style-sheet` node from an
outline of stylesheet fragments, disabling the previous version
with @@data.
3 if no theme with an outline of stylesheet fragments was found,
just use the last `@data qt-gui-plugin-style-sheet` found
4 generate a version of `@data qt-gui-plugin-style-sheet` with
all the @setting-name tokens substituted for actual values. E.g.
'@text-foreground' becomes 'pink', with multiple iterations of
substitution if necessary, e.g. @text-foreground ->
@theme-bright -> @solarized-base0 -> #ed56a0
Note that this substituted version isn't stored in the outline
anywhere, it's just used for calls to .setStylesheet(). Also the
interactive text size zooming uses this step.
5 apply the new stylesheet.
Strictly speaking steps 1 and 2 aren't needed when you're just editing
the @settings and not the stylesheet, but they don't cost much. I
guess the newly compiled stylesheet could be checked against the old,
currently there's an embedded generation time timestamp that ensures
they always change, but that could be added after the check - minor
details.
The point of steps 1 and 2 is that it's non-Leonine to have the whole
stylesheet as one monolithic piece of text, it needs breaking up into
an outline for easier editing. Concatenating it back together is the
trivial "recompile" step.
Cheers -Terry
--
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 http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.