FreeCAD themes
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
FreeCAD themes
What's the status of icon themes? I see that bug 2053 [1] is closed, but do we have any instruction how to modify the icons if someone want's to create a new set? I guess it's enough to create properly named icons and drop them to a correct directory? If that's the case I could create the default icon set as a template.
[1] http://freecadweb.org/tracker/view.php?id=2053
[1] http://freecadweb.org/tracker/view.php?id=2053
Re: FreeCAD themes
* Create an index.theme file. When you only provide alternative SVG files you can use the index.theme of the FreeCAD sources but change the Name field.
* Create a directory with the theme name you want to use later. Inside this directory put the index.theme file and the icons in the defined sub-directories.
* In case you have put your theme directory outside the system's search path you can run this Python snippet:
* To activate your theme:
Code: Select all
[Icon Theme]
Name=FreeCAD-default
Comment=Default FreeCAD icon theme
Inherits=Default
# Directory list
Directories=scalable
[scalable]
Size=48
MinSize=8
MaxSize=512
Type=Scalable
* In case you have put your theme directory outside the system's search path you can run this Python snippet:
Code: Select all
from PySide import QtGui
paths=QtGui.QIcon.themeSearchPaths()
paths.append(Path_of_parent_directory) # <==Here put the parent directory of the theme directory
QtGui.QIcon.setThemeSearchPaths(paths)
Code: Select all
QtGui.QIcon.setThemeName(Your_theme_name)
Re: FreeCAD themes
Thanks! I could start with coding some GUI changes to allow easy theme switching.
Re: FreeCAD themes
All works fine, except when I activate a workbench there is no way to update the icons to the new theme.
doesn't help, switching wb doesn't help. I have to solve that before I can make a theme selector. Switching theme and activating wb later works fine - icon for my custom theme is loaded as expected. Looks like it's now a new problem [1] except nothing works for me now.
[1] viewtopic.php?t=10484&start=30#p93183
Edit:
strace session shows that the icon is loaded, but it's never used (the icon n the b doesn't change):
Edit2:
After starting FreeCAD that works:
but that doesn't work:
So starting FEM wb loads icons and they are not replaced on theme switching.
Code: Select all
mw=Gui.getMainWindow()
mw.update()
[1] viewtopic.php?t=10484&start=30#p93183
Edit:
strace session shows that the icon is loaded, but it's never used (the icon n the b doesn't change):
Code: Select all
stat("/home/przemo/.FreeCAD/themes/new_theme/scalable/fem-quick-analysis.svg", {st_mode=S_IFREG|0644, st_size=19460, ...}) = 0
After starting FreeCAD that works:
Code: Select all
from PySide import QtGui
paths=QtGui.QIcon.themeSearchPaths()
paths.append("/home/przemo/.FreeCAD/themes")
QtGui.QIcon.setThemeSearchPaths(paths)
QtGui.QIcon.setThemeName("new_theme")
Gui.activateWorkbench("FemWorkbench")
Code: Select all
Gui.activateWorkbench("FemWorkbench")
Gui.activateWorkbench("ArchWorkbench")
from PySide import QtGui
paths=QtGui.QIcon.themeSearchPaths()
paths.append("/home/przemo/.FreeCAD/themes")
QtGui.QIcon.setThemeSearchPaths(paths)
QtGui.QIcon.setThemeName("new_theme")
Gui.activateWorkbench("FemWorkbench")
Re: FreeCAD themes
And moving the mouse over the icons doesn't work either? Can you be sure that it really loads another icon?
Re: FreeCAD themes
Moving cursor over icon wasn't working, but when I switched back to default theme the icons were dissapearing when I was moving the cursor. I'll have to do more step by step testing and I'll also post the theme files, so we can check it on different systems.
P.S. When we have that problem sovled could we have path to {user_directory}/.FreeCAD/Themes by default in the search path? We already have something similar for Materials. I think that directory is called user settings drectory? That would allow very easy theme installation, possibly even from FreeCAD GUI.
P.S. When we have that problem sovled could we have path to {user_directory}/.FreeCAD/Themes by default in the search path? We already have something similar for Materials. I think that directory is called user settings drectory? That would allow very easy theme installation, possibly even from FreeCAD GUI.
Re: FreeCAD themes
Yes, we can think about a user-defined directory. But on Linux platforms isn't there already such a directory like $HOME/.icons or so?When we have that problem sovled could we have path to {user_directory}/.FreeCAD/Themes
Re: FreeCAD themes
Yes, there is, but I'm trying to be good and think about win/mac users and .FreeCAD/Themes seems to be the best cross-platform location.
Re: FreeCAD themes
The .icons folder is a freedesktop.org specification, that Qt (and also GTK) follow (you can place icon themes either in /usr/share/icons or in /home/$USER/.icons). Probably there is an "official" way for Qt to use different icon themes on mac and windows too...
Re: FreeCAD themes
OK, so it should work on windows as well?