IconThemes

Need help, or want to share a macro? Post here!
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Tue Feb 12, 2019 8:41 pm

I prepared a PR to be included in FreeCAD 0.18.

https://github.com/FreeCAD/FreeCAD/pull/1967

I went over the workbenches and enabled missing icon themes support for commands on toolbars, not including Draft Snap toolbar for now, and for Constraints and Elements sections in Sketcher Tasks panel. This should make FreeCAD 0.18 rather (end user) usable, when it comes to the next version of IconThemes module for FreeCAD. Pursuing good icon themes support in other areas will happen in FreeCAD 0.19 development cycle.
ConstraintsElements.png
ConstraintsElements.png (16.42 KiB) Viewed 1945 times
User avatar
yorik
Site Admin
Posts: 12035
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels, Belgium
Contact:

Re: IconThemes

Postby yorik » Wed Feb 13, 2019 12:53 pm

Great! Yeah, ultimately all icons need to become themable. I think we still need a python version of that bitmapfactory function that checks for theme icons?
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Sun Feb 17, 2019 11:24 pm

yorik wrote:
Wed Feb 13, 2019 12:53 pm
I think we still need a python version of that bitmapfactory function that checks for theme icons?
Not sure about that, using the standard approach should likely do:
DraftTrayAndSnap.png
DraftTrayAndSnap.png (17.75 KiB) Viewed 1880 times
I added support for Draft Snap and Tray toolbars in such way:

https://github.com/FreeCAD/FreeCAD/pull/1977

Basically with this PR icon theme can now be applied for all commands located on toolbars in FreeCAD 0.18.
Yeah, ultimately all icons need to become themable.
On my local branch indeed there are still some QIcons left, viewprovider icons, some Tasks panel related icons, macro dialog related ones ... Some of this areas will require small code adjustments. Therefore if FreeCAD 0.18 release is imminent, i guess best to target all that for FreeCAD 0.19.

P.S. And yeah, now some icons from Simple icon theme are missing. ;)
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Tue Feb 19, 2019 10:05 pm

SnapThemes.png
SnapThemes.png (39.25 KiB) Viewed 1819 times
https://forum.freecadweb.org/viewtopic. ... 20#p287840
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Fri Mar 08, 2019 10:32 pm

Ingredients of a typical FreeCAD icon pack (all files located in a single folder):
  • Icons preferably in the SVG format (view-top.svg)
  • index.theme file
  • .qrc file
The contents of an index.theme file:

Code: Select all

[Icon Theme]
Name=Demo
Comment=Demo icon theme pack
Inherits=FreeCAD-default
Directories=scalable

[scalable]
Size=64
Type=Scalable
MinSize=1
MaxSize=256
The contents of a .qrc file:

Code: Select all

<!DOCTYPE RCC><RCC version="1.0">
    <qresource prefix="/icons/Demo">
        <file>index.theme</file>
    </qresource>
    <qresource prefix="/icons/Demo/scalable">
        <file>view-top.svg</file>
    </qresource>
</RCC>
Resource compiler (rcc tool) is used to create an external binary resource data file, for use as a dynamic resource. On Linux:

Code: Select all

/usr/bin/rcc --binary demo.qrc -o demo.rcc
If newer version of rcc tool is used and to preserve support for Qt4 and older Qt5 versions (likely versions below Qt 5.9). Use the --format-version option:

Code: Select all

/usr/bin/rcc --binary demo.qrc -o demo.rcc --format-version 1
P.S. For testing purposes i temporarily modified IconThemes module in a way it will look for Gui/Icons/demo.rcc file inside user application data folder. On Linux that would be ./FreeCAD/Gui/Icons folder (other platforms). On FreeCAD start, whenever the file is detected, the data will get registered and an icon pack named Demo will get set. Useful for testing the Coil icon pack:

https://forum.freecadweb.org/viewtopic.php?f=34&t=34687

P.S. Feedback on how it works cross platforms is appreciated.
Last edited by triplus on Mon May 06, 2019 9:40 pm, edited 3 times in total.
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Fri Mar 08, 2019 11:45 pm

SketcherToggleAndMenu.png
SketcherToggleAndMenu.png (36.49 KiB) Viewed 1771 times
Demo.
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Sat Mar 09, 2019 1:17 am

For testing purposes i attached a demo icon theme pack containing one icon (view top). Rename the file from demo.zip to demo.rcc, attached file is not a ZIP file.
Attachments
demo.zip
(464 Bytes) Downloaded 65 times
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Tue Mar 19, 2019 1:34 am

IconThemesNEXT.png
IconThemesNEXT.png (26.56 KiB) Viewed 1686 times
New release of icon themes module for FreeCAD is available. It supports icon packs provided from internal/external binary resource files. For now, until existing icon packs migrate, i left the previous icon themes functionality intact (Accessories -> Icon themes legacy).
efyx
Posts: 280
Joined: Fri Sep 26, 2014 7:36 pm

Re: IconThemes

Postby efyx » Tue Mar 19, 2019 8:53 am

triplus wrote:
Tue Mar 19, 2019 1:34 am
Icon themes addon destroyed FreeCAD, I cannot run it (FreeCAD) - help.
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Postby triplus » Tue Mar 19, 2019 4:35 pm

First, please don't double post, and second i will need a bit more info. On what platform did the issue occur and i will assume it occurred, after you have enabled the Demo theme? If you start FreeCAD from the terminal or CMD. Any additional clues and errors provided? Does removing the demo.rcc file from the Gui/Icons folder resolve the issue?

P.S. Note that you can always manually install or remove the IconThemes module.