Open evantill opened 5 years ago
First time I was in French language. I have switch to English but same problem.
Maybe the menu is not found here:
On stackoverflow I have found this question about findChild of QMenu does is not working properly
opening Freecad from the terminal I have ths error message :
Traceback (most recent call last):
File "/Users/username/Library/Preferences/FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 471, in onStart
onWorkbench()
File "/Users/username/Library/Preferences/FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 171, in onWorkbench
workbench = Gui.activeWorkbench().__class__.__name__
AssertionError: No active workbench
Moving accessoriesMenu()
before onWorkbench()
seems to work but I have no ideas if there are side effects.
What could I do next to help ?
Thanks for reporting the issue and providing verbose information. Could you please test two things:
1.) Install CommandPanel module (available in Addon manager). Start FreeCAD from the terminal to see if CommandPanel module will have the same issue, or it will start successfully. This info will likely help once i will restructure ShortCuts module (merge the manager and overlay functionality).
2.) If you add an additional line to ShortCuts_Gui.py like this:
def onStart():
"""Start shortcuts."""
start = False
try:
mw.workbenchActivated
Gui.activeWorkbench().__class__.__name__
start = True
except:
pass
if start:
timer.stop()
timer.deleteLater()
onWorkbench()
accessoriesMenu()
mw.workbenchActivated.connect(onWorkbench)
Does the ShortCuts module start successfully after? Note that to activate the Overlay currently Shift+Q and not W is set by default. I forgot to change the instruction, when i made that change.
1.) Same problem with CommandPanel:
Traceback (most recent call last):
File "/Users/username/Library/Preferences/FreeCAD/Mod/CommandPanel/CommandPanelGui.py", line 201, in onStart
onWorkbench()
File "/Users/username/Library/Preferences/FreeCAD/Mod/CommandPanel/CommandPanelGui.py", line 144, in onWorkbench
workbench = Gui.activeWorkbench().__class__.__name__
AssertionError: No active workbench
2.) the error is now on the new line
Traceback (most recent call last):
File "/Users/ericvantillard/Library/Preferences/FreeCAD/Mod/ShortCuts/ShortCuts_Gui.py", line 464, in onStart
Gui.activeWorkbench().__class__.__name__
AssertionError: No active workbench
compare with :
adding if mw.property("eventLoop"):
seems to solve the problem.
Thanks for the feedback. OK therefore i will assume all modules can have such problems on macOS. As on Qt4 builds this likely isn't an issue, therefore i won't drop support for FreeCAD 0.16 just yet. That property was added for FreeCAD 0.17+.
Will go over all modules and add the appropriate changes (will do that today or tomorrow).
OK i have checked all the modules and adapted the ones benefiting from such improved start reliability. Could you please install all the modules (Addon manager) to see if all start successfully now on your side, or if some errors are still detected when starting FreeCAD:
Thanks.
Traceback (most recent call last):
File "/Users/ericvantillard/Library/Preferences/FreeCAD/Mod/Autoload/Autoload_Gui.py", line 240, in onStart
loadWorkbenches()
File "/Users/ericvantillard/Library/Preferences/FreeCAD/Mod/Autoload/Autoload_Gui.py", line 212, in loadWorkbenches
Gui.activateWorkbench(default)
KeyError: "No such workbench 'StartWorkbench'"
but the menu is working
Thanks for the feedback. Will have more time to take a more in-depth look tomorrow.
P.S. Note that i accidentally edited your last reply. Wanted to test if such list is rearrangeable and i guess it is! Didn't really expected it would be.
Note that i just updated the Autoload module and hopefully the issue is resolved.
I have tried Autoload:
Now when testing Toolbarstyle alone, it is visible in the accesories menu.
Glass seems to work:
Yes that is how currently Glass behaves on macOS. TabBar still produces display issues?
OK therefore i guess we are down to Autoload module and missing Accessories menu. As no errors are detected i can only guess a bit. Could you please remove all other modules, mentioned in this discussion, as they could interfere with the results. After do two tests:
In the first one comment out the loadModulesFirst() like:
# loadModulesFirst()
timer = QtCore.QTimer()
timer.timeout.connect(onPreStart)
timer.start(500)
In the second test move accessoriesMenu() like this:
def onStart():
"""Start autoload."""
start = False
try:
mw.workbenchActivated
start = True
except AttributeError:
pass
if start:
timer.stop()
timer.deleteLater()
loadWorkbenches()
accessoriesMenu()
loadModulesLast()
Thanks.
TabBar seems ok
Sorry, no errors and no menu after executing the two tests for Autoload
OK, thanks for the feedback. Will look for clues again tomorrow.
Without using any modifications and after FreeCAD starts. If you switch to a different workbench first, still no Accessories menu? If you delete InitGui.py file from the Autoload module folder, start FreeCAD, and enter this in FreeCAD Python console:
import Autoload_Gui
I am guessing now Accessories menu is available?
in both case no menus and no errors
How about if you copy/paste the code in FreeCAD Python console:
https://raw.githubusercontent.com/triplus/Autoload/master/Autoload_Gui.py
In this case, no errors but no menu. But it's like the menu exits but is not displayed (findChildren return the menu)
>>> for act in toolsMenu.actions():
... print(act.text())
...
E&dit parameters ...
Save picture...
Scene inspector...
Dependency graph...
Project utility...
Measure distance
View turntable...
&Units calculator...
Cu&stomize...
&Addon manager
Accessories
toolsMenu.setVisible(True)
display the menu with the Accesories subMenu
First thanks for the feedback and in general for staying around and testing things out. I updated all the modules with a potential fix and hopefully you will be able to confirm that.
I will check maybe tomorrow
I will try one by one and update the following list:
Accessories
menu)Autoload have issues. The menu does not appear. And if the menu already exist (enabled by an other module) it will disapear if Autoload is installed.
Notes:
Accessories
menu disappear.OK therefore there is still some issue involved. If we focus on Autoload module only. Other modules not installed. Therefore on FreeCAD start there is Tools menu available but no Accessories menu item listed in it. If you enter this in Python console:
from PySide import QtGui
mw = Gui.getMainWindow()
a = mw.findChild(QtGui.QAction, "AccessoriesMenu")
a.setVisible(True)
Now Accessories menu should be made available in Tools menu? At least until you switch workbench. Or that doesn't happen and there is no error and no Accessories menu listed in Tools menu?
Second answer. No error and no accessories menu.
Maybe somthing related to native menu ?
Note: the menu in upper left corner is displayed after calling
mw.menuBar().findChild(QtGui.QMenu,"&Tools").setVisible(True)
This test will work if Autoload is not installed. If Autoload is installed it will not work anymore.
from PySide import QtGui
mw = Gui.getMainWindow()
mb = mw.menuBar()
toolsMenu = mb.findChild(QtGui.QMenu, "&Tools")
m = QtGui.QMenu("Essai")
action = m.menuAction()
action.setObjectName("EssaiMenu")
toolsMenu.addAction(action)
I tried this after reading qt-change-application-qmenubar-contents-on-mac-os-x
Thanks for the verbose feedback. I need to test again everything discussed here and i think i have a general idea on what is likely going on. Yes on macOS menu bar can behave a bit differently. Will need to think about possible solution a bit more. Will likely do that over the weekend.
Could you do one more test. If you look in the Mod folder. Likely located:
/Users/user_name/Library/Preferences/FreeCAD/Mod
Make sure you delete the Autoload folder manually. After install it again (manually or by using Addon manager) and rename the folder to zAutoload. Any changes after FreeCAD gets started?
P.S. Thanks up front and i likely won't work on this again before weekend.
Any changes after FreeCAD gets started?
No, no errors and no menu.
Note that i am still working on this. This is what is causing the issue on macOS:
https://forum.freecadweb.org/viewtopic.php?f=10&t=30340&p=288292#p287972
Will wait if any obvious solution will be provided, if not i will move Accessories menu to menubar, top level, on macOS. In FreeCAD 0.19 development cycle a different solution is planned anyway, and should enable Accessories menu to be located in Tools menu on all platforms again.
I moved the Accessories menu to the menu bar (Autoload module). Could you please remove all other modules and just install Autoload module. To test things like if the Accessories menu is made available on FreeCAD start, if it's still there on workbench change. If everything will be working fine i will port other modules after confirmation.
Note that i moved Accessories menu from tools menu to the menu bar for all modules today. Hopefully this will resolve all discussed issues on macOS.
I will make feedback when I will work again with freecad (maybe end of week). Thank you for your work.
Hi,
As explained in the README.md :
But I have no
Accessories
inTools
menu andW
key does not work either (My keyboard is an AZERTY).