Added select/unselect all option in menu for audio buffers

This commit is contained in:
Manuel Cortez 2019-12-09 12:12:25 -06:00
parent 6667b9e4cb
commit e51601a8bd
6 changed files with 23 additions and 3 deletions

View File

@ -6,6 +6,7 @@
* Socializer will ask for confirmation before closing the application. * 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 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. * Added displaying of articles as attachments in wall posts. When opened, Socializer will open the article in the web browser.
### bugfixes ### bugfixes

View File

@ -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.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.move_to_album, menuitem=m.move)
widgetUtils.connect_event(m, widgetUtils.MENU, self.download, menuitem=m.download) 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 owner_id is the current user, the audio is added to the user's audios.
if p["owner_id"] == self.session.user_id: if p["owner_id"] == self.session.user_id:
m.library.SetItemLabel(_("&Remove")) m.library.SetItemLabel(_("&Remove"))
@ -896,6 +898,16 @@ class audioBuffer(feedBuffer):
downloads.append((utils.transform_audio_url(i["url"]), filepath)) downloads.append((utils.transform_audio_url(i["url"]), filepath))
pub.sendMessage("download-files", downloads=downloads) 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): class audioAlbum(audioBuffer):
""" this buffer was supposed to be used with audio albums """ this buffer was supposed to be used with audio albums
but is deprecated as VK removed its audio support for third party apps.""" but is deprecated as VK removed its audio support for third party apps."""

View File

@ -83,6 +83,9 @@ def add_attachment(attachment):
else: else:
text = attachment["wall"]["text"] text = attachment["wall"]["text"]
msg = _("{user}: {post}").format(user=user, post=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: else:
print(attachment) print(attachment)
return [tpe, msg] return [tpe, msg]

View File

@ -138,8 +138,9 @@ class mainLoopObject(wx.App):
class multiselectionBaseList(wx.ListCtrl, listmix.CheckListCtrlMixin): class multiselectionBaseList(wx.ListCtrl, listmix.CheckListCtrlMixin):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
wx.ListCtrl.__init__(self, *args, **kwargs) super(multiselectionBaseList, self).__init__(*args, **kwargs)
listmix.CheckListCtrlMixin.__init__(self) # wx.ListCtrl.__init__(self, *args, **kwargs)
# listmix.CheckListCtrlMixin.__init__(self)
self.Bind(wx.EVT_CHAR_HOOK, self.on_keydown) self.Bind(wx.EVT_CHAR_HOOK, self.on_keydown)
self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus) self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.on_focus)

View File

@ -32,6 +32,8 @@ class audioMenu(wx.Menu):
self.library = self.Append(wx.NewId(), _("&Add to library")) self.library = self.Append(wx.NewId(), _("&Add to library"))
self.move = self.Append(wx.NewId(), _("Move to album")) self.move = self.Append(wx.NewId(), _("Move to album"))
self.download = self.Append(wx.NewId(), _("Download")) 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): class peopleMenu(wx.Menu):
def __init__(self, is_request=False, is_subscriber=False, not_friend=False, *args, **kwargs): def __init__(self, is_request=False, is_subscriber=False, not_friend=False, *args, **kwargs):

View File

@ -31,12 +31,13 @@
## Application features ## Application features
* Spelling correction: * Spelling correction:
- Add words to dictionaries.
- allow users to set the spelling language - allow users to set the spelling language
- allow language switching within the spelling correction dialog - allow language switching within the spelling correction dialog
- integrate this feature in chat messages. - integrate this feature in chat messages.
* Translator: Integrate translation service in chat messages (for translating incoming and outgoing messages if necessary). * Translator: Integrate translation service in chat messages (for translating incoming and outgoing messages if necessary).
* timelines: persistent timelines saved in config. * 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. * 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. * video playback inside the application.
* Add fullscreen option to the photo viewer. * Add fullscreen option to the photo viewer.