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

Toggle Grid button should be a toggle button that reflects the visibility status of the grid #13527

Open
2 tasks done
furgo16 opened this issue Apr 18, 2024 · 4 comments · May be fixed by #13972
Open
2 tasks done

Toggle Grid button should be a toggle button that reflects the visibility status of the grid #13527

furgo16 opened this issue Apr 18, 2024 · 4 comments · May be fixed by #13972
Labels
Feature FR for improvements or new features UI/UX WB Draft Related to the Draft Workbench

Comments

@furgo16
Copy link
Contributor

furgo16 commented Apr 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

When using the Draft workbench, the Toggle Grid toolbar button (Draft_ToggleGrid) is a generic click button that toggles the visibility of the grid on or off. However, it does not offer any indication of the grid's status.

  1. A usability improvement would be for the button to be an actual toggle switch with two stable states: raised (grid off) or depressed (grid on). This would address the issue that when the grid is not in view it's not easy to find it. It usually requires zooming out and repeatedly toggling the button until the grid is shown in view.

    This would be similar to the toggle buttons for the snapping functions, shown here next to the Toggle Grid button:
    Captura de pantalla de 2024-04-18 13-55-24

  2. For completeness, the menu entry under Snapping > Toggle Grid should also show a checkmark when the grid is visible.

Full version info

OS: Ubuntu Core 22 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.22.0dev.36888 (Git) Snap 991
Build type: Release
Branch: main
Hash: d611611055695f75a39527989224d3fb1cc51a48
Python 3.10.12, Qt 5.15.10, Coin 4.0.0, Vtk 7.1.1, OCC 7.7.1
Locale: C/Default (C)
Installed mods: 
  * BIM 2021.12.0
  * Curves 0.6.29
  * ExplodedAssembly
  * BillOfMaterials 0.0.7.2
  * Ondsel-Lens 2024.3.26.01
  * Assembly4 0.50.12

Subproject(s) affected?

Draft

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@maxwxyz maxwxyz added WB Draft Related to the Draft Workbench UI/UX Feature FR for improvements or new features labels Apr 19, 2024
@Syres916
Copy link
Contributor

Syres916 commented May 4, 2024

@furgo16 this isn't exactly what you asked for but you can hack the colour changes to be only checked/unchecked, I personally like to be able to see all three states, On (green), Off but available (red) and unavailable (transparent).

GridOnToolbar
GridOffToolbar

With it all being Python you don't need to compile to test, see main...Syres916:FreeCAD:Draft_Grid_Observer for changes (ignore the CMakeLists.txt change). My personal stylesheet picks up the checked/unchecked for the menu icon to automatically update:

QMenu::icon:checked { /* appearance of a 'checked' icon */
    background: #469143;
    border: 2px #469143;
    position: absolute;
    border-radius: 2px;
}

QMenu::icon:unchecked { /* appearance of a 'unchecked' icon */
    background: #914343;
    border: 2px #914343;
    position: absolute;
    border-radius: 2px;
}

@furgo16
Copy link
Contributor Author

furgo16 commented May 4, 2024

@Syres916 oh, wow, thanks! Except for the colors, that was exactly what I was looking for. A few notes/questions after testing your branch, and using the Classic theme:

  1. The tooltips on the button get the same background color as the button, which is probably not intended. That is, when the button is red, the tooltip is red as well. When the button is green, the tooltip is green too.
  2. I think the color choice, whichever the color, is very personal, so I'd suggest going with defaults first. To me, having a red icon on the toolbar is having something that constantly seeks my attention, like a warning light on a car's dashboard :-)
  3. I've not tried to change the colors with a custom stylesheet, as I'm not familiar with how they work with FreeCAD. Therefore I cannot comment much on that part, other than expressing the opinion that probably the default in the code should be to set the Classic theme colors for checked/unchecked toggle button, and let the stylesheet override that if the user wants to.
  4. In which situation would the "unavailable (transparent)" be triggered?

Let me know if there is anything I can do to help if you're planning to submit a PR.

@Syres916
Copy link
Contributor

Syres916 commented May 6, 2024

@furgo16 I've updated the branch to be just enabled/disabled and checked/unchecked so any colours only come from the user's stylesheet which deals with 1, 2 and 3.

With regard to question 4, the command should not be available when the mdi area is not the editable 3D view, in other words no open project, Techdraw sheet in view etc should disable the Toggle_Grid command.

To be honest I nolonger try to get involved in PR's with regard to subjective matters the agro isn't worth it for me. You're welcome to cherry pick any of my code and submit your own solution, I think there will be some return lines need adding to my code to satisfy the maintainers and stop some Lint warnings/errors being raised.

@furgo16
Copy link
Contributor Author

furgo16 commented May 7, 2024

Thanks! I'll look into it in the next few days. Happy to submit the PR from that code, if that helps getting it merged for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature FR for improvements or new features UI/UX WB Draft Related to the Draft Workbench
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants