On Thu, 11 Sep 2014 09:16:18 -0500 "Edward K. Ream" <[email protected]> wrote:
> On Thu, Sep 11, 2014 at 3:50 AM, Edward K. Ream <[email protected]> > wrote: > > Here are some revisions to my middle-of-the-night thoughts. > > > 1. Registering updaters is straightforward. > > True, but that's far from the entire story. Two classes must become > involved, both in leoApp.py: the LoadManager class and the > PreviousSettings class. I'm not 100% convinced we need to go down this settings update callback path. Applying the stylesheet to the top level of Leo's widget tree is too slow to do on every edit of a single setting (a Qt limitation), so the explicit invocation through Settings -> Reload Styles is fine. The callback approach could allow dynamic changing of settings for other things, but writing the myriad callbacks would be a massive task. If something really wants to see settings changes in real time it could just hook 'save2' or something. Cheers -Terry > When saving a .leo file Leo will update settings only if settings > have, in fact, been changed. This is a fairly hairy process, as the > code in leoApp.py shows. Happily, unlike as in the startup process, > all relevant @settings trees are in loaded commanders, so there is no > need to read any .leo file again. > > > The idea is to define a new @settings type, say @style:: > > > > @style <simplified-leo-selector> > > << simplified stylesheet in the body >> > > On second, this is way too elaborate, and will cause confusion. > > The simplest thing that could possibly work is:: > > @style <descriptive-comment> > < normal Qt stylesheet, w/o *leading* Python comments > > > The problem with the first approach is that it hides important > information, namely the exact Qt selector that is being affected by > the @style node! This is a pretty severe violation of the principle, > explicit is better than implicit. > > The parser for @style nodes will remove only leading Python comments > because the '#' character appears in many places in Qt style sheets. > > In the new scheme, our example becomes:: > > @style headlines in edit mode > > # A comment explaining what the QTreeWidget QLineEdit selector > means # Discussions of typical values, with links to Qt docs. > > QTreeWidget QLineEdit { > background-color: pink; > # I also tried red and salmon > selection-color: white; > selection-background-color: blue; > } > > As you can see, using Python comments helps a lot. > > To repeat, this is the simplest thing that could possibly work, and > imo it suffices. > > 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 http://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
