fix data loading if pixbuf error

This commit is contained in:
DYefremov
2020-01-12 00:33:33 +03:00
parent 47c80b2b29
commit a1098750da
2 changed files with 11 additions and 3 deletions

View File

@@ -873,6 +873,7 @@ class Application(Gtk.Application):
GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_DEFAULT_IDLE)
def update_data(self, data_path, callback=None):
self._profile_combo_box.set_sensitive(False)
self._wait_dialog.show()
yield True
@@ -904,6 +905,7 @@ class Application(Gtk.Application):
yield from self.append_data(bouquets, services)
finally:
self._wait_dialog.hide()
self._profile_combo_box.set_sensitive(True)
if callback:
callback()
yield True
@@ -1019,6 +1021,7 @@ class Application(Gtk.Application):
self._blacklist.clear()
self._services.clear()
self._rows_buffer.clear()
self._picons.clear()
self._bouquets.clear()
self._extra_bouquets.clear()
self._current_bq_name = None

View File

@@ -10,8 +10,8 @@ from app.eparser import Service
from app.eparser.ecommons import Flag, BouquetService, Bouquet, BqType
from app.eparser.enigma.bouquets import BqServiceType, to_bouquet_id
from app.settings import SettingsType
from .uicommons import ViewTarget, BqGenType, Gtk, Gdk, HIDE_ICON, LOCKED_ICON, KeyboardKey, Column
from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog
from .uicommons import ViewTarget, BqGenType, Gtk, Gdk, HIDE_ICON, LOCKED_ICON, KeyboardKey, Column
# ***************** Markers *******************#
@@ -347,7 +347,9 @@ def update_picons_data(path, picons):
return
for file in os.listdir(path):
picons[file] = get_picon_pixbuf(path + file)
pf = get_picon_pixbuf(path + file)
if pf:
picons[file] = pf
def append_picons(picons, model):
@@ -487,7 +489,10 @@ def is_only_one_item_selected(paths, transient):
def get_picon_pixbuf(path):
return GdkPixbuf.Pixbuf.new_from_file_at_scale(filename=path, width=32, height=32, preserve_aspect_ratio=True)
try:
return GdkPixbuf.Pixbuf.new_from_file_at_scale(filename=path, width=32, height=32, preserve_aspect_ratio=True)
except GLib.GError as e:
pass
# ***************** Bouquets *********************#