def exit(self): self.ignore('confirmDone') self.hide() if self.settingsChanged != 0: Settings.writeSettings() self.speedChatStyleText.exit() if self.displaySettingsChanged: taskMgr.doMethodLater(self.DisplaySettingsDelay, self.writeDisplaySettings, self.DisplaySettingsTaskName)
def writeDisplaySettings(self, task = None): if not self.displaySettingsChanged: return taskMgr.remove(self.DisplaySettingsTaskName) self.notify.info('writing new display settings %s, fullscreen %s, embedded %s, %s to SettingsFile.' % (self.displaySettingsSize, self.displaySettingsFullscreen, self.displaySettingsEmbedded, self.displaySettingsApi)) Settings.setResolutionDimensions(self.displaySettingsSize[0], self.displaySettingsSize[1]) Settings.setWindowedMode(not self.displaySettingsFullscreen) Settings.setEmbeddedMode(self.displaySettingsEmbedded) if self.displaySettingsApiChanged: api = self.DisplaySettingsApiMap.get(self.displaySettingsApi) if api == None: self.notify.warning('Cannot save unknown display API: %s' % self.displaySettingsApi) else: Settings.setDisplayDriver(api) Settings.writeSettings() self.displaySettingsChanged = 0 return Task.done