From c19a9124c94849c3c28c2f65d8731c6511b2c802 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 5 Aug 2023 15:54:35 +0200 Subject: [PATCH] interface_view: Handle exception when loading icon For the Selection interface, a warning icon along with the text "Too many selectable children" is shown when the accessible object has more than 50 children. When retrieving the warning icon from the theme fails, that triggers an exception that wasn't handled previously, causing interfaces to not be properly displayed, as observed on Fedora 38: exception: gtk-icon-theme-error-quark: Icon 'gtk-dialog-warning' not present in theme Adwaita (0) Catch the exception and show just the text without the icon in that case. Originally reported as a bug against LibreOffice: https://bugs.documentfoundation.org/show_bug.cgi?id=156609 --- plugins/interface_view.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/interface_view.py b/plugins/interface_view.py index f94519c..e327a50 100644 --- a/plugins/interface_view.py +++ b/plugins/interface_view.py @@ -917,10 +917,14 @@ class _SectionSelection(_InterfaceSection): ''' if acc.childCount > 50: theme = gtk.IconTheme.get_default() - self.sel_model.append( - [theme.load_icon('gtk-dialog-warning', 24, - gtk.IconLookupFlags.USE_BUILTIN), - _('Too many selectable children'), None]) + try: + warning_icon = theme.load_icon('gtk-dialog-warning', 24, + gtk.IconLookupFlags.USE_BUILTIN) + except: + warning_icon = None + + self.sel_model.append([warning_icon, _('Too many selectable children'), + None]) # Set section as insensitive, but leave expander label sensitive. section_widgets = self.expander.get_children() section_widgets.remove(self.expander.get_label_widget()) -- GitLab