diff --git a/app/ui/satellites_dialog.glade b/app/ui/satellites_dialog.glade index 57f8c0e0..f0088968 100644 --- a/app/ui/satellites_dialog.glade +++ b/app/ui/satellites_dialog.glade @@ -1478,17 +1478,18 @@ Author: Dmitriy Yefremov - + False True - 480 True - dialog + True True + True False + Satellites update 2 True @@ -1508,7 +1509,7 @@ Author: Dmitriy Yefremov False True - 0 + 1 @@ -1527,22 +1528,92 @@ Author: Dmitriy Yefremov False True - 1 + 2 + + + + + True + True + True + Update + True + + + + True + False + gtk-refresh + + + + + False + True + 3 - - - - - True - False - Satellites update True False + + + True + True + True + Cancel + True + + + + True + False + gtk-cancel + + + + + False + True + 0 + + + + + True + True + True + Receive + True + + + + True + False + gtk-goto-bottom + + + + + False + True + 2 + + + + + True + False + + + False + True + 3 + + True @@ -1562,7 +1633,7 @@ Author: Dmitriy Yefremov False True - 0 + 4 @@ -1584,7 +1655,7 @@ Author: Dmitriy Yefremov False True - 1 + 5 @@ -1595,415 +1666,328 @@ Author: Dmitriy Yefremov - - sat_update_close_button - - - - 480 - 320 + + + True False + 1 + 1 + 1 + 2 vertical - 2 - - + + + True False - center - - gtk-close + True - True - True - True + False + + + 200 + True + True + edit-find-symbolic + False + False + + + + False + True + 0 + + + + + True + False + True + True + + + + True + False + down + + + + + False + False + 1 + + + + + True + False + True + True + + + + True + False + up + + + + + False + False + 2 + + - - True - True - 0 - False - False - 0 + True + 1 - + True False - vertical - + True False + 2 + 2 - + True False - - - 200 - True - True - edit-find-symbolic - False - False - - - - False - True - 0 - - - - - True - False - True - True - - - - True - False - down - - - - - False - False - 1 - - - - - True - False - True - True - - - - True - False - up - - - - - False - False - 2 - - + From: + + 0 + 0 + - - - False - True - 1 - - - - - True - False - - True - False - 2 - 2 - - - True - False - From: - - - 0 - 0 - - - - - True - True - number - pos_adjustment - 1 - True - - - - 1 - 0 - - - - - True - False - side_store - 0 - - - - - 0 - - - - - 2 - 0 - - - - - True - False - To: - - - 3 - 0 - - - - - True - True - number - pos_adjustment2 - 1 - True - - - - 4 - 0 - - - - - True - False - side_store - 0 - - - - - 0 - - - - - 5 - 0 - - - - - gtk-apply - True - True - True - True - - - - 6 - 0 - - - - - - - False - True - 2 - - - - - True - True - in - - + True True - update_sat_list_model_sort - - - - - multiple - - + number + pos_adjustment + 1 + True + + + + 1 + 0 + + + + + True + False + side_store + 0 + - - Satellite - True - True - 0 - - - - 0 - - - - - - - Position - True - True - 1 - - - - 1 - - - - - - - Type - True - True - 2 - - - - 2 - - - - - - - False - Url - - - - 3 - - - - - - - Selected - True - 4 - - - - - - 4 - - - + + + 0 + + + 2 + 0 + + + + + True + False + To: + + + 3 + 0 + + + + + True + True + number + pos_adjustment2 + 1 + True + + + + 4 + 0 + + + + + True + False + side_store + 0 + + + + + 0 + + + + + 5 + 0 + + + + + gtk-apply + True + True + True + True + + + + 6 + 0 + - - True - True - 5 - + + + False + True + 2 + + + + + 480 + 320 + True + True + 2 + in - + True - False + True + update_sat_list_model_sort + + + + + multiple + + + + + Satellite + True + True + 0 + + + + 0 + + + + + + + Position + True + 1 + + + + 1 + + + + + + + Type + True + 2 + + + + 2 + + + + + + + False + Url + + + + 3 + + + + + + + Selected + True + 4 + + + + + + 4 + + + + - - False - True - 2 - 6 - - - - - True - False - - - True - False - True - Cancel - True - gtk-cancel - - - - True - True - - - - - True - False - True - Update - True - gtk-refresh - - - - True - True - - - - - True - False - False - True - Receive - True - gtk-goto-bottom - - - - True - True - - - - - - False - True - 7 - + + + True + True + 5 + + + + + True + False + 1 + 1 + 2 + 2 + 0 + in True True + 1 + 1 + 1 + 1 + True 120 @@ -2027,89 +2011,72 @@ Author: Dmitriy Yefremov - - False - True - 8 - - - - True + + + + + + False + True + 8 + + + + + True + False + True + + + False - True - - - - False - 6 - end - - - - - - False - False - 0 - - - - - False - 16 - - - True - False - Info - - - False - True - 0 - - - - - False - False - 0 - - + 6 + end False - True - 9 + False + 0 - - - True + + False + 16 + + + True + False + Info + + + False + True + 0 + + False - True - 2 - 10 + False + 0 + + + - True + False True - 1 + 9 - - sat_update_close_button - diff --git a/app/ui/satellites_dialog.py b/app/ui/satellites_dialog.py index cc40b9be..aa616a67 100644 --- a/app/ui/satellites_dialog.py +++ b/app/ui/satellites_dialog.py @@ -289,9 +289,7 @@ class SatellitesDialog: @run_idle def on_update(self, item): - dialog = SatellitesUpdateDialog(self._window, self._sat_view.get_model()) - dialog.run() - dialog.destroy() + SatellitesUpdateDialog(self._window, self._sat_view.get_model()).show() @staticmethod def parse_data(model, path, itr, sats): @@ -470,14 +468,14 @@ class SatellitesUpdateDialog: builder = Gtk.Builder() builder.set_translation_domain(TEXT_DOMAIN) builder.add_objects_from_file(UI_RESOURCES_PATH + "satellites_dialog.glade", - ("satellites_update_dialog", "update_source_store", "update_sat_list_store", + ("satellites_update_window", "update_source_store", "update_sat_list_store", "update_sat_list_model_filter", "update_sat_list_model_sort", "side_store", "pos_adjustment", "pos_adjustment2", "satellites_update_popup_menu", "remove_selection_image")) builder.connect_signals(handlers) - self._dialog = builder.get_object("satellites_update_dialog") - self._dialog.set_transient_for(transient) + self._window = builder.get_object("satellites_update_window") + self._window.set_transient_for(transient) self._main_model = main_model # self._dialog.get_content_area().set_border_width(0) self._sat_view = builder.get_object("sat_update_tree_view") @@ -505,17 +503,13 @@ class SatellitesUpdateDialog: self._download_task = False self._parser = None - def run(self): - if self._dialog.run() == Gtk.ResponseType.CANCEL: - self._download_task = False - return - - def destroy(self): - self._dialog.destroy() + def show(self): + self._window.show() + @run_idle def on_update_satellites_list(self, item): if self._download_task: - show_dialog(DialogType.ERROR, self._dialog, "The task is already running!") + show_dialog(DialogType.ERROR, self._window, "The task is already running!") return model = get_base_model(self._sat_view.get_model()) @@ -540,18 +534,17 @@ class SatellitesUpdateDialog: for sat in sats: model.append(sat) - @run_task + @run_idle def on_receive_satellites_list(self, item): if self._download_task: - show_dialog(DialogType.ERROR, self._dialog, "The task is already running!") + show_dialog(DialogType.ERROR, self._window, "The task is already running!") return self.receive_satellites() @run_task def receive_satellites(self): self._download_task = True - self._sat_update_expander.set_expanded(True) - self._text_view.get_buffer().set_text("", 0) + self.update_expander() model = self._sat_view.get_model() start = time.time() @@ -563,9 +556,11 @@ class SatellitesUpdateDialog: futures = {executor.submit(self._parser.get_satellite, sat[:-1]): sat for sat in [r for r in model if r[4]]} for future in concurrent.futures.as_completed(futures): if not self._download_task: + self._download_task = True executor.shutdown() appender.send("\nCanceled\n") appender.close() + self._download_task = False return data = future.result() appender.send(text.format(data[0])) @@ -574,7 +569,7 @@ class SatellitesUpdateDialog: appender.send("-" * 75 + "\n") appender.send("Consumed : {:0.0f}s, {} satellites received.".format(start - time.time(), len(sats))) appender.close() - # self.show_info_message(message, Gtk.MessageType.INFO) + sats = {s[2]: s for s in sats} # key = position, v = satellite for row in self._main_model: @@ -589,6 +584,11 @@ class SatellitesUpdateDialog: self._download_task = False + @run_idle + def update_expander(self): + self._sat_update_expander.set_expanded(True) + self._text_view.get_buffer().set_text("", 0) + @run_idle def update_satellite(self, itr, row, sat): if self._main_model.iter_has_child(itr): @@ -608,7 +608,6 @@ class SatellitesUpdateDialog: text = yield append(text) - @run_idle def on_cancel_receive(self, item=None): self._download_task = False @@ -689,7 +688,7 @@ class SatellitesUpdateDialog: if event.get_event_type() == Gdk.EventType.BUTTON_PRESS and event.button == Gdk.BUTTON_SECONDARY: menu.popup(None, None, None, None, event.button, event.time) - def on_quit(self): + def on_quit(self, window, event): self._download_task = False