Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions gramps/gui/displaystate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2026 ztlxltl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -306,15 +307,17 @@ def build(self, update_menu=True):

for item in rfiles:
try:
title = html.escape(item.get_name())
title = item.get_name()
menu_title = html.escape(title.replace("_", "__"))
bar_title = html.escape(title)
filename = os.path.basename(item.get_path())
action_id = "RecentMenu%d" % count
# add the menuitem for this file
menu += _RCT_MENU % (action_id, title)
menu += _RCT_MENU % (action_id, menu_title)
# add the action for this file
actionlist.append((action_id, make_callback(item, self.load)))
# add the toolbar menuitem
bar += _RCT_BAR % (action_id, title)
bar += _RCT_BAR % (action_id, bar_title)
except RuntimeError:
# ignore no longer existing files
_LOG.info("Ignoring the RecentItem %s (%s)" % (title, filename))
Expand Down
9 changes: 6 additions & 3 deletions gramps/gui/viewmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Gary Burton
# Copyright (C) 2012 Doug Blank <doug.blank@gmail.com>
# Copyright (C) 2026 ztlxltl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1609,7 +1610,8 @@ def build_plugin_menu(self, text, item_list, categories, func):
pdatas.sort(key=lambda x: x.name)
for pdata in pdatas:
new_key = valid_action_name(pdata.id)
ofile.write(menuitem % (new_key, pdata.name))
name = html.escape(pdata.name.replace("_", "__"))
ofile.write(menuitem % (new_key, name))
actions.append((new_key, func(pdata, self.dbstate, self.uistate)))
ofile.write("</submenu>\n")

Expand All @@ -1623,8 +1625,9 @@ def build_plugin_menu(self, text, item_list, categories, func):
pdatas = hash_data[_UNSUPPORTED]
pdatas.sort(key=lambda x: x.name)
for pdata in pdatas:
new_key = pdata.id.replace(" ", "-")
ofile.write(menuitem % (new_key, pdata.name))
new_key = valid_action_name(pdata.id)
name = html.escape(pdata.name.replace("_", "__"))
ofile.write(menuitem % (new_key, name))
actions.append((new_key, func(pdata, self.dbstate, self.uistate)))
ofile.write("</submenu>\n")

Expand Down
5 changes: 4 additions & 1 deletion gramps/gui/views/bookmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2026 ztlxltl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -174,7 +175,9 @@ def redraw(self, update_menu=True):
func = self.callback(item)
action_id = "BM.%s" % item
actions.append((action_id, func))
text.write(menuitem % (action_id, html.escape(label)))
text.write(
menuitem % (action_id, html.escape(label.replace("_", "__")))
)
count += 1
except AttributeError:
pass
Expand Down
5 changes: 3 additions & 2 deletions gramps/gui/views/tags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2010 Nick Hall
# Copyright (C) 2026 ztlxltl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -254,15 +255,15 @@ def _build_tag_menu(self):
for tag_name, handle in self.__tag_list:
tag_menu += menuitem % (
"TAG-%s" % handle,
_("Add tag '%s'") % escape(tag_name),
_("Add tag '%s'") % escape(tag_name.replace("_", "__")),
)
actions.append(
("TAG-%s" % handle, make_callback(self.tag_selected_rows, handle))
)
for tag_name, handle in self.__tag_list:
tag_menu += menuitem % (
"R-TAG-%s" % handle,
_("Remove tag '%s'") % escape(tag_name),
_("Remove tag '%s'") % escape(tag_name.replace("_", "__")),
)
actions.append(
(
Expand Down