Browse Source

Do not display message when no item is selected

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
ec671882f7
1 changed files with 16 additions and 12 deletions
  1. 28
      youtube_dl_gui/mainframe.py

28
youtube_dl_gui/mainframe.py

@ -539,9 +539,10 @@ class MainFrame(wx.Frame):
def _on_play(self, event): def _on_play(self, event):
selected_rows = self._status_list.get_all_selected() selected_rows = self._status_list.get_all_selected()
if not selected_rows:
self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
else:
#if not selected_rows:
#self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
#else:
if selected_rows:
for selected_row in selected_rows: for selected_row in selected_rows:
object_id = self._status_list.GetItemData(selected_row) object_id = self._status_list.GetItemData(selected_row)
selected_download_item = self._download_list.get_item(object_id) selected_download_item = self._download_list.get_item(object_id)
@ -556,9 +557,10 @@ class MainFrame(wx.Frame):
def _on_arrow_up(self, event): def _on_arrow_up(self, event):
index = self._status_list.get_next_selected() index = self._status_list.get_next_selected()
if index == -1:
self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
else:
#if index == -1:
#self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
#else:
if index != -1:
while index >= 0: while index >= 0:
object_id = self._status_list.GetItemData(index) object_id = self._status_list.GetItemData(index)
download_item = self._download_list.get_item(object_id) download_item = self._download_list.get_item(object_id)
@ -579,9 +581,10 @@ class MainFrame(wx.Frame):
def _on_arrow_down(self, event): def _on_arrow_down(self, event):
index = self._status_list.get_next_selected(reverse=True) index = self._status_list.get_next_selected(reverse=True)
if index == -1:
self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
else:
#if index == -1:
#self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
#else:
if index != -1:
while index >= 0: while index >= 0:
object_id = self._status_list.GetItemData(index) object_id = self._status_list.GetItemData(index)
download_item = self._download_list.get_item(object_id) download_item = self._download_list.get_item(object_id)
@ -621,9 +624,10 @@ class MainFrame(wx.Frame):
def _on_pause(self, event): def _on_pause(self, event):
selected_rows = self._status_list.get_all_selected() selected_rows = self._status_list.get_all_selected()
if not selected_rows:
self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
else:
#if not selected_rows:
#self._create_popup("No row selected", self.ERROR_LABEL, wx.OK | wx.ICON_EXCLAMATION)
#else:
if selected_rows:
#REFACTOR Use DoubleStageButton for this and check stage #REFACTOR Use DoubleStageButton for this and check stage
if self._buttons["pause"].GetLabel() == "Pause": if self._buttons["pause"].GetLabel() == "Pause":
new_state = "Paused" new_state = "Paused"

Loading…
Cancel
Save