summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-06-10 01:17:56 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-06-10 01:17:56 +0200
commit772b3bb14fc3103d774e4e0d907a6c4670ed03f3 (patch)
tree6945a5f7d03838d9c934875377dfcf3d98ebb102 /portato
parent7a12f4c4031c85e4301d09ea5aa86e55103bb5e1 (diff)
downloadportato-772b3bb14fc3103d774e4e0d907a6c4670ed03f3.tar.gz
portato-772b3bb14fc3103d774e4e0d907a6c4670ed03f3.tar.bz2
portato-772b3bb14fc3103d774e4e0d907a6c4670ed03f3.zip
Allowed default for session; load 'app-portage/portato' as default for selections :)
Diffstat (limited to '')
-rw-r--r--portato/gui/windows/main.py15
-rw-r--r--portato/session.py13
2 files changed, 18 insertions, 10 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 8a2f170..0d40968 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -702,9 +702,6 @@ class MainWindow (Window):
self.queueTree = GtkTree(self.queueList.get_model())
self.queue = EmergeQueue(console = self.console, tree = self.queueTree, db = self.db, title_update = self.title_update, threadClass = GtkThread)
- self.catList.get_selection().select_path(1)
- self.pkgList.get_selection().select_path(0)
-
# session
splash(_("Restoring Session"))
try:
@@ -1107,13 +1104,19 @@ class MainWindow (Window):
elif version > SESSION_VERSION:
raise NewSessionException(version, SESSION_VERSION)
+ def _add (value):
+ if len(value) == 4:
+ self.session.add_handler(value[:3], default = value[3])
+ else:
+ self.session.add_handler(value)
+
# set the simple ones :)
- map(self.session.add_handler,[
+ 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_selection(self.catList, 0), save_cat_selection),
- ([("pkgsel", "window")], load_selection(self.pkgList, 1), save_pkg_selection)
+ ([("catsel", "window")], load_selection(self.catList, 0), save_cat_selection, ["app-portage"]),
+ ([("pkgsel", "window")], load_selection(self.pkgList, 1), save_pkg_selection, ["portato"])
#([("merge", "queue"), ("unmerge", "queue"), ("oneshot", "queue")], load_queue, save_queue),
])
diff --git a/portato/session.py b/portato/session.py
index 6abd899..e03f663 100644
--- a/portato/session.py
+++ b/portato/session.py
@@ -54,20 +54,20 @@ class Session (object):
# add version check
self.add_handler(([("version", "session")], self.check_version, lambda: self.VERSION))
- def add_handler (self, (options, load_fn, save_fn)):
+ def add_handler (self, (options, load_fn, save_fn), default = None):
"""
Adds a handler to this session. A handler is a three-tuple consisting of:
- a list of (key,section) values
- 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
"""
- self._handlers.append((options, load_fn, save_fn))
+ self._handlers.append((options, load_fn, save_fn, default))
def load (self):
"""
Loads and applies all values of the session.
"""
- for options, lfn, sfn in self._handlers:
+ for options, lfn, sfn, default in self._handlers:
try:
loaded = [self._cfg.get(*x) for x in options]
except KeyError: # does not exist -> ignore
@@ -75,13 +75,18 @@ class Session (object):
else:
debug("Loading %s with values %s.", options, loaded)
lfn(*loaded)
+ return
+
+ if default:
+ debug("Loading %s with defaults %s.", options, default)
+ lfn(*default)
def save (self):
"""
Saves all options into the file.
"""
- for options, lfn, sfn in self._handlers:
+ for options, lfn, sfn, default in self._handlers:
vals = sfn()
# map into list if necessairy
> 2021-02-21Update changelogRené 'Necoro' Neumann1-0/+2 2021-02-21#39 Ignore mails marked as deleted when looking for existing mails, as to not...René 'Necoro' Neumann1-0/+1 2021-02-21go mod tidyRené 'Necoro' Neumann1-8/+0 2021-02-18Import 'embed' packageRené 'Necoro' Neumann1-0/+1 2021-02-16Fix goreleaser setup regarding dockerRené 'Necoro' Neumann1-3/+1 2021-02-16Prepare v0.6.0v0.6.0René 'Necoro' Neumann3-3/+8 2021-02-16Fix CRLF endingRené 'Necoro' Neumann1-57/+57 2021-02-16Increment go-version to 1.16René 'Necoro' Neumann3-5/+5 2021-02-16Use go-embed for templates instead of inline strings.René 'Necoro' Neumann6-74/+79 2021-02-16Issue #46: Fix semantics of `n` resultRené 'Necoro' Neumann2-9/+15 2021-02-16Issue #46: Move and rename writer; add commentsRené 'Necoro' Neumann3-12/+21 2021-02-15Issue #46: Improvements; add testsRené 'Necoro' Neumann2-1/+48 2021-02-15Bump github.com/google/uuid from 1.1.4 to 1.2.0dependabot[bot]2-3/+3 2021-02-15Issue #46: Make the resulting email body not to include single \r or \n. This...René 'Necoro' Neumann2-2/+66 2021-01-20Bump github.com/PuerkitoBio/goquery from 1.6.0 to 1.6.1dependabot[bot]2-3/+3 2021-01-09Bump github.com/google/uuid from 1.1.2 to 1.1.4dependabot[bot]2-3/+3 2021-01-09Bump github.com/emersion/go-message from 0.14.0 to 0.14.1 (#42)dependabot[bot]2-3/+3 2020-11-28Bump github.com/emersion/go-message from 0.13.0 to 0.14.0 (#38)dependabot[bot]2-3/+9 2020-11-28Bump github.com/google/go-cmp from 0.5.2 to 0.5.4 (#37)dependabot[bot]2-3/+3 2020-11-23Fix release.ymlv0.5.2René 'Necoro' Neumann1-3/+10 2020-11-23Prepare v0.5.2René 'Necoro' Neumann3-3/+8 2020-11-20Bump github.com/gabriel-vasile/mimetype from 1.1.1 to 1.1.2dependabot[bot]2-3/+3 2020-11-04Clean dependabot.ymlRené 'Necoro' Neumann1-4/+0