mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-25 07:17:41 +00:00
Merge pull request #5589 from keymanapp/fix/linux/cherry/5584-badimage
fix(linux): Handle corrupt icon file 🍒
This commit is contained in:
commit
042c16dee3
1 changed files with 14 additions and 6 deletions
|
|
@ -22,6 +22,7 @@ from keyman_config.install_window import InstallKmpWindow, find_keyman_image
|
|||
from keyman_config.uninstall_kmp import uninstall_kmp
|
||||
from keyman_config.accelerators import bind_accelerator, init_accel
|
||||
from keyman_config.get_kmp import user_keyboard_dir
|
||||
from gi.overrides.GLib import GError
|
||||
|
||||
|
||||
class ViewInstalledWindowBase(Gtk.Window):
|
||||
|
|
@ -228,19 +229,26 @@ class ViewInstalledWindow(ViewInstalledWindowBase):
|
|||
|
||||
welcome_file = os.path.join(path, "welcome.htm")
|
||||
options_file = os.path.join(path, "options.htm")
|
||||
icofile = os.path.join(path, kmpdata['packageID'] + bmppng)
|
||||
icofile_name = os.path.join(path, kmpdata['packageID'] + bmppng)
|
||||
|
||||
if not os.path.isfile(welcome_file):
|
||||
welcome_file = None
|
||||
if not os.path.isfile(options_file):
|
||||
options_file = None
|
||||
if not os.path.isfile(icofile):
|
||||
icofile = os.path.join(path, kmpdata['keyboardID'] + bmppng)
|
||||
if not os.path.isfile(icofile):
|
||||
icofile = find_keyman_image("icon_kmp.png")
|
||||
if not os.path.isfile(icofile_name):
|
||||
icofile_name = os.path.join(path, kmpdata['keyboardID'] + bmppng)
|
||||
if not os.path.isfile(icofile_name):
|
||||
icofile_name = find_keyman_image("icon_kmp.png")
|
||||
|
||||
try:
|
||||
icofile = GdkPixbuf.Pixbuf.new_from_file_at_size(icofile_name, 16, 16)
|
||||
except GError:
|
||||
_, value, _ = sys.exc_info()
|
||||
logging.info("Error reading icon file %s: %s" % (icofile_name, value.message))
|
||||
icofile = None
|
||||
|
||||
store.append([
|
||||
GdkPixbuf.Pixbuf.new_from_file_at_size(icofile, 16, 16),
|
||||
icofile,
|
||||
kmpdata['name'],
|
||||
kmpdata['version'],
|
||||
kmpdata['packageID'],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue