IconThemes

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Post by triplus »

Will test on Manjaro Linux in the following days.

P.S. That visual glitch is unrelated (Py3/Qt5). I am aware of it and it will get fixed at some point in the future.
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Post by triplus »

Hi @Kunda1

A had some spare time and decided to make a quick test now. Based on your provided data i used the same setup. Manjaro Linux XFCE Edition and latest FreeCAD 0.19 AppImage. The instructions worked on my side, without any issues detected:

https://forum.freecadweb.org/viewtopic. ... 60#p338771
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: IconThemes

Post by Kunda1 »

triplus wrote: Sun Oct 06, 2019 7:34 pm A had some spare time and decided to make a quick test now. Based on your provided data i used the same setup. Manjaro Linux XFCE Edition and latest FreeCAD 0.19 AppImage. The instructions worked on my side, without any issues detected:

https://forum.freecadweb.org/viewtopic. ... 60#p338771
Hi @triplus, so I figured out what the problem was. I used wget to pull the .rcc file from github and pulled the .html page instead of the raw file.
The icons work, but I still see the python syntax in the dialog like so (I tried to look at the code and debug where this is getting added:
icon-themes-broken-UI-updated.png
icon-themes-broken-UI-updated.png (16.67 KiB) Viewed 2285 times
Not sure but it may be happening in the code somewhere in https://github.com/triplus/IconThemes/b ... py#L54-L82
or
https://github.com/triplus/IconThemes/b ... #L114-L120

Anyway, is there any way that you can get the .rcc file from https://github.com/formjune/1D_SVG_Tool ... Icon%20Set in to the IconTheme repo ? maybe as a submodule ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Post by triplus »

Based on started discussion and based on my past involvement and experience, working in this area, here is the plan, regarding maturing FreeCAD icon themes support, and finishing the planned work from my side:

1.) An icon themes oriented repository, named FreeCAD-icons (https://github.com/FreeCAD), paired with Travis CI.
2.) Support, for installing icon theme packs, from the above repository, will be added to the addons manager
3.) Code and upstream accessories menu module
4.) Prepare and upstream icon themes module
5.) Further progress icon themes support in FreeCAD
6.) Documentation
User avatar
st_phan
Posts: 48
Joined: Sun May 17, 2020 10:24 am
Contact:

Re: IconThemes

Post by st_phan »

Hey triplus,
that's awesome work! 8-)

I found your instructions on how to compile the rcc files and how to structure them:
https://forum.freecadweb.org/viewtopic. ... 01#p292101

What I haven't really understood yet is how to name the individual icons:
I saw that e.g. one file is called "Std_ViewAxo.svg" with I guess refers to "Std_ViewAxo" in the code.
But I haven't found anything in the code or the repo where the naming comes from (I was expecting some kind of lookup table or some naming scheme).

Could you help me out? (I'd love to try the icons I am working on inside the application)
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Post by triplus »

Hi @st_phan

Yes, that is basically the idea of the above 6 points. You, as a designer, should be able to look in a repository, such as FreeCAD-icons, containing a few well maintained FreeCAD icon themes, read a bit of documentation, and after being able to achieve that for yourself in a rather effortless way.
st_phan wrote: Sat May 23, 2020 2:20 pm But I haven't found anything in the code or the repo where the naming comes from (I was expecting some kind of lookup table or some naming scheme).

Could you help me out? (I'd love to try the icons I am working on inside the application)
First thing you need to do is to successfully complete the compiling tutorial. Have you managed to do that? If yes, now you need to add more icon files to the Demo folder and a corresponding file name lines to demo.qrc file.

Code: Select all

         <file>new-file.svg</file>
For now, the easiest way to get the icon names is to look in the FreeCAD source for .svg files. I would recommend for you to clone or download the source code:

https://github.com/FreeCAD/FreeCAD

And search for .svg files in for example a file manager. There are a few specifics, like some icon files need to be added to a sub-folder. But don't worry about that for now.
User avatar
st_phan
Posts: 48
Joined: Sun May 17, 2020 10:24 am
Contact:

Re: IconThemes

Post by st_phan »

triplus wrote: Sat May 23, 2020 4:03 pm Yes, that is basically the idea of the above 6 points. You, as a designer, should be able to look in a repository, such as FreeCAD-icons, containing a few well maintained FreeCAD icon themes, read a bit of documentation, and after being able to achieve that for yourself in a rather effortless way.
That sounds like a great plan 8-)
I have done a fair bit of programming in my past, but I know many designers out there have never touched git, programming or the commandline ...



It took me quite some time to find out how to get the rcc binary (QT's documentation was not really helpful on that),
but once that was done and a few wrong exports later:

Screenshot 2020-05-24 at 15.26.41.png
Screenshot 2020-05-24 at 15.26.41.png (159.58 KiB) Viewed 1947 times

Only a few icons for testing, but still a success! 8-)
It's really cool to have your theme manager for this kind of work :)


Do you mind if I send a PR your way regarding some adjustments to the readme in your repo?
I noted some things down (especially the things you mentioned in this thread and some struggles I had now) and it would be cool to have those infos in the repo.
User avatar
st_phan
Posts: 48
Joined: Sun May 17, 2020 10:24 am
Contact:

Re: IconThemes

Post by st_phan »

It makes testing icons and swapping them out really fast :)

freeCad icons.png
freeCad icons.png (285.34 KiB) Viewed 1932 times
User avatar
st_phan
Posts: 48
Joined: Sun May 17, 2020 10:24 am
Contact:

Re: IconThemes

Post by st_phan »

Wow, it even works with the icons for the workbenches! Reaaaalllyyyyy nice :)

test parts.png
test parts.png (200.37 KiB) Viewed 1924 times

Sorry for spamming this thread, but I am really excited how well it works :D

FYI:
I also wrote a short script in NodeJS, so I don't have to write the .qrc file manually:

Code: Select all

const fs = require('fs');
const path = require('path')

const selectedPath = './';
const themeFileName = '_index.theme';
const exportFileName = '_contents.qrc';

let content = '';
content += '<!DOCTYPE RCC><RCC version="1.0">\n'
content += '    <qresource prefix="/icons/Demo">\n'
content += '        <file>' + themeFileName + '</file>\n'
content += '    </qresource>\n'
content += '    <qresource prefix="/icons/Demo/scalable">\n'

fs.readdir(selectedPath, (err, files) => {
    files.forEach(file => {
        const extension = path.extname(file);
        if (extension === '.svg') {
            content += '        <file>' + file + '</file>\n'
        }
    });

    content += '    </qresource>\n'
    content += '</RCC>\n'
    console.log(content);

    fs.writeFileSync(exportFileName, content);
});
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: IconThemes

Post by triplus »

Hi @st_phan

Good to see you figured it out. As for the documentation. It would be really great if you would help out with that. ATM i am not sure, on where it makes the most sense, to start writing it. Therefore just use whatever suits you the most. Ultimately i guess FreeCAD Wiki and/or FreeCAD icon themes repository will hold such documentation. Note that i have just created the FreeCAD icon themes repository:

https://github.com/FreeCAD/FreeCAD-icons

You can go ahead and add a couple of icons with a PR. Basically i need some icons, to sort out the Travis CI side of things.
pablogil wrote:
1D_Inc wrote:
If desired on your side a pull request for Simple and COIL icon themes would be great. Basically each icon theme (variant) should have icons in a separate folder, i can sort out the rest.
Post Reply