Grubuntu / PieMenu

Fork of PieMenu, with some improvements
8 stars 4 forks source link

[Feature request] Subpies! #4

Closed pgilfernandez closed 2 months ago

pgilfernandez commented 7 months ago

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!

Grubuntu commented 7 months ago

I understand what you want. It requires menu nesting. Something to think about

Grubuntu commented 7 months ago

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 appui

Set the shortcut corresponding to the PieMenu you want to open with the macro appui2

"et voilà "

short

pgilfernandez commented 7 months ago

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!

Grubuntu commented 7 months ago
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.

pgilfernandez commented 7 months ago

Awesome again! Thanks!!

Grubuntu commented 4 months ago

Hi @pgilfernandez

Next dev version160 include SubPies: you can try it : https://github.com/Grubuntu/PieMenu/tree/next-release160

Capture d’écran (182)

Capture d’écran (183)

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...

Capture d’écran (184)

it's a draft, there are still a few things to finalise and test...

Grubuntu commented 2 months ago

Fix in version 1.6