Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icon path to FreeCAD resources list #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hasecilu
Copy link
Contributor

@hasecilu hasecilu commented Nov 16, 2024

Instead of hard-coding the full path to the icon we can add the directory where icons are saved to the FreeCAD resources list with FreeCADGui.addIconPath(), so when assigning the icons to the commands there is no need to provide full path.

I noticed that your ViewProvider is still working with no changes on my computer, could you test it works after saving a file?

When I did this change on STEMFIE WB (check this commit) I needed to change the View Provider but I'm not using any dumps, loads, __getstate__, __setstate__ methods (I don't have JSON serializable errors, or at least nobody has told me), in other hand attach() method just caused me errors so I deleted it.

@looooo
Copy link
Owner

looooo commented Nov 17, 2024

Not sure if this is a good idea thinking about name-clashes. I guess if we choose to go this way we should prefix the icons with something like freecad_gears. Correct me if I am wrong.

@hasecilu hasecilu closed this Nov 17, 2024
@hasecilu hasecilu deleted the enhancement/icon_path branch November 17, 2024 14:36
@hasecilu hasecilu restored the enhancement/icon_path branch November 17, 2024 14:37
@hasecilu
Copy link
Contributor Author

I have seen some WB uses same name as the command and since the command is prefixed with WB name would not be clashes. I'll make that change.

@hasecilu hasecilu reopened this Nov 17, 2024
@looooo
Copy link
Owner

looooo commented Nov 17, 2024

What is the general advantage of doing it that way?

@hasecilu
Copy link
Contributor Author

hasecilu commented Nov 17, 2024

image

Icons were renamed the same as the commands.
@hasecilu hasecilu force-pushed the enhancement/icon_path branch from 38834ac to 7459dc0 Compare November 17, 2024 16:07
@hasecilu
Copy link
Contributor Author

Icons working:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants