Refactor of Command/Tooltip proposal

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kuzma30
Posts: 163
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Refactor of Command/Tooltip proposal

Post by Kuzma30 »

Initial discussion is here https://github.com/FreeCAD/FreeCAD-tran ... issues/167
Small description of problem:
1. In Ukrainian if menutext and tooltip is the same string translation looks very bad. I want have ability translate menu text and tooltip separately.
2. If menutext and tooltip is a same in code adding extracomment for translators (like //: Tooltip ) don`t helps. Lupdate add this two string as one.

My proposal
1. Refactor code like this

Code: Select all

    sGroup          = QT_TR_NOOP("TechDraw");
    sMenuText       = QT_TR_NOOP("Insert Default Page");
    sToolTipText    = sMenuText;

to

Code: Select all

    sGroup          = QT_TR_NOOP("TechDraw");
    sMenuText       = QT_TR_NOOP("Insert Default Page");
    //: ToolTip
    sToolTipText    =  QT_TR_NOOP("Insert default page");
Here I set sToolTipText to separate text string, add commnent and change letter case for tooltip. I made this for TechDraw (https://github.com/Kuzma30/FreeCAD/comm ... a181786746)
We can use upper case for commnd texts and lower-case texts for tooltip.
2. In .ui files tooltip strings may be writen as <string extracomment="ToolTip">Select a Page that should be used</string>
Last edited by Kunda1 on Mon Jun 20, 2022 12:41 am, edited 1 time in total.
Reason: fixed typo in thread title
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
adrianinsaval
Veteran
Posts: 5548
Joined: Thu Apr 05, 2018 5:15 pm

Re: Refactor of Command/Tooltip propossal.

Post by adrianinsaval »

were does the menu text appear and why would it need to be different from the tooltip?
User avatar
Kuzma30
Posts: 163
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: Refactor of Command/Tooltip propossal.

Post by Kuzma30 »

It need be different because this is command and it description (tooltip)
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
adrianinsaval
Veteran
Posts: 5548
Joined: Thu Apr 05, 2018 5:15 pm

Re: Refactor of Command/Tooltip propossal.

Post by adrianinsaval »

can you give me an example in the interface?
User avatar
Kuzma30
Posts: 163
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: Refactor of Command/Tooltip proposal

Post by Kuzma30 »

There are many command/tooltip like this.
Attachments
Знімок екрана з 2022-06-20 07-34-44.png
Знімок екрана з 2022-06-20 07-34-44.png (67.05 KiB) Viewed 713 times
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
Kuzma30
Posts: 163
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: Refactor of Command/Tooltip proposal

Post by Kuzma30 »

This is a normal tooltip example. Here tooltip is description of commnad and fully describe what command do
Attachments
Знімок екрана з 2022-06-20 07-38-15.png
Знімок екрана з 2022-06-20 07-38-15.png (124.72 KiB) Viewed 709 times
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Refactor of Command/Tooltip proposal

Post by Kunda1 »

This is a really great idea!

But I imagine that the veterans will get upset about 'UI bloat'. I personally would like to see a way we can make an addon repo that is possible to add more verbose content to the tooltips such as this proposal and also adding animated gifs. Then a beginner could opt to download the auxiliary addon via the Addon Manager that will make the interface more beginner friendly.

That way it's optional for the user to opt for a verbose beginner friendly UI or a more lean and advanced user UI
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
User avatar
Kuzma30
Posts: 163
Joined: Wed Oct 24, 2018 11:50 am
Location: Ukraine

Re: Refactor of Command/Tooltip proposal

Post by Kuzma30 »

The proposal is made command and tooltip different and thus get correct translations. Tooltip with full descriptfion is just example.
RealThunder's A3 Wiki translation, join the project https://crowdin.com/project/freecad-asm3-wiki
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Refactor of Command/Tooltip proposal

Post by Kunda1 »

The question for me though Is there a way to inject this content via python (after FC is compiled) where the assets are available via addon ?
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
User avatar
onekk
Veteran
Posts: 6202
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Refactor of Command/Tooltip proposal

Post by onekk »

Kunda1 wrote: Mon Jun 20, 2022 12:23 pm The question for me though Is there a way to inject this content via python (after FC is compiled) where the assets are available via addon ?
I don't know as the interface is not very documented, even setting a "menu order" ie placing a menu item in a predefined position is difficult to obatin and not documented (I've this problem but in almost two months no solution has arisen).

In Qt it is not too difficult to override the Tooltip field, but the problem I think was that many things are hardcoded in the WB initialization, so if you switch WB every ovverride will be lost as very probably the entire menu and toolbar content will be recreated.

It is not clear if it is simply hidden or if it is recreated after having "deactivated" and "activated" the WB.

As Init could be made in some different way, probably some "coding standards" will be very handy and having them clearly documented in my opinion would another goal for a 1.0 release. (I think that TNP fix and a "decent documentation", with some UI polishing will made FC a "must have" CAD and very "competitive" even with commercial CADs, but this is clear OT).

Sorry for the long post

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply