From ee5c8b2ad0e0b3ac6808d66c3d880d8892096f29 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Tue, 11 Oct 2016 17:38:05 +0300 Subject: [PATCH] Add 'clear list' functionality --- TODO | 1 - youtube_dl_gui/mainframe.py | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 0e9b915..5a9373f 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ NEW_LAYOUT ========== * Context menu 'Rename' * Swap some of the Error messages with Info -* Add clear list button ? (Or use 'delete' button with no selections for that) * REFACTOR tag downloadmanager.py:663 * Update & re-enable options window * Adjust layout see #131 diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index 8bc13e8..f91f1fe 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -438,7 +438,24 @@ class MainFrame(wx.Frame): selected_row = self._status_list.get_selected() if selected_row == -1: - self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION) + #self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION) + + dlg = ButtonsChoiceDialog(self, ["Remove all", "Remove completed"], "No items selected. Please pick an action.", "Delete") + ret_code = dlg.ShowModal() + dlg.Destroy() + + #TODO Maybe add this functionality directly to DownloadList? + if ret_code == 1: + for ditem in self._download_list.get_items(): + if ditem.stage != "Active": + self._status_list.remove_row(self._download_list.index(ditem.object_id)) + self._download_list.remove(ditem.object_id) + + if ret_code == 2: + for ditem in self._download_list.get_items(): + if ditem.stage == "Completed": + self._status_list.remove_row(self._download_list.index(ditem.object_id)) + self._download_list.remove(ditem.object_id) else: object_id = self._status_list.GetItemData(selected_row) selected_download_item = self._download_list.get_item(object_id)