Closed pgilfernandez closed 2 months ago
I understand what you want. It requires menu nesting. Something to think about
Fun workaround until I have time to code this. You create a macro that contains:
from PySide import QtGui, QtCore
def simulate_key_press():
key_event = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_W, QtCore.Qt.NoModifier)
QtGui.QApplication.postEvent(FreeCADGui.getMainWindow(), key_event)
simulate_key_press()
it simulate the press on the key W here.
Add this macro to a toolbar via Custom toolbar in Freecad and you can finally add this macro in a PieMenu
Set the shortcut corresponding to the PieMenu you want to open with the macro
"et voilà "
Yes!!
Awesome, I also thought about this workaround but I didn't know how to code the macro... thanks for sharing it!
I already have it working and I'm gonna use it everyday =D
One question: in the script, how could I make it to run if double keystrokes are pressed? For instance, if I have a pie with a "Q,Q" shortcut.
Thanks!
from PySide import QtGui, QtCore
def simulate_key_press():
# Create a key press event for the "Q" key
key_event_q1 = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Q, QtCore.Qt.NoModifier)
# Create a second key press event for the "Q" key
key_event_q2 = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Q, QtCore.Qt.NoModifier)
# Send the events to the FreeCAD application
QtGui.QApplication.postEvent(FreeCADGui.getMainWindow(), key_event_q1)
QtGui.QApplication.postEvent(FreeCADGui.getMainWindow(), key_event_q2)
# Call the function to simulate pressing the "Q" key twice
simulate_key_press()
You're welcome.
Awesome again! Thanks!!
Hi @pgilfernandez
Next dev version160 include SubPies: you can try it : https://github.com/Grubuntu/PieMenu/tree/next-release160
The PieMenus are now visible in the tools list and can be add to PieMenu. (You can search them with key word : 'Piemenu') Icon can be set for each PieMenu (Freecad restart is needed for update the appearance of the icon in the tools list, I couldn't find a way to update a custom command icon without restarting FreeCAD...
it's a draft, there are still a few things to finalise and test...
Fix in version 1.6
Hi,
I don't know how hard would be this feature to code, but it would be cool to see it implemented: a pie command that opens another pie, this way you could have a master pie that runs normal commands or "expand" more commands by running a "folder" command that links to the other pie... did I explained myself correctly?
Thanks!