Пример #1
0
    def closeEvent(self, event):
        self.tick_timer.stop()
        self.tick_timer.timeout.disconnect()
        self.canvasWidget.shoutDown()
        # save editor config
        settings = QtCore.QSettings(SETTINGS_PATH, QtCore.QSettings.IniFormat,
                                    self)
        # 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()
        QMainWindow.closeEvent(self, event)
Пример #2
0
 def closeEvent(self, event):
     self.tick_timer.stop()
     self.tick_timer.timeout.disconnect()
     self.G.shoutDown()
     # save editor config
     settings = QtCore.QSettings(SETTINGS_PATH, QtCore.QSettings.IniFormat, self)
     settings.beginGroup('Editor')
     settings.setValue("geometry", self.saveGeometry())
     settings.setValue("windowState", self.saveState())
     settings.endGroup()
     QMainWindow.closeEvent(self, event)