Python FreeCAD.GuiUp() Examples

The following are 2 code examples of FreeCAD.GuiUp(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module FreeCAD , or try the search function .
Example #1
Source File: init_gui.py    From CurvesWB with GNU Lesser General Public License v2.1 5 votes vote down vote up
def Activated(self):
        """This function is executed when the workbench is activated"""
        if App.GuiUp:
            self.isObserving = True
            self.Selection = []
            self.View_Directions = []
            Gui.Selection.addObserver(self)
        return 
Example #2
Source File: a2p_importpart.py    From A2plus with GNU Lesser General Public License v2.1 5 votes vote down vote up
def Activated(self):
        flags = QtGui.QMessageBox.StandardButton.Yes | QtGui.QMessageBox.StandardButton.No
        response = QtGui.QMessageBox.information(
            QtGui.QApplication.activeWindow(), 
            u"Migrate proxies of importedParts to recent version", 
            u"Make sure you have a backup of your files. Proceed?", 
            flags
            )
        if response == QtGui.QMessageBox.Yes:
            doc = FreeCAD.activeDocument()
            for ob in doc.Objects:
                if a2plib.isA2pPart(ob):
                    #setup proxies
                    a2p_importedPart_class.Proxy_importPart(ob)
                    if FreeCAD.GuiUp:
                        a2p_importedPart_class.ImportedPartViewProviderProxy(ob.ViewObject)
                    #delete obsolete properties
                    deleteList = []
                    tmp = ob.PropertiesList
                    for prop in tmp:
                        if prop.startswith('pi_') or prop == 'assembly2Version':
                            deleteList.append(prop)
                    for prop in deleteList:
                        ob.removeProperty(prop)
                        
        QtGui.QMessageBox.information(
            QtGui.QApplication.activeWindow(), 
            u"The proxies have been migrated.", 
            u"Please save and reopen this assembly file" 
            )