From ffa7e6a9053cd33183e8ec42bb58cab074b2c0c5 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Fri, 4 Nov 2016 20:27:16 +0200 Subject: [PATCH] Context menu add support for multiple items selection --- youtube_dl_gui/mainframe.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/youtube_dl_gui/mainframe.py b/youtube_dl_gui/mainframe.py index de4f069..1aaf0cf 100644 --- a/youtube_dl_gui/mainframe.py +++ b/youtube_dl_gui/mainframe.py @@ -341,9 +341,12 @@ class MainFrame(wx.Frame): return menu def _on_statuslist_right_click(self, event): - selected = self._status_list.get_selected() + selected = event.GetIndex() if selected != -1: + self._status_list.deselect_all() + self._status_list.Select(selected, on=1) + self.PopupMenu(self._statuslist_menu) def _on_open_dest(self, event): @@ -1194,6 +1197,10 @@ class ListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin): def get_selected(self): return self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) + def deselect_all(self): + for index in xrange(self._list_index): + self.Select(index, on=0) + def get_items(self): """Returns a list of items inside the ListCtrl.