Added more parameters to audio search feature
This commit is contained in:
parent
0acdf41fa3
commit
fb9717a00f
@ -17,6 +17,7 @@
|
||||
* In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A.
|
||||
* Now it is possible to remove friends directly from the friends buffer. There is a new option for this purpose in the context menu for the focused friend. After being removed, the person will be placed in the subscribers buffer.
|
||||
* Deleted posts will display an error message when trying to view details about those. Before, the dialog was created and left blank.
|
||||
* The audio search feature has received improvements: Now it is possible to indicate wether the search will be performed by title or artist, and select to sort the results by duration, popularity or date of addition to VK.
|
||||
|
||||
## Changes in version 0.18 (21.01.2019)
|
||||
|
||||
|
@ -259,7 +259,11 @@ class Controller(object):
|
||||
dlg = searchDialogs.searchAudioDialog()
|
||||
if dlg.get_response() == widgetUtils.OK:
|
||||
q = dlg.get("term")
|
||||
newbuff = buffers.audioBuffer(parent=self.window.tb, name="{0}_audiosearch".format(q,), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q)
|
||||
auto_complete = True
|
||||
count = 300
|
||||
performer_only = dlg.get_state("title")
|
||||
sort = dlg.get_sort_order()
|
||||
newbuff = buffers.audioBuffer(parent=self.window.tb, name="{0}_audiosearch".format(q,), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q, auto_complete=auto_complete, count=count, performer_only=performer_only, sort=sort)
|
||||
self.buffers.append(newbuff)
|
||||
call_threaded(newbuff.get_items)
|
||||
# Translators: {0} will be replaced with the search term.
|
||||
|
@ -16,6 +16,16 @@ class searchAudioDialog(widgetUtils.BaseDialog):
|
||||
self.term.SetSize(dc.GetTextExtent("0"*40))
|
||||
sizer.Add(label, 0, wx.ALL, 5)
|
||||
sizer.Add(self.term, 0, wx.ALL, 5)
|
||||
radioSizer = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Search by"))
|
||||
self.title = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Title"), style=wx.RB_GROUP)
|
||||
self.artist = wx.RadioButton(radioSizer.GetStaticBox(), wx.NewId(), _("Artist"))
|
||||
radioSizer.Add(self.title, 0, wx.ALL, 5)
|
||||
radioSizer.Add(self.artist, 0, wx.ALL, 5)
|
||||
sizer.Add(radioSizer, 0, wx.ALL, 5)
|
||||
sortBox = wx.StaticBoxSizer(parent=panel, orient=wx.HORIZONTAL, label=_("Sort by"))
|
||||
self.sortorder = wx.ComboBox(sortBox.GetStaticBox(), wx.NewId(), choices=[_("Date added"), _("Duration"), _("Popularity")], value=_("Popularity"), style=wx.CB_READONLY)
|
||||
sortBox.Add(self.sortorder, 0, wx.ALL, 5)
|
||||
sizer.Add(sortBox, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
|
||||
@ -26,6 +36,15 @@ class searchAudioDialog(widgetUtils.BaseDialog):
|
||||
panel.SetSizer(sizer)
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def get_state(self, control):
|
||||
if getattr(self, control).GetValue() == True:
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def get_sort_order(self):
|
||||
return self.sortorder.GetSelection()
|
||||
|
||||
class searchVideoDialog(widgetUtils.BaseDialog):
|
||||
def __init__(self, value=""):
|
||||
super(searchVideoDialog, self).__init__(None, -1)
|
||||
|
Loading…
Reference in New Issue
Block a user