From ff4496be246843d452b3867387a7b18004ac3ff3 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 11 Jan 2019 10:03:51 -0600 Subject: [PATCH] Deleting a video album will fail if there are no albums --- src/controller/mainController.py | 4 ++++ src/wxUI/commonMessages.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 21f068d..67b85de 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -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 diff --git a/src/wxUI/commonMessages.py b/src/wxUI/commonMessages.py index 3a7f46a..6962293 100644 --- a/src/wxUI/commonMessages.py +++ b/src/wxUI/commonMessages.py @@ -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()