def transparentOnold(self, index): buttext = self.btns[index].text() initialTransparencyState = a2plib.isTransparencyEnabled() if 'On' in buttext: initialTransparencyState = a2plib.isTransparencyEnabled() if not initialTransparencyState: a2plib.setTransparency() self.btns[index].setText('Transparent Off') if 'Off' in buttext: self.btns[index].setText('Transparent On') a2plib.restoreTransparency()
def clearSelection(self, doc): if self.ignoreClear: self.ignoreClear = False else: if a2plib.isTransparencyEnabled(): a2plib.restoreTransparency() FreeCADGui.Selection.removeObserver(self)
def Activated(self, checked): if FreeCAD.activeDocument() == None: QtGui.QMessageBox.information( QtGui.QApplication.activeWindow(), "No active document found!", "You have to open an assembly file first.") return if a2plib.isTransparencyEnabled(): a2plib.restoreTransparency() else: a2plib.setTransparency()
def Activated(self): doc = FreeCAD.ActiveDocument selected = a2plib.getSelectedConstraint() if selected is None: return if not a2plib.isTransparencyEnabled(): a2plib.setTransparency() FreeCADGui.Selection.clearSelection() FreeCADGui.Selection.addSelection( doc.getObject(selected.Object1), selected.SubElement1) FreeCADGui.Selection.addSelection( doc.getObject(selected.Object2), selected.SubElement2) # Add observer to remove the transparency when the selection is changing or removing FreeCADGui.Selection.addObserver(ViewConnectionsObserver())
def IsChecked(self): return a2plib.isTransparencyEnabled()
def Activated(self, checked): if a2plib.isTransparencyEnabled(): a2plib.restoreTransparency() else: a2plib.setTransparency()
def IsActive(self): return (a2plib.getSelectedConstraint() is not None and a2plib.isTransparencyEnabled() == False)