Deleting a video album will fail if there are no albums

This commit is contained in:
Manuel Cortez 2019-01-11 10:03:51 -06:00
parent bf7e602e4a
commit ff4496be24
2 changed files with 6 additions and 2 deletions

View File

@ -565,6 +565,8 @@ class Controller(object):
self.session.audio_albums = self.session.vk.client.audio.getAlbums(owner_id=self.session.user_id)["items"]
def delete_audio_album(self, *args, **kwargs):
if len(self.session.audio_albums) == 0:
return commonMessages.no_audio_albums()
answer = selector.album(_("Select the album you want to delete"), self.session)
if answer.item == None:
return
@ -594,6 +596,8 @@ class Controller(object):
self.session.video_albums = self.session.vk.client.video.getAlbums(owner_id=self.session.user_id)["items"]
def delete_video_album(self, *args, **kwargs):
if len(self.session.video_albums) == 0:
return commonMessages.no_video_albums()
answer = selector.album(_("Select the album you want to delete"), self.session, "video_albums")
if answer.item == None:
return

View File

@ -27,10 +27,10 @@ def bad_authorisation():
return wx.MessageDialog(None, _("authorisation failed. Your configuration will not be saved. Please close and open again the application for authorising your account. Make sure you have typed your credentials correctly."), _("Error"), style=wx.ICON_ERROR).ShowModal()
def no_audio_albums():
return wx.MessageDialog(None, _("You do not have audio albums to add tis file."), _("Error"), style=wx.ICON_ERROR).ShowModal()
return wx.MessageDialog(None, _("You do not have audio albums."), _("Error"), style=wx.ICON_ERROR).ShowModal()
def no_video_albums():
return wx.MessageDialog(None, _("You do not have video albums to add tis file."), _("Error"), style=wx.ICON_ERROR).ShowModal()
return wx.MessageDialog(None, _("You do not have video albums."), _("Error"), style=wx.ICON_ERROR).ShowModal()
def delete_audio_album():
return wx.MessageDialog(None, _("Do you really want to delete this Album? this will be deleted from VK too."), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()