Added select/unselect all option in menu for audio buffers

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

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.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."""

View File

@@ -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]

View File

@@ -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)

View File

@@ -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):