Browse Source

Pause button add support for multiple items selection

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
7f529f61b9
1 changed files with 11 additions and 9 deletions
  1. 20
      youtube_dl_gui/mainframe.py

20
youtube_dl_gui/mainframe.py

@ -613,21 +613,23 @@ class MainFrame(wx.Frame):
self._update_pause_button(None) self._update_pause_button(None)
def _on_pause(self, event): 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) self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
else: 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._update_pause_button(None)
self._status_list._update_from_item(selected_row, download_item)
def _on_start(self, event): def _on_start(self, event):
if self.download_manager is None: if self.download_manager is None:

Loading…
Cancel
Save