def registerPreferedSettings(self): """ Register current settings as preferd settings """ settings = QtCore.QSettings("OpenAlea", "OpenAleaLab") settings.setValue("preferedGeometry", self.saveGeometry()) settings.setValue("preferedWindowState", self.saveState())
def defaultSettings(self): """ Restore default settings (geometry and window state) """ settings = QtCore.QSettings("OpenAlea", "OpenAleaLab") self.restoreGeometry(settings.value("defaultGeometry")) self.restoreState(settings.value("defaultWindowState"))
def writeSettings(self): """ Register current settings (geometry and window state) in a setting file """ settings = QtCore.QSettings("OpenAlea", "OpenAleaLab") settings.setValue("geometry", self.saveGeometry()) settings.setValue("windowState", self.saveState()) settings.setValue("session", self.session.project)
def preferedSettings(self): """ Get prefered settings and restore them """ try: settings = QtCore.QSettings("OpenAlea", "OpenAleaLab") self.restoreGeometry(settings.value("preferedGeometry")) self.restoreState(settings.value("preferedWindowState")) except: logger.warning("Can t restore prefered session")
def readSettings(self): """ Read a setting file and restore registered settings (geometry and window state) """ settings = QtCore.QSettings("OpenAlea", "OpenAleaLab") try: self.restoreGeometry(settings.value("geometry")) # self.restoreState(settings.value("windowState")) except: # if you launch application for the first time, # it will save the default state settings.setValue("defaultGeometry", self.saveGeometry()) # settings.setValue("defaultWindowState", self.saveState()) logger.warning("Can t restore session")