From 7f529f61b9515db97ed05bfaeef9eb8ee61479bd Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Fri, 4 Nov 2016 23:54:53 +0200 Subject: [PATCH] Pause button add support for multiple items selection --- youtube_dl_gui/mainframe.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index d5a7fb2..2b96db0 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -613,21 +613,23 @@ class MainFrame(wx.Frame): self._update_pause_button(None) def _on_pause(self, event): - selected_row = self._status_list.get_selected() + selected_rows = self._status_list.get_all_selected() - if selected_row == -1: + if not selected_rows: self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION) else: - object_id = self._status_list.GetItemData(selected_row) - download_item = self._download_list.get_item(object_id) + for selected_row in selected_rows: + object_id = self._status_list.GetItemData(selected_row) + download_item = self._download_list.get_item(object_id) + + if download_item.stage == "Queued": + self._download_list.change_stage(object_id, "Paused") + elif download_item.stage == "Paused": + self._download_list.change_stage(object_id, "Queued") - if download_item.stage == "Queued": - self._download_list.change_stage(object_id, "Paused") - elif download_item.stage == "Paused": - self._download_list.change_stage(object_id, "Queued") + self._status_list._update_from_item(selected_row, download_item) self._update_pause_button(None) - self._status_list._update_from_item(selected_row, download_item) def _on_start(self, event): if self.download_manager is None: