From 3cf4da5cee807c9b6f3e4213b5307f6b1dda7ef3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 28 Feb 2009 20:00:38 +0000 Subject: [PATCH] minimal changes to allow updated gramplets in user's .gramps/plugins directory svn: r12163 --- src/DataViews/GrampletView.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/DataViews/GrampletView.py b/src/DataViews/GrampletView.py index ed0f400e9..542f02d16 100644 --- a/src/DataViews/GrampletView.py +++ b/src/DataViews/GrampletView.py @@ -80,10 +80,19 @@ def register_gramplet(data_dict): base_opts = {"name":"Unnamed Gramplet", "tname": _("Unnamed Gramplet"), "state":"maximized", + "version":"0.0.0", + "gramps":"0.0.0", "column": -1, "row": -1, "data": []} base_opts.update(data_dict) - AVAILABLE_GRAMPLETS[base_opts["name"]] = base_opts + if base_opts["name"] not in AVAILABLE_GRAMPLETS: + AVAILABLE_GRAMPLETS[base_opts["name"]] = base_opts + else: # go with highest version (or current one in case of tie) + # GRAMPS loads system plugins first + loaded_version = [int(i) for i in AVAILABLE_GRAMPLETS[base_opts["name"]]["version"].split(".")] + current_version = [int(i) for i in base_opts["version"].split(".")] + if current_version >= loaded_version: + AVAILABLE_GRAMPLETS[base_opts["name"]] = base_opts def register(**data): """