From d7b9aa37669597aee41caf6d12aa4cef99cf46e3 Mon Sep 17 00:00:00 2001 From: Dmitriy Yefremov Date: Fri, 15 Dec 2017 14:33:36 +0300 Subject: [PATCH] force loading icons if not exist in theme --- app/ui/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/ui/__init__.py b/app/ui/__init__.py index 749cd9b3..d04fe64d 100644 --- a/app/ui/__init__.py +++ b/app/ui/__init__.py @@ -1,12 +1,16 @@ import gi gi.require_version('Gtk', '3.0') -from gi.repository import Gtk, Gdk +from gi.repository import Gtk -CODED_ICON = Gtk.IconTheme.get_default().load_icon("gtk-dialog-authentication-panel", 16, 0) -LOCKED_ICON = Gtk.IconTheme.get_default().load_icon("system-lock-screen", 16, 0) -HIDE_ICON = Gtk.IconTheme.get_default().load_icon("go-jump", 16, 0) -TV_ICON = Gtk.IconTheme.get_default().load_icon("tv-symbolic", 16, 0) +theme = Gtk.IconTheme.get_default() +_IMAGE_MISSING = theme.load_icon("image-missing", 16, 0) if theme.lookup_icon("image-missing", 16, 0) else None +CODED_ICON = theme.load_icon("gtk-dialog-authentication-panel", 16, 0) if theme.lookup_icon( + "gtk-dialog-authentication-panel", 16, 0) else _IMAGE_MISSING +LOCKED_ICON = theme.load_icon("system-lock-screen", 16, 0) if theme.lookup_icon( + "system-lock-screen", 16, 0) else _IMAGE_MISSING +HIDE_ICON = theme.load_icon("go-jump", 16, 0) if theme.lookup_icon("go-jump", 16, 0) else _IMAGE_MISSING +TV_ICON = theme.load_icon("tv-symbolic", 16, 0) if theme.lookup_icon("tv-symbolic", 16, 0) else _IMAGE_MISSING if __name__ == "__main__": pass