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

Fit all and Fit selection use the same icon #13897

Open
2 tasks done
furgo16 opened this issue May 8, 2024 · 7 comments
Open
2 tasks done

Fit all and Fit selection use the same icon #13897

furgo16 opened this issue May 8, 2024 · 7 comments
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Missing: feedback If feedback is requested UI/UX

Comments

@furgo16
Copy link
Contributor

furgo16 commented May 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

Using the freecad-daily PPA, the icons for the Fit all and Fit selection toolbar commands are the same:

image

Full version info

OS: Ubuntu 22.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.37213 (Git)
Build type: Release
Branch: main
Hash: 20e7deb86a8c6c2cd2378f09f8313760933f3a5c
Python 3.10.12, Qt 5.15.3, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Installed mods: 
  * OpenTheme 2024.5.3
  * parts_library

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Syres916
Copy link
Contributor

Syres916 commented May 8, 2024

You need to add the Boolean parameter Bitmaps/Theme/ThemeSearchPaths as per https://wiki.freecad.org/Fine-tuning

@furgo16
Copy link
Contributor Author

furgo16 commented May 8, 2024

Thanks! This works around the issue for those two icons, but I'll leave it open, as I feel it's still a bug (either in packaging or on choosing the icon, or on the system icon theme). In general, I'm happy with the system theme.

It seems that at least on Linux, there are at least 3 themes that are applied depending on the FreeCAD package installed and the value of that property.

Icons Package Bitmaps/Theme/ThemeSearchPaths Theme Notes
Captura de pantalla de 2024-05-08 09-38-39
image
freecad-daily true Yaru Ubuntu's default theme
Captura de pantalla de 2024-05-08 09-37-31
image
freecad-daily false FreeCAD/Tango This is the FreeCAD icon set, which uses Tango icons. Also what it looks like on default installation with the snap package
Captura de pantalla de 2024-05-08 09-37-10
image
AppImage weekly true ? Yet another theme. Unclear where it comes from
Captura de pantalla de 2024-05-08 09-37-31
image
AppImage weekly false FreeCAD/Tango This is the FreeCAD icon set, which uses Tango icons.

@maxwxyz maxwxyz added Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD UI/UX Missing: feedback If feedback is requested labels May 8, 2024
@maxwxyz
Copy link
Collaborator

maxwxyz commented May 8, 2024

Is it something which could be solved in FreeCAD or is there no system icon to distinguish between them?

@furgo16
Copy link
Contributor Author

furgo16 commented May 8, 2024

I'm not sure how the translation FreeCAD icon => System icon works. FreeCAD does name them differently though (zoom-all and zoom-selection). I don't know whether some system icons can be overriden by FreeCAD icons when using the system theme.

: Command("Std_ViewFitSelection")
{
sGroup = "Standard-View";
sMenuText = QT_TR_NOOP("Fit selection");
sToolTipText = QT_TR_NOOP("Fits the selected content on the screen");
sWhatsThis = "Std_ViewFitSelection";
sStatusTip = QT_TR_NOOP("Fits the selected content on the screen");
sAccel = "V, S";
sPixmap = "zoom-selection";
eType = Alter3DView;
}

StdCmdViewFitAll::StdCmdViewFitAll()
: Command("Std_ViewFitAll")
{
sGroup = "Standard-View";
sMenuText = QT_TR_NOOP("Fit all");
sToolTipText = QT_TR_NOOP("Fits the whole content on the screen");
sWhatsThis = "Std_ViewFitAll";
sStatusTip = QT_TR_NOOP("Fits the whole content on the screen");
sPixmap = "zoom-all";
sAccel = "V, F";
eType = Alter3DView;
}

@krushia
Copy link

krushia commented May 9, 2024

On my system they both look the same in the appimage. The icon they resolve to is zoom-fit-best from my scheme selected in KDE. There is an actual bug here, because "zoom-selection" and "zoom-all" aren't listed in the Freedesktop Icon Naming Specification. This means an application can't be sure they will exist. See also the related Icon There Spec

I have no idea how this works on Windows. The QIcon docs are a long read.

@krushia
Copy link

krushia commented May 9, 2024

I spoke too soon. FreeCAD does have those named icons in the source,
https://github.com/FreeCAD/FreeCAD/blob/main/src/Gui/Icons/zoom-fit-best.svg
https://github.com/FreeCAD/FreeCAD/blob/main/src/Gui/Icons/zoom-all.svg
... but apparently they don't get used if Bitmaps/Theme/ThemeSearchPaths is true? In my case there is no setting defined.
Screenshot_20240508_205929

@furgo16
Copy link
Contributor Author

furgo16 commented May 9, 2024

... but apparently they don't get used if Bitmaps/Theme/ThemeSearchPaths is true? In my case there is no setting defined.

That was the same behavior on my system. Before I created the property, the two icons distributed with FreeCAD were not used, so I assume if Bitmaps/Theme/ThemeSearchPath is not defined, it defaults to 'true' => use system theme icons. As per the table.

If I understand it correctly,

  1. from https://doc.qt.io/qt-5/qicon.html#fromTheme, and at least on Linux: that method is used to fetch the system icon given a descriptive string (e.g. zoom-all).

FreeCAD/src/Gui/Command.cpp

Lines 981 to 989 in 82101ac

Action * Command::createAction()
{
Action *pcAction;
pcAction = new Action(this,getMainWindow());
applyCommandData(this->className(), pcAction);
if (sPixmap)
pcAction->setIcon(Gui::BitmapFactory().iconFromTheme(sPixmap));
return pcAction;
}

Just as an example, there are other places where that method is called

Then also from the docs:

If an icon can't be found in the current theme, then it will be searched in fallbackSearchPaths() as an unthemed icon.

  1. The Icon Naming spec defines zoom-fit-best, zoom-in, zoom-original and zoom-out. Neither of those map to the zoom-all or zoom-selection strings defined in the FreeCAD code to load those icons.

  2. Despite not being a match, zoom-fit-best is the system theme icon returned when calling iconFromTheme() for either zoom-original or zoom-out.

This would mean that his bug is about finding out why 3) is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issue or PR touches core sections (App, Gui, Base) of FreeCAD Missing: feedback If feedback is requested UI/UX
Projects
None yet
Development

No branches or pull requests

4 participants