From 034ea9e1a8cddd26e703783ca9ace1317891e2db Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 10 Jun 2007 04:34:26 +0000 Subject: [PATCH] modified pref.py so that plugins can use the class to save their preferences.. This fixes the issue with the torrent search plugin --- src/pref.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pref.py b/src/pref.py index 945f2d894..fba2f3e16 100644 --- a/src/pref.py +++ b/src/pref.py @@ -75,14 +75,18 @@ DEFAULT_PREFS = { "window_y_pos" : 0, } class Preferences: - def __init__(self, filename=None, defaults=None): - self.mapping = DEFAULT_PREFS - self.config_file = filename - if self.config_file is not None: - self.load(self.config_file) + def __init__(self, filename=None, global_defaults=True, defaults=None): + self.mapping = {} if defaults is not None: for key in defaults.keys(): self.mapping.setdefault(key, defaults[key]) + + if global_defaults is True: + self.mapping = DEFAULT_PREFS + + self.config_file = filename + if self.config_file is not None: + self.load(self.config_file) # Allows you to access an item in a Preferences objecy by calling # instance[key] rather than instance.get(key). However, this will