Arch: Added 'flip direction' context menu option to walls

This commit is contained in:
Yorik van Havre
2021-12-28 13:17:47 +01:00
parent f47435fa40
commit 260a40f133

View File

@@ -1711,6 +1711,23 @@ class _ViewProviderWall(ArchComponent.ViewProviderComponent):
return "Wireframe"
return ArchComponent.ViewProviderComponent.setDisplayMode(self,mode)
def setupContextMenu(self,vobj,menu):
from PySide import QtCore,QtGui
action1 = QtGui.QAction(QtGui.QIcon(":/icons/Arch_Wall_Tree.svg"),"Flip direction",menu)
QtCore.QObject.connect(action1,QtCore.SIGNAL("triggered()"),self.flipDirection)
menu.addAction(action1)
def flipDirection(self):
if hasattr(self,"Object") and self.Object:
obj = self.Object
if obj.Align == "Left":
obj.Align = "Right"
FreeCAD.ActiveDocument.recompute()
elif obj.Align == "Right":
obj.Align = "Left"
FreeCAD.ActiveDocument.recompute()
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_Wall',_CommandWall())