diff --git a/src/DataViews/MyGrampsView.py b/src/DataViews/MyGrampsView.py index 6fa9b3c02..8495f6353 100644 --- a/src/DataViews/MyGrampsView.py +++ b/src/DataViews/MyGrampsView.py @@ -53,6 +53,7 @@ debug = False def register_gadget(data_dict): global AVAILABLE_GADGETS base_opts = {"name":"Unnamed Gadget", + "tname": _("Unnamed Gadget"), "state":"maximized", "column": -1, "row": -1, "data": []} @@ -86,6 +87,14 @@ def get_gadget_options_by_name(name): print ("Unknown gadget name: '%s'" % name) return None +def get_gadget_options_by_tname(name): + if debug: print "name:", name + for key in AVAILABLE_GADGETS: + if AVAILABLE_GADGETS[key]["tname"] == name: + return AVAILABLE_GADGETS[key].copy() + print ("Unknown gadget name: '%s'" % name) + return None + def make_requested_gadget(viewpage, name, opts, dbstate, uistate): if name in AVAILABLE_GADGETS: gui = GuiGadget(viewpage, dbstate, uistate, **opts) @@ -636,6 +645,7 @@ class MyGrampsView(PageView.PageView): data[opt] = cp.get(sec, opt).strip() if "name" not in data: data["name"] = "Unnamed Gadget" + data["tname"]= _("Unnamed Gadget") retval.append((data["name"], data)) # name, opts else: # give defaults as currently known @@ -872,8 +882,9 @@ class MyGrampsView(PageView.PageView): self.drop_widget(self.widget, gadget, 0, 0, 0) def add_gadget(self, obj): - name = obj.get_child().get_label() - all_opts = get_gadget_options_by_name(name) + tname = obj.get_child().get_label() + all_opts = get_gadget_options_by_tname(tname) + name = all_opts["name"] if all_opts == None: print "Unknown gadget type: '%s'; bad gadgets.ini file?" % name return @@ -950,7 +961,8 @@ class MyGrampsView(PageView.PageView): qr_menu = ag_menu.get_submenu() if qr_menu == None: qr_menu = gtk.Menu() - names = AVAILABLE_GADGETS.keys() + names = [AVAILABLE_GADGETS[key]["tname"] for key + in AVAILABLE_GADGETS.keys()] names.sort() for name in names: Utils.add_menuitem(qr_menu, name, diff --git a/src/plugins/DefaultGadgets.py b/src/plugins/DefaultGadgets.py index d4dba31eb..6a8911388 100644 --- a/src/plugins/DefaultGadgets.py +++ b/src/plugins/DefaultGadgets.py @@ -516,15 +516,18 @@ class NewsGadget(Gadget): #print " after:", text yield False, text + register(type="gadget", - name= _("Top Surnames Gadget"), + name= "Top Surnames Gadget", + tname=_("1Top Surnames Gadget"), height=230, content = TopSurnamesGadget, title=_("Top Surnames"), ) register(type="gadget", - name=_("Statistics Gadget"), + name="Statistics Gadget", + tname=_("1Statistics Gadget"), height=230, expand=True, content = StatsGadget, @@ -532,7 +535,8 @@ register(type="gadget", ) register(type="gadget", - name=_("Session Log Gadget"), + name="Session Log Gadget", + tname=_("1Session Log Gadget"), height=230, data=['no'], content = LogGadget, @@ -540,7 +544,8 @@ register(type="gadget", ) register(type="gadget", - name=_("Python Gadget"), + name="Python Gadget", + tname=_("1Python Gadget"), height=250, content = PythonGadget, title=_("Python Shell"), @@ -548,6 +553,7 @@ register(type="gadget", register(type="gadget", name=_("TODO Gadget"), + tname=_("1TODO Gadget"), height=300, expand=True, content = TODOGadget, @@ -555,7 +561,8 @@ register(type="gadget", ) register(type="gadget", - name=_("Welcome Gadget"), + name="Welcome Gadget", + tname=_("1Welcome Gadget"), height=300, expand=True, content = make_welcome_content, @@ -563,14 +570,16 @@ register(type="gadget", ) register(type="gadget", - name=_("Calendar Gadget"), + name="Calendar Gadget", + tname=_("1Calendar Gadget"), height=200, content = CalendarGadget, title=_("Calendar"), ) register(type="gadget", - name=_("News Gadget"), + name="News Gadget", + tname=_("1News Gadget"), height=300, expand=True, content = NewsGadget,