From d26f428733a46c29d6e14abc3ee8c0958384cd80 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Sat, 1 Oct 2016 01:04:24 +0300 Subject: [PATCH] Context menu add 'Open destination' --- TODO | 1 - youtube_dl_gui/mainframe.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 80c8c01..4448566 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ NEW_LAYOUT ========== * Create new button widget (groups, auto width) -* Context menu 'Open destination folder' * Context menu 'Rename' * Swap some of the Error messages with Info * Add clear list button ? (Or use 'delete' button with no selections for that) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index c4a2107..ca7f4fc 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -245,7 +245,8 @@ class MainFrame(wx.Frame): statuslist_menu_data = ( (_("Get url"), self._on_geturl), - (_("Get command"), self._on_getcmd) + (_("Get command"), self._on_getcmd), + (_("Open destination"), self._on_open_dest) ) # Create options frame @@ -340,6 +341,16 @@ class MainFrame(wx.Frame): if selected != -1: self.PopupMenu(self._statuslist_menu) + def _on_open_dest(self, event): + selected = self._status_list.get_selected() + + if selected != -1: + object_id = self._status_list.GetItemData(selected) + download_item = self._download_list.get_item(object_id) + + if download_item.stage == "Completed" and download_item.path: + open_file(download_item.path) + def _on_geturl(self, event): selected = self._status_list.get_selected()