darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.9k stars 1.15k forks source link

Themes icons issue: no icons visible if activate new usercss setting #5176

Closed Nilvus closed 4 years ago

Nilvus commented 4 years ago

Describe the bug Icons from any theme icons are no more visible when activating the new usercss file. @elstoc: this one probably for you!

To Reproduce

  1. Go to preferences (be in darkroom before to see issue directly)
  2. Activate on of the icons themes
  3. Check modify theme with CSS tweaks below
  4. Just save it and see icons no more visible (no need to add any tweak to see the issue.

--> uncheck modify theme with CSS tweaks and see icons visible again.

Expected behavior Apply icons and see them visible if CSS personal tweaks is activate.

elstoc commented 4 years ago

This is probably caused by the fact that the icon locations are given in the css files as relative paths. I'm not sure what to do about this beyond putting full path names for the icon locations, which we would presumably have to generate at build-time.

The way the usercss tweaking works is that it first converts the entire theme to CSS and then appends the user css to the end. At this point, it know longer knows what path the css originated from, and so it won't know which path the icon locations are relative to.

Nilvus commented 4 years ago

Hmm, but all themes inherit from darktable.css. And all elegant themes are correctly applied, and they use relative paths to darktable.css. Putting full path names would cause other problems I think. But if usercss correctly applied relative paths to darktable.css, why not this couldn't be applied to icons ones? The only difference is that icons themes have path link to related themes and, for elegant themes, they also link to darktable.css.

Writing that make me made a check on themes and this issue is in reality only there for elegant themes. So that's not directly an issue from relative paths (or elegant themes would not work even without icons). darktable icons themes display icons and so it's just about a theme that relate to a theme that relate to a last theme.

So if css 2 link to css 1: all is ok. If you have css 3 link to css 2 that link to css : css 3 is not applied correctly (I precise that icons space is set when applied elegant icons themes but the icons are not visible). Hope I'm clear here.

elstoc commented 4 years ago

I think I might have a solution. Watch this space...

elstoc commented 4 years ago

To explain, the css import directives work ok when they're loading other css files because they are all loaded (as text) into an internal gtk data structure. Thereafter, gtk doesn't need to know the full css path because its contents are all stored internally. The icons are loaded only when required, using the path that's stored in that gtk data structure, and that path is relative.

Anyway, I've raised a PR that should resolve the issue.