Skip to content

Commit

Permalink
GUI: fix crashing due to File menu translation issues (OSGeo#4513)
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Oct 17, 2024
1 parent 14d4745 commit 6fc3d4c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gui/wxpython/lmgr/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,12 +514,20 @@ def CreateRecentFilesMenu(self, menu=None):
:return None
"""
if menu:
file_menu = menu.GetMenu(
menuIndex=menu.FindMenu(title=_("File")),
)
workspace_item = file_menu.FindItem(
id=file_menu.FindItem(itemString=_("Workspace")),
)[0]
menu_index = menu.FindMenu(_("File"))
if menu_index == wx.NOT_FOUND:
# try untranslated version
menu_index = menu.FindMenu("File")
if menu_index == wx.NOT_FOUND:
return
file_menu = menu.GetMenu(menu_index)
workspace_index = file_menu.FindItem(_("Workspace"))
if workspace_index == wx.NOT_FOUND:
workspace_index = file_menu.FindItem("Workspace")
if workspace_index == wx.NOT_FOUND:
return
workspace_item = file_menu.FindItemById(workspace_index)

self._recent_files = RecentFilesMenu(
app_name="main",
parent_menu=workspace_item.GetSubMenu(),
Expand Down

0 comments on commit 6fc3d4c

Please sign in to comment.