From df9899a78bb15408e1ef44bb0bb58c19057289f1 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sun, 7 Feb 2010 13:30:59 +0000 Subject: [PATCH] Allow each grampletpane to have its own config svn: r14265 --- src/gui/widgets/grampletpane.py | 14 ++++---------- src/plugins/view/grampletview.py | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gui/widgets/grampletpane.py b/src/gui/widgets/grampletpane.py index 4c587eefb..6157ab9d5 100644 --- a/src/gui/widgets/grampletpane.py +++ b/src/gui/widgets/grampletpane.py @@ -66,12 +66,8 @@ WIKI_HELP_PAGE = const.URL_MANUAL_PAGE + '_-_Gramplets' # #------------------------------------------------------------------------- PLUGMAN = GuiPluginManager.get_instance() - -GRAMPLET_FILENAME = os.path.join(const.HOME_DIR,"gramplets.ini") NL = "\n" -debug = False - def AVAILABLE_GRAMPLETS(): return [gplug.id for gplug in PLUGMAN.get_reg_gramplets()] @@ -133,7 +129,6 @@ def get_gramplet_options_by_name(name): """ Get options by gramplet name. """ - if debug: print "name:", name if name in AVAILABLE_GRAMPLETS(): return GET_AVAILABLE_GRAMPLETS(name).copy() else: @@ -144,7 +139,6 @@ def get_gramplet_options_by_tname(name): """ get options by translated name. """ - if debug: print "name:", name for key in AVAILABLE_GRAMPLETS(): if GET_AVAILABLE_GRAMPLETS(key)["tname"] == name: return GET_AVAILABLE_GRAMPLETS(key).copy() @@ -785,8 +779,9 @@ class GrampletPane(gtk.ScrolledWindow): if gramplet.state == "minimized": gramplet.set_state("minimized") - def __init__(self, pageview, dbstate, uistate): + def __init__(self, configfile, pageview, dbstate, uistate): gtk.ScrolledWindow.__init__(self) + self.configfile = os.path.join(const.USER_PLUGINS, "%s.ini" % configfile) self.dbstate = dbstate self.uistate = uistate self.pageview = pageview @@ -907,7 +902,7 @@ class GrampletPane(gtk.ScrolledWindow): def load_gramplets(self): self.column_count = 2 # default for new user retval = [] - filename = GRAMPLET_FILENAME + filename = self.configfile if filename and os.path.exists(filename): cp = ConfigParser.ConfigParser() cp.read(filename) @@ -936,10 +931,9 @@ class GrampletPane(gtk.ScrolledWindow): return retval def save(self): - if debug: print "saving" if len(self.frame_map) + len(self.detached_gramplets) == 0: return # something is the matter - filename = GRAMPLET_FILENAME + filename = self.configfile try: fp = open(filename, "w") except: diff --git a/src/plugins/view/grampletview.py b/src/plugins/view/grampletview.py index 216b1fc14..dda23b321 100644 --- a/src/plugins/view/grampletview.py +++ b/src/plugins/view/grampletview.py @@ -57,7 +57,7 @@ class GrampletView(PageView): the base class. Returns a gtk container widget. """ # load the user's gramplets and set columns, etc - return GrampletPane(self, self.dbstate, self.uistate) + return GrampletPane("Gramplets_grampletview", self, self.dbstate, self.uistate) def define_actions(self): """