Global Menu problem

A forum for research and development of the user interface of FreeCAD

Moderator: agryson

OficineRobotica
Posts: 59
Joined: Thu Feb 21, 2019 8:17 am

Global Menu problem

Postby OficineRobotica » Thu Feb 21, 2019 8:58 am

Hello to all. I'm new to this forum so please be kind if i'm wrong in following the forum rules.
My problem is with freecad 0.18 when using global menu on kubuntu 18.10. When using the global menu and not the native menu of the app , whenever one changes workbenches the workbench specific menus don't disapear and get replaced but they just get mooved in front of the file menu voice . this way the menu voices become so many that they go offscreen. It's a minor issue but on small screens the global menu is a real space saver.
This issue is present with the ppa dev version and it does not happen with the appimage version . The appimage version doesn't get recognised by the kde's global menu and uses it's native menu bar.
Please excuse my rusty english.
Image

OS: Ubuntu 18.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15860 (Git)
Build type: Release
Branch: master
Hash: 3b708c7f84b0425076b520e1d95627b20fd75fe0
Python version: 2.7.15+
Qt version: 5.11.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Attachments
Screenshot_20190221_095249_0.png
Screenshot_20190221_095249_0.png (53.49 KiB) Viewed 952 times
Screenshot_20190221_094800_1.png
Screenshot_20190221_094800_1.png (116.9 KiB) Viewed 952 times
Screenshot_20190221_094959_2.png
Screenshot_20190221_094959_2.png (59.49 KiB) Viewed 952 times
triplus
Posts: 8728
Joined: Mon Dec 12, 2011 4:45 pm

Re: Global Menu problem

Postby triplus » Thu Feb 21, 2019 12:07 pm

Hi @OficineRobotica

This could be a bug in KDE global menu implementation, or things could improve on FreeCAD side, or both. Fix used for macOS, could potentially work here too:

Code: Select all

mw = Gui.getMainWindow()
mb = mw.menuBar()
mb.clear()
If you copy/paste this code snippet in FreeCAD Python console, each time before switching the workbench. Do things improve after? If yes, i guess we could enable such fix for all platforms, but the problem is it introduces a different issue as mentioned here:

https://forum.freecadweb.org/viewtopic. ... 10#p287972

P.S. AppImage would likely need to bundle some Qt/KDE specific libraries, for providing such integration support on KDE.
OficineRobotica
Posts: 59
Joined: Thu Feb 21, 2019 8:17 am

Re: Global Menu problem

Postby OficineRobotica » Thu Feb 21, 2019 2:04 pm

Hello @triplus.

when pasting that code snipet into the console the menu gets re arenged in the right order. Get's cleared and when a new workbench is selected get's displayed corectly. I have to say that freecad is the only app that has this strange behavior interacting with kde's global menu.

Thank you for your attention. You deserve a bear.
triplus
Posts: 8728
Joined: Mon Dec 12, 2011 4:45 pm

Re: Global Menu problem

Postby triplus » Tue Feb 26, 2019 4:47 pm

OficineRobotica wrote:
Thu Feb 21, 2019 2:04 pm
Hello @triplus.

when pasting that code snipet into the console the menu gets re arenged in the right order. Get's cleared and when a new workbench is selected get's displayed corectly.
Thanks for confirming.
I have to say that freecad is the only app that has this strange behavior interacting with kde's global menu.
Yes, FreeCAD manages menu bar dynamically, on each workbench change. And that is likely what KDE global menu implementation doesn't like. Clearing menu on Linux shouldn't be that hard to achieve, but as that currently introduces other known issues:

https://forum.freecadweb.org/viewtopic. ... 30#p289330

Likely best if this gets explored again in FreeCAD 0.19 development cycle.
Thank you for your attention.
You're welcome.
OficineRobotica
Posts: 59
Joined: Thu Feb 21, 2019 8:17 am

Re: Global Menu problem

Postby OficineRobotica » Wed Feb 27, 2019 5:01 pm

Yes, FreeCAD manages menu bar dynamically, on each workbench change. And that is likely what KDE global menu implementation doesn't like. Clearing menu on Linux shouldn't be that hard to achieve, but as that currently introduces other known issues:
Unfortunately I'm not that good at scripting, but for me even a push button in the interface would do for refreshing the menu instead of bringing up the python console every time one changes workbench. That is until a more permanent solution is found. Is that even possible via python scripting? Like an add-on that only interested users install.
triplus
Posts: 8728
Joined: Mon Dec 12, 2011 4:45 pm

Re: Global Menu problem

Postby triplus » Fri Mar 01, 2019 1:31 am

You can now create a parameter under Tools -> Edit parameters ... -> BaseApp -> Preferences -> MainWindow. It should be a new Boolean item named ClearMenuBar and it should be set to true.

https://github.com/FreeCAD/FreeCAD/pull/1993
OficineRobotica
Posts: 59
Joined: Thu Feb 21, 2019 8:17 am

Re: Global Menu problem

Postby OficineRobotica » Fri Mar 01, 2019 6:03 am

This is just awesome man. Thank you. This kind of small user base affecting bug could go ahead unresolved for years when talking about a closed source application. It just happened to me that open source user support to be better that paid application one. Thank you again.
triplus
Posts: 8728
Joined: Mon Dec 12, 2011 4:45 pm

Re: Global Menu problem

Postby triplus » Sat Mar 02, 2019 4:32 pm

OficineRobotica wrote:
Fri Mar 01, 2019 6:03 am
This is just awesome man. Thank you. This kind of small user base affecting bug could go ahead unresolved for years when talking about a closed source application. It just happened to me that open source user support to be better that paid application one. Thank you again.
You're welcome.
OficineRobotica
Posts: 59
Joined: Thu Feb 21, 2019 8:17 am

Re: Global Menu problem

Postby OficineRobotica » Sun Mar 03, 2019 7:07 pm

@triplus
Sorry mate, but i guess i was too early to celebrate. Unfortunately the ppa build system was broken for a few days so i waited for a recent build to do some testing. I added the bolean value as instructed but the behavior still persists.
clearMenuBar.png
clearMenuBar.png (229.85 KiB) Viewed 488 times
I "saved to disk" and restarted freecad. I also tried to watch for terminal or python console messages for some hint but nothing get's printed there.
I also took a look at your git comit and i was just wandering(i am most certainly wrong here)

Code: Select all

    if (App::GetApplication().GetParameterGroupByPath
        ("User parameter:BaseApp/Preferences/MainWindow")->GetBool("ClearMenuBar",false)) {
        menuBar->clear();
    }



GetBool("ClearMenuBar",false)) should be GetBool("ClearMenuBar",true)) ???
I'm not a coder so be patient with me. I also tried to set the bolean value to false to see if something changes but i get the same result.

Code: Select all

mw = Gui.getMainWindow()
mb = mw.menuBar()
mb.clear()
this still works when pasted in the python console.

The last thought. Does the freecad daily ppa pulls the source from the same repository as your comit? I guess it's time to also arm my self with some patience and try to compile freecad from source .
triplus
Posts: 8728
Joined: Mon Dec 12, 2011 4:45 pm

Re: Global Menu problem

Postby triplus » Sun Mar 03, 2019 9:26 pm

OficineRobotica wrote:
Sun Mar 03, 2019 7:07 pm
GetBool("ClearMenuBar",false)) should be GetBool("ClearMenuBar",true)) ???
False is the default value if no parameter is set. By default we don't want to clear the global menu. In the future likely macOS workaround will need to be revised, and likely menubar on KDE will need to address this properly.
The last thought. Does the freecad daily ppa pulls the source from the same repository as your comit?


Looking at the image, you have version 0.18.16033 installed. Needed changes should be made available. I tested by enabling the menubar panel on stock Kubuntu 18.10 and by using FreeCAD from the daily PPA. Without the parameter set to true, the menubar inflates when switching workbenches. With the parameter set to true, that doesn't happen anymore on my side. Note that FreeCAD restart isn't needed. Hard to guess, what is different on your side. Maybe one of the other widgets on the panel is interfering. Try creating another user/guest account and log in with that account. Just add the default menubar panel and try out the procedure again.