diff options
Diffstat (limited to 'portato')
-rw-r--r-- | portato/gui/session.py | 2 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 16 | ||||
-rw-r--r-- | portato/gui/windows/preference.py | 8 | ||||
-rw-r--r-- | portato/session.py | 2 |
4 files changed, 17 insertions, 11 deletions
diff --git a/portato/gui/session.py b/portato/gui/session.py index df4685e..40a84f1 100644 --- a/portato/gui/session.py +++ b/portato/gui/session.py @@ -14,7 +14,7 @@ from ..helper import debug # the current version for saved sessions # change this, whenever the change is incompatible with previous versions -SESSION_VERSION = 3 +SESSION_VERSION = 4 class SessionException (Exception): diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index f18ca24..0882c2a 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -999,7 +999,7 @@ class MainWindow (Window): return oldVersion = SESSION_VERSION - allowedVersions = (1,3) + allowedVersions = (1,3,4) if not defaults_only and sessionEx and isinstance(sessionEx, SessionException): if sessionEx.got in allowedVersions: @@ -1160,6 +1160,10 @@ class MainWindow (Window): # SESSION VERSION def load_session_version (version): + + if oldVersion < 4: + self.session.rename_section("window", "GUI") + if oldVersion != SESSION_VERSION: # we are trying to convert return @@ -1179,10 +1183,10 @@ class MainWindow (Window): # set the simple ones :) map(_add,[ ([("gtksessionversion", "session")], load_session_version, lambda: SESSION_VERSION), - ([("width", "window"), ("height", "window")], lambda w,h: self.window.resize(int(w), int(h)), self.window.get_size), - ([("vpanedpos", "window"), ("hpanedpos", "window")], load_paned, save_paned), - ([("catsel", "window")], load_cat_selection, save_cat_selection, ["app-portage@0"]), - ([("pkgsel", "window")], load_pkg_selection, save_pkg_selection, ["portato@0"]) + (["width", "height"], lambda w,h: self.window.resize(int(w), int(h)), self.window.get_size), + (["vpanedpos", "hpanedpos"], load_paned, save_paned), + (["catsel"], load_cat_selection, save_cat_selection, ["app-portage@0"]), + (["pkgsel"], load_pkg_selection, save_pkg_selection, ["portato@0"]) #([("merge", "queue"), ("unmerge", "queue"), ("oneshot", "queue")], load_queue, save_queue), ]) @@ -1206,7 +1210,7 @@ class MainWindow (Window): self.session.add_handler(([(name, cat)], load, save)) - map(load_cfg, [("prefheight", "window"), ("prefwidth", "window")]) + map(load_cfg, [("prefheight", "GUI"), ("prefwidth", "GUI")]) # now we have the handlers -> load self.session.load(defaults_only) diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index fe1947b..87a1860 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -82,13 +82,13 @@ class PreferenceWindow (AbstractDialog): self.cfg = cfg # the size - height = self.cfg.get_session("prefheight", "window") + height = self.cfg.get_session("prefheight", "GUI") if height is None: height = int(gtk.gdk.screen_height() * 0.8) # see 4/5 * screen_height as maximum else: height = int(height) - width = self.cfg.get_session("prefwidth", "window") + width = self.cfg.get_session("prefwidth", "GUI") if width is None: width = -1 # default else: @@ -233,5 +233,5 @@ class PreferenceWindow (AbstractDialog): return True def cb_size_changed (self, widget, event, *args): - self.cfg.set_session("prefheight", "window", event.height) - self.cfg.set_session("prefwidth", "window", event.width) + self.cfg.set_session("prefheight", "GUI", event.height) + self.cfg.set_session("prefwidth", "GUI", event.width) diff --git a/portato/session.py b/portato/session.py index a4b929b..cd4737e 100644 --- a/portato/session.py +++ b/portato/session.py @@ -82,6 +82,8 @@ class Session (object): - a function getting number of option arguments and applying them to the program - a function returning the number of option return values - getting them out of the program """ + + options = map(lambda x: (x, self._name) if not hasattr(x, "__iter__") else x, options) self._handlers.append((options, load_fn, save_fn, default)) def load (self, defaults_only = False): |