From e51601a8bde7ac07823ae683898aadfc5d245c46 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 9 Dec 2019 12:12:25 -0600 Subject: [PATCH] Added select/unselect all option in menu for audio buffers --- changelog.md | 1 + src/controller/buffers.py | 12 ++++++++++++ src/sessionmanager/renderers.py | 3 +++ src/widgetUtils/wxUtils.py | 5 +++-- src/wxUI/menus.py | 2 ++ todo.md | 3 ++- 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index fe0a84f..f8426c8 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ * Socializer will ask for confirmation before closing the application. * In all audio buffers, there is a new item in the context menu that allows downloading of the audio directly from the buffer. If there are multiple audios selected, socializer will ask for a folder where all audios should be placed. When downloading multiple audios, socializer will name those automatically by following the template "song title - artist". +* In all audio buffers, there are two new menu items for selecting and unselecting all items in the buffer. * Added displaying of articles as attachments in wall posts. When opened, Socializer will open the article in the web browser. ### bugfixes diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 280fa80..aba42c4 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -825,6 +825,8 @@ class audioBuffer(feedBuffer): widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play) widgetUtils.connect_event(m, widgetUtils.MENU, self.move_to_album, menuitem=m.move) widgetUtils.connect_event(m, widgetUtils.MENU, self.download, menuitem=m.download) + widgetUtils.connect_event(m, widgetUtils.MENU, self.select_all, menuitem=m.select) + widgetUtils.connect_event(m, widgetUtils.MENU, self.unselect_all, menuitem=m.unselect) # if owner_id is the current user, the audio is added to the user's audios. if p["owner_id"] == self.session.user_id: m.library.SetItemLabel(_("&Remove")) @@ -896,6 +898,16 @@ class audioBuffer(feedBuffer): downloads.append((utils.transform_audio_url(i["url"]), filepath)) pub.sendMessage("download-files", downloads=downloads) + def select_all(self, *args, **kwargs): + items = self.tab.list.list.GetItemCount() + for i in range(0, items): + self.tab.list.list.SetItemImage(i, 1) + + def unselect_all(self, *args, **kwargs): + items = self.tab.list.list.GetItemCount() + for i in range(0, items): + self.tab.list.list.SetItemImage(i, 0) + class audioAlbum(audioBuffer): """ this buffer was supposed to be used with audio albums but is deprecated as VK removed its audio support for third party apps.""" diff --git a/src/sessionmanager/renderers.py b/src/sessionmanager/renderers.py index ba83e89..d5bd55e 100644 --- a/src/sessionmanager/renderers.py +++ b/src/sessionmanager/renderers.py @@ -83,6 +83,9 @@ def add_attachment(attachment): else: text = attachment["wall"]["text"] msg = _("{user}: {post}").format(user=user, post=text) + elif attachment["type"] == "article": + tpe = _("Article") + msg = "{author}: {article}".format(author=attachment["article"]["owner_name"], article=attachment["article"]["title"]) else: print(attachment) return [tpe, msg] diff --git a/src/widgetUtils/wxUtils.py b/src/widgetUtils/wxUtils.py index 8c10a28..bf1c2a1 100644 --- a/src/widgetUtils/wxUtils.py +++ b/src/widgetUtils/wxUtils.py @@ -138,8 +138,9 @@ class mainLoopObject(wx.App): class multiselectionBaseList(wx.ListCtrl, listmix.CheckListCtrlMixin): def __init__(self, *args, **kwargs): - wx.ListCtrl.__init__(self, *args, **kwargs) - listmix.CheckListCtrlMixin.__init__(self) + super(multiselectionBaseList, self).__init__(*args, **kwargs) +# wx.ListCtrl.__init__(self, *args, **kwargs) +# listmix.CheckListCtrlMixin.__init__(self) self.Bind(wx.EVT_CHAR_HOOK, self.on_keydown) self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus) diff --git a/src/wxUI/menus.py b/src/wxUI/menus.py index b36b119..587a157 100644 --- a/src/wxUI/menus.py +++ b/src/wxUI/menus.py @@ -32,6 +32,8 @@ class audioMenu(wx.Menu): self.library = self.Append(wx.NewId(), _("&Add to library")) self.move = self.Append(wx.NewId(), _("Move to album")) self.download = self.Append(wx.NewId(), _("Download")) + self.select = self.Append(wx.NewId(), _("Select all")) + self.unselect = self.Append(wx.NewId(), _("Unselect all")) class peopleMenu(wx.Menu): def __init__(self, is_request=False, is_subscriber=False, not_friend=False, *args, **kwargs): diff --git a/todo.md b/todo.md index 2572dad..8954346 100644 --- a/todo.md +++ b/todo.md @@ -31,12 +31,13 @@ ## Application features * Spelling correction: + - Add words to dictionaries. - allow users to set the spelling language - allow language switching within the spelling correction dialog - integrate this feature in chat messages. * Translator: Integrate translation service in chat messages (for translating incoming and outgoing messages if necessary). * timelines: persistent timelines saved in config. -* Audio buffers: Select/unselect all. +* (done) Audio buffers: Select/unselect all. * Allow copy of VK objects (such as wall posts or audios) to attach those in chat messages or other posts. * video playback inside the application. * Add fullscreen option to the photo viewer.