示例#1
0
def run_PF_APP_WindowNOMinimized(app,event):
    '''triggered from PyFlow.App'''


    pf=pfwrap.getInstance()
    for node in pfwrap.getInstance().graphManager.get().getAllNodes():
        node.kill()
    pfwrap.deleteInstance()
    del(FreeCAD.PF)
    try:
       pf.hide()
    except:
        pass

    pf=pfwrap.getInstance()
    pf.show()
    instance=pfwrap.getInstance()
    pf.graphManager.get().clear()
    pf.loadFromData(FreeCAD.savePFData)
    
    say("DONE")
示例#2
0
    def closeEvent(self, event):

        '''
        #+hack deactivate saving
        if False: # mkae this configurabel somewhere?
            shouldSave = self.shouldSave()
        else:
            shouldSave = QMessageBox.No
        #-hack end
        if shouldSave == QMessageBox.Yes:
            if not self.save():
                event.ignore()
                return
        elif shouldSave == QMessageBox.Discard:
            event.ignore()
            return
        '''

        self.tick_timer.stop()
        self.tick_timer.timeout.disconnect()
        EditorHistory().shutdown()

        self.canvasWidget.shoutDown()
        # save editor config
        settings = ConfigManager().getSettings("APP_STATE")

        # clear file each time to capture opened dock tools
        settings.clear()
        settings.sync()

        settings.beginGroup('Editor')
        settings.setValue("geometry", self.saveGeometry())
        settings.setValue("state", self.saveState())
        settings.endGroup()

        # save tools state
        settings.beginGroup('Tools')
        for tool in self._tools:
            if isinstance(tool, ShelfTool):
                settings.beginGroup("ShelfTools")
                settings.beginGroup(tool.name())
                tool.saveState(settings)
                settings.endGroup()
                settings.endGroup()
            if isinstance(tool, DockTool):
                settings.beginGroup("DockTools")
                settings.beginGroup(tool.uniqueName())
                tool.saveState(settings)
                settings.endGroup()
                settings.endGroup()
            tool.onDestroy()
        settings.endGroup()
        settings.sync()

        # remove temp directory if exists
        if os.path.exists(self.currentTempDir):
            shutil.rmtree(self.currentTempDir)

        SingletonDecorator.destroyAll()

        PyFlow.appInstance = None

        #+hack cleanup  pfwrapper
        import nodeeditor.pfwrap as pfwrap
        pfwrap.deleteInstance()
        del(FreeCAD.PF)
        #-hack end
        QMainWindow.closeEvent(self, event)
示例#3
0
 def hidePyFlow(self):
     pfwrap.deleteInstance()