Redesign for pulling model

This commit is contained in:
jeffser 2024-06-30 18:09:06 -06:00
parent 4994f6d177
commit 380ec93c6a

View File

@ -842,9 +842,12 @@ Generate a title following these rules:
def pull_model_update(self, data, model_name): def pull_model_update(self, data, model_name):
if model_name in list(self.pulling_models.keys()): if model_name in list(self.pulling_models.keys()):
GLib.idle_add(self.pulling_models[model_name]['row'].set_subtitle, data['status']) if 'completed' in data and 'total' in data:
if 'completed' in data and 'total' in data: GLib.idle_add(self.pulling_models[model_name]['progress_bar'].set_fraction, (data['completed'] / data['total'])) GLib.idle_add(self.pulling_models[model_name]['row'].set_subtitle, '<tt>{}%</tt>\t{}'.format(round(data['completed'] / data['total'] * 100, 2), data['status'].capitalize()))
else: GLib.idle_add(self.pulling_models[model_name]['progress_bar'].pulse) GLib.idle_add(self.pulling_models[model_name]['progress_bar'].set_fraction, (data['completed'] / data['total']))
else:
GLib.idle_add(self.pulling_models[model_name]['row'].set_subtitle, '{}'.format(data['status'].capitalize()))
GLib.idle_add(self.pulling_models[model_name]['progress_bar'].pulse)
else: else:
if len(list(self.pulling_models.keys())) == 0: if len(list(self.pulling_models.keys())) == 0:
GLib.idle_add(self.pulling_model_list_box.set_visible, False) GLib.idle_add(self.pulling_model_list_box.set_visible, False)