mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-02-03 21:30:28 +01:00
loading services list in the background
This commit is contained in:
@@ -300,6 +300,7 @@ class Application(Gtk.Application):
|
||||
self._tv_count_label = builder.get_object("tv_count_label")
|
||||
self._radio_count_label = builder.get_object("radio_count_label")
|
||||
self._data_count_label = builder.get_object("data_count_label")
|
||||
self._services_load_spinner = builder.get_object("services_load_spinner")
|
||||
self._signal_level_bar.bind_property("visible", builder.get_object("play_current_service_button"), "visible")
|
||||
self._signal_level_bar.bind_property("visible", builder.get_object("record_button"), "visible")
|
||||
self._receiver_info_box.bind_property("visible", self._http_status_image, "visible", 4)
|
||||
@@ -670,6 +671,11 @@ class Application(Gtk.Application):
|
||||
if not self._main_window.is_maximized():
|
||||
self._settings.add("window_size", self._main_window.get_size())
|
||||
|
||||
if self._services_load_spinner.get_property("active"):
|
||||
msg = "{}\n\n\t{}".format(get_message("Data loading in progress!"), get_message("Are you sure?"))
|
||||
if show_dialog(DialogType.QUESTION, self._main_window, msg) == Gtk.ResponseType.CANCEL:
|
||||
return True
|
||||
|
||||
if self._recorder:
|
||||
if self._recorder.is_record():
|
||||
msg = "{}\n\n\t{}".format(get_message("Recording in progress!"), get_message("Are you sure?"))
|
||||
@@ -1633,8 +1639,6 @@ class Application(Gtk.Application):
|
||||
else:
|
||||
self.append_blacklist(black_list)
|
||||
yield from self.append_data(bouquets, services)
|
||||
finally:
|
||||
self._wait_dialog.hide()
|
||||
self._profile_combo_box.set_sensitive(True)
|
||||
if callback:
|
||||
callback()
|
||||
@@ -1646,6 +1650,8 @@ class Application(Gtk.Application):
|
||||
if self._filter_box.get_visible():
|
||||
self.on_filter_changed()
|
||||
yield True
|
||||
finally:
|
||||
self._wait_dialog.hide()
|
||||
|
||||
def append_data(self, bouquets, services):
|
||||
if self._app_info_box.get_visible():
|
||||
@@ -1737,7 +1743,9 @@ class Application(Gtk.Application):
|
||||
# Adding channels to dict with fav_id as keys.
|
||||
self._services[srv.fav_id] = srv
|
||||
self.update_services_counts(len(self._services.values()))
|
||||
factor = self.DEL_FACTOR * 2
|
||||
self._wait_dialog.hide()
|
||||
self._services_load_spinner.start()
|
||||
factor = self.DEL_FACTOR
|
||||
|
||||
for index, srv in enumerate(services):
|
||||
tooltip, background = None, None
|
||||
@@ -1752,6 +1760,8 @@ class Application(Gtk.Application):
|
||||
self._services_model.append(s)
|
||||
if index % factor == 0:
|
||||
yield True
|
||||
|
||||
self._services_load_spinner.stop()
|
||||
yield True
|
||||
|
||||
def clear_current_data(self):
|
||||
@@ -2156,7 +2166,7 @@ class Application(Gtk.Application):
|
||||
|
||||
def on_view_focus(self, view, focus_event=None):
|
||||
model_name, model = get_model_data(view)
|
||||
not_empty = len(model) > 0 # if > 0 model has items
|
||||
not_empty = len(model) > 0 if model else False
|
||||
is_service = model_name == self.SERVICE_MODEL_NAME
|
||||
|
||||
if model_name == self.BQ_MODEL_NAME:
|
||||
|
||||
@@ -625,7 +625,7 @@ def get_base_paths(paths, model):
|
||||
def get_model_data(view):
|
||||
""" Returns model name and base model from the given view """
|
||||
model = get_base_model(view.get_model())
|
||||
model_name = model.get_name()
|
||||
model_name = model.get_name() if model else ""
|
||||
return model_name, model
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.2
|
||||
<!-- Generated with glade 3.22.1
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
@@ -2490,6 +2490,22 @@ Author: Dmitriy Yefremov
|
||||
<property name="position">9</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="services_load_spinner">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Loading data...</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_right">10</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">10</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
||||
Reference in New Issue
Block a user