From fb98aec0057b2de927f29ab1792a4eca56742d1e Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Fri, 4 Nov 2016 23:36:38 +0200 Subject: [PATCH] Reload button add support for multiple items selection --- youtube_dl_gui/mainframe.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index d151b7e..d5a7fb2 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -594,15 +594,23 @@ class MainFrame(wx.Frame): print self._download_list._items_list def _on_reload(self, event): - for index, item in enumerate(self._download_list.get_items()): - if item.stage == "Paused" or item.stage == "Completed": - item.reset() - self._status_list._update_from_item(index, item) - - # Create deselect event to reset Pause button - selected_row = self._status_list.get_selected() - if selected_row != -1: - self._status_list.Select(selected_row, 0) + selected_rows = self._status_list.get_all_selected() + + if not selected_rows: + for index, item in enumerate(self._download_list.get_items()): + if item.stage == "Paused" or item.stage == "Completed": + item.reset() + self._status_list._update_from_item(index, item) + else: + for selected_row in selected_rows: + object_id = self._status_list.GetItemData(selected_row) + item = self._download_list.get_item(object_id) + + if item.stage == "Paused" or item.stage == "Completed": + item.reset() + self._status_list._update_from_item(selected_row, item) + + self._update_pause_button(None) def _on_pause(self, event): selected_row = self._status_list.get_selected()