This is an Engineering Notebook post. All but Terry may safely ignore it.
Here I'll discuss how to complete the recent theme work, and especially how to specify the
outline indicators that indicate whether a node has children and whether the node is expanded.
BackgroundFor dark themes, these are located in subfolders of the leo/Icons/nodes-dark folder--either the plusminus folder or the triangles folder.
The only way to get alternative outline indicators is by using stylesheets. For example, the following work
provided that @tree-image-closed and @tree-image-open are URL's describing the
full path to the desired indicator icons:
QTreeView::branch:open{
color: @tree-fg;
background-color: @tree-bg;
}
QTreeView::branch:closed{
color: @tree-fg;
background-color: @tree-bg;
}
QTreeView::branch:closed:has-children{
image: @tree-image-closed;
}
QTreeView::branch:open:has-children{
image: @tree-image-open;
}
For example, the following settings work on my Ubuntu machine:
@string tree-image-closed = url(<path>/leo/Icons/nodes-dark/triangles/closed.png)
@string tree-image-open = url(<path>/leo/Icons/nodes-dark/triangles/open.png)
Important: these stylesheet must be
contained in the
optional user stylesheet: @data
qt-gui-user-plugin-style-sheet. The plan is for this optional
stylesheet to be identical for all themes. They can
not be part of the main @data
qt-gui-plugin-style-sheet because missing @string tree-image-open/close settings would cause the tree indicators to disappear! The repo demonstrated that for a few minutes yesterday ;-)
LeoQtGui.getImageImage
finds tree
icons in various places. We can't use that code as it stands, but we want
something similar.
SolutionsTo recap: one way or another, in @data
qt-gui-user-plugin-style-sheet we want to
automatically turn:
QTreeView::branch:closed:has-children{
image: @tree-image-closed;
}
QTreeView::branch:open:has-children{
image: @tree-image-open;
}
into:
QTreeView::branch:closed:has-children{
image:
url(<path>/leo/Icons/nodes-dark/triangles/closed.png);
}
QTreeView::branch:open:has-children{
image:
url(<path>/leo/Icons/nodes-dark/triangles/open.png);
}
Note that there are no quotes anywhere above.
The only obvious way to do this is to special case the @tree-image-closed/open settings in ssm.expand_css_constants. It's the only place to compute g.os_path_finalize_join(g.app.loadDir,'..','Icons',...)
Hmm. It seems that stating the problem clearly has lead immediately to its solution. We shall see...
Any comments, Terry?
Edward
P.S. In some sense, special-casing these particular @settings is akin to running the old Theme-installation scripts. One of the goals of the new Theme work is to avoid anyone ever having to run such scripts.
EKR