+ def _save_settings(self):
+ config = ConfigParser.SafeConfigParser()
+ self.save_settings(config)
+ with open(self._user_settings, "wb") as configFile:
+ config.write(configFile)
+
+ def save_settings(self, config):
+ config.add_section(constants.__pretty_app_name__)
+ config.set(constants.__pretty_app_name__, "wordwrap", str(self._wordWrapEnabled))
+ config.set(constants.__pretty_app_name__, "zoom", str(self._isZoomEnabled))
+ config.set(constants.__pretty_app_name__, "fullscreen", str(self._window_in_fullscreen))
+
+ def _load_settings(self):
+ config = ConfigParser.SafeConfigParser()
+ config.read(self._user_settings)
+ self.load_settings(config)
+
+ def load_settings(self, config):
+ try:
+ self._wordWrapEnabled = config.getboolean(constants.__pretty_app_name__, "wordwrap")
+ self._isZoomEnabled = config.getboolean(constants.__pretty_app_name__, "zoom")
+ self._window_in_fullscreen = config.getboolean(constants.__pretty_app_name__, "fullscreen")
+ except ConfigParser.NoSectionError, e:
+ warnings.warn(
+ "Settings file %s is missing section %s" % (
+ self._user_settings,
+ e.section,
+ ),
+ stacklevel=2
+ )
+
+ self._notizen.set_wordwrap(self._wordWrapEnabled)
+
+ self.enable_zoom(self._isZoomEnabled)
+
+ if self._window_in_fullscreen:
+ self._window.fullscreen()
+ else:
+ self._window.unfullscreen()
+