Help! How do themes specify alternate expand/contract icons?

253 views
Skip to first unread message

Edward K. Ream

unread,
Jun 15, 2015, 11:21:35 AM6/15/15
to leo-e...@googlegroups.com
I'm stumped.  I've looked in the QTreeWidget docs and @data qt-gui-plugin-style-sheet, and googled related topics.

I don't understand:

1. Where alternate expand/contract icons are located, if anywhere, in the standard distro.

2. Where users can specify which expand/contract icons to use.

Imagine the typical user's confusion if I don't get it.

I am working on a scheme to use the standard @data qt-gui-plugin-style-sheet unchanged for all themes.  This project is going well, except for these issues.

Edward

Edward K. Ream

unread,
Jun 15, 2015, 12:23:26 PM6/15/15
to leo-e...@googlegroups.com, edre...@gmail.com
On Monday, June 15, 2015 at 10:21:35 AM UTC-5, Edward K. Ream wrote:
I'm stumped.  I've looked in the QTreeWidget docs and @data qt-gui-plugin-style-sheet, and googled related topics.

Ah.  I actually found the clue yesterday.  The "old" @data qt-gui-plugin-style-sheet that was to be used for themes had these selectors:


QTreeView::branch:closed:has-children{
   image: url("/home/.leo/icons/nodes-dark/closed.png");
}

QTreeView::branch:open:has-children{
   image: url("/home/.leo/icons/nodes-dark/open.png");
}

I'd like to make something like this part of the new, "fully parameterized" @data qt-gui-plugin-style-sheet node.

If that works, there is one final problem with @data qt-gui-plugin-style-sheet node. At present, the background color for both the tree arrow and the icon area is wrong: kinda orange when the tree has focus.  White/None when the body pane has focus.  The orange background bleeds through the icon, which spoils the effect.  The white background is perhaps more annoying...

EKR

Terry Brown

unread,
Jun 15, 2015, 5:54:55 PM6/15/15
to leo-e...@googlegroups.com
On Mon, 15 Jun 2015 09:23:26 -0700 (PDT)
"Edward K. Ream" <edre...@gmail.com> wrote:

> On Monday, June 15, 2015 at 10:21:35 AM UTC-5, Edward K. Ream wrote:
> >
> > I'm stumped. I've looked in the QTreeWidget docs and @data
> > qt-gui-plugin-style-sheet, and googled related topics.
>
> Ah. I actually found the clue yesterday. The "old" @data
> qt-gui-plugin-style-sheet that was to be used for themes had these
> selectors:

There's also the search path described in

leo-editor/leo/core/LeoPyRef.leo#Code-->Qt gui-->@file ../plugins/qt_gui.py-->class LeoQtGui(leoGui.LeoGui)-->LeoQtGui.Icons-->LeoQtGui.getImageImage

Cheers -Terry

Edward K. Ream

unread,
Jun 16, 2015, 9:57:05 AM6/16/15
to leo-editor
​​
On Mon, Jun 15, 2015 at 4:54 PM, 'Terry Brown' via leo-editor

There's also the search path described in

leo-editor/leo/core/LeoPyRef.leo#Code-->Qt gui-->@file ../plugins/qt_gui.py-->class LeoQtGui(leoGui.LeoGui)-->LeoQtGui.Icons-->LeoQtGui.getImageImage

​Thanks for this! I knew about this, but I hadn't understood its significance until just now.

It avoids having to compose, say, os.path.join(aBase,aPath) where aBase and aPath supposedly come from settings.​
 
​This ​
composition
​probably can't be done with the @constant machinery in ​the StyleSheetManager class.​

BTW, ssm.get_style_sheet_from_settings extends the default @data qt-plugin stylesheet with the qt-user-plugin stylesheet.  Iirc, we discussed this, and it means user stylesheet settings typically override default stylesheet settings, which is what I want, or so I say now.

My plan is to provide one or more monolithic themes, and a single mix-and-match theme that can be composed from various much smaller "parts" (settings).  The default leoSettings.leo will have the Theme tree @ignored, and ditto for the various individual themes under the main Theme tree.  To enable any theme, the user would do the following:

- Add @ignore to a Non-Themed settings node.
- Remove the @ignore from the main Theme node.
- Remove the @ignore from exactly one node under the main Theme node.

I hope to have a working example soon.

The big advantage of this approach is that almost everything happens in the standard, fully-parameterized, @data qt-gui-plugin-style-sheet node.  That is, the node doesn't change, only the corresponding @constants.

There will be no need for developers, or anyone else, to run scripts that create themes.  Settings will do everything. However, some themes will have to add a few lines to @data qt-gui-user-plugin-style-sheet.

​That's all for now.  I'll say more when things settle down.

EKR​
Reply all
Reply to author
Forward
0 new messages