[MERGED] Some shortcuts should be verified

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
Shalmeneser
Veteran
Posts: 9443
Joined: Wed Dec 23, 2020 12:04 am
Location: Fr

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by Shalmeneser »

Do not play me escape game.
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by chrisb »

:lol:
Shalmeneser wrote: Fri Oct 15, 2021 7:18 pm Do not play me escape game.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by abdullah »

I have been reflecting and the usage argument for horizontal and vertical datums I find compelling due to its high usage. So "I" will be vertical distance constraint, and "L" will be horizontal distance constraint (see M4X post, due to the "similarity", though the "L" does have a vertical and a horizontal segments, but one can remember that the I only has one...)

The currently selected radius tool will be assigned "R". This does not interfere with those who want to use a specific radius/diameter/smart tool for a specific situation, but it enables a normal user to select once the flavour he wants to use and then trigger that with "R".

I will be committing this today. Any feedback or change request is welcome.

EDIT: And I invite you to start using the keyboard shortcuts. It is important for your health. I only used some, but now I will be starting to use many of them :D
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by abdullah »

git commit 0926a4148bcff11249fd4f56bc30256102ffe105
chrisb
Veteran
Posts: 53786
Joined: Tue Mar 17, 2015 9:14 am

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by chrisb »

abdullah wrote: Sat Oct 16, 2021 7:26 am git commit 0926a4148bcff11249fd4f56bc30256102ffe105
Just in time for the next weekly. Thanks!
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by abdullah »

chrisb wrote: Sat Oct 16, 2021 7:57 am Just in time for the next weekly. Thanks!
Welcome! :D :D :D
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by chennes »

Very nice! This makes me notice a peripheral bug, however -- the tools that have option drop-downs don't list the keyboard shortcuts in their tooltip (e.g. circle, rectangle, b-spline). Presumably this has to do with how the Command is being created, or maybe just an oversight in the new tooltip-generation code.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by abdullah »

chennes wrote: Sat Oct 16, 2021 5:07 pm Very nice! This makes me notice a peripheral bug, however -- the tools that have option drop-downs don't list the keyboard shortcuts in their tooltip (e.g. circle, rectangle, b-spline). Presumably this has to do with how the Command is being created, or maybe just an oversight in the new tooltip-generation code.
Really nice catch!

This has to do with:
1. When a Gui::Action (or Gui::ActionGroup) is created passing as parameter one command, the shortcut of the command is not set as the shortcut of the action (which probably is intentional, I did not investigate enough).
2. Then Command has a function applyCommandData(context, pcAction), which updates the action with data from the command. This function is responsible for creating the tooltip, calling recreateTooltip(context, pcAction).
3. This recreateToolTip takes the shortcut from the action, not from the command, which in our case is empty.

The obvious fix (which generates the tooltip correctly), is to assign the shortcut to the action (see the commented out line):
Gui::Action * CmdSketcherCompConstrainRadDia::createAction(void)
{
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
pcAction->setDropDownMenu(true);
//pcAction->setShortcut(QString::fromLatin1(this->getAccel()));
applyCommandData(this->className(), pcAction);
However, this might not be the right way.

If this was generally intended, I would have expected that the constructors of Gui::Action or Gui::ActionGroup would take this into account and assign the shortcut directly. It could be that this was not seen when coding it, or that there is some interference that was being avoided by not assigning it.

If the latter, what is shown above as code would also cause the same "interference".

It is a matter needing some further investigation. I do not know if you feel like taking a look...
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by chennes »

abdullah wrote: Sat Oct 16, 2021 6:22 pm It is a matter needing some further investigation. I do not know if you feel like taking a look...
I am happy to do so, I think I'm the one who merged the "recreateTooltip" PR, so I've recently reviewed that code: however, I am in the middle of a large change to Addon Manager, so if may be a week or two before I can get to it. If you (or someone else!) beat me to it I won't feel bad :D .
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
Roy_043
Veteran
Posts: 8410
Joined: Thu Dec 27, 2018 12:28 pm

Re: [IN DEVELOPMENT] Some shortcuts should be verified

Post by Roy_043 »

chennes wrote: Sat Oct 16, 2021 5:07 pm This makes me notice a peripheral bug
FWIW this was recently fixed/worked-around for the Draft WB: https://github.com/FreeCAD/FreeCAD/pull/5072.
Post Reply