Started recovering the search function

This commit is contained in:
Manuel Cortez 2018-12-11 18:02:49 -06:00
parent 65e253a538
commit cf4971a6c4
2 changed files with 1 additions and 33 deletions

View File

@ -254,12 +254,7 @@ class Controller(object):
dlg = searchDialogs.searchAudioDialog() dlg = searchDialogs.searchAudioDialog()
if dlg.get_response() == widgetUtils.OK: if dlg.get_response() == widgetUtils.OK:
q = dlg.get("term").encode("utf-8") q = dlg.get("term").encode("utf-8")
count = 300 newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q)
auto_complete = dlg.get_checkable("auto_complete")
lyrics = dlg.get_checkable("lyrics")
performer_only = dlg.get_checkable("artist_only")
sort = dlg.get_sort_order()
newbuff = buffers.audioBuffer(parent=self.window.tb, name=u"{0}_audiosearch".format(q.decode("utf-8"),), session=self.session, composefunc="render_audio", parent_endpoint="audio", endpoint="search", q=q, count=count, auto_complete=auto_complete, lyrics=lyrics, performer_only=performer_only, sort=sort)
self.buffers.append(newbuff) self.buffers.append(newbuff)
call_threaded(newbuff.get_items) call_threaded(newbuff.get_items)
# Translators: {0} will be replaced with the search term. # Translators: {0} will be replaced with the search term.

View File

@ -15,24 +15,6 @@ class searchAudioDialog(widgetUtils.BaseDialog):
self.term.SetSize(dc.GetTextExtent("0"*40)) self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5) sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5) sizer.Add(self.term, 0, wx.ALL, 5)
self.auto_complete = wx.CheckBox(panel, wx.NewId(), _(u"Try to &correct for mistakes in the search term"))
self.auto_complete.SetValue(True)
sizer.Add(self.auto_complete, 0, wx.ALL, 5)
self.lyrics = wx.CheckBox(panel, wx.NewId(), _(u"Search only songs with associated &lyrics"))
sizer.Add(self.lyrics, 0, wx.ALL, 5)
staticbox = wx.StaticBox(panel, label=_(u"Search by"))
self.artist_only = wx.RadioButton(panel, wx.NewId(), _(u"&Title"), style=wx.RB_GROUP)
self.audios = wx.RadioButton(panel, wx.NewId(), _(u"&artist"))
radioSizer = wx.StaticBoxSizer(staticbox, wx.HORIZONTAL)
radioSizer.Add(self.artist_only, 0, wx.ALL, 5)
radioSizer.Add(self.audios, 0, wx.ALL, 5)
sizer.Add(radioSizer, 0, wx.ALL, 5)
sort_order = wx.StaticText(panel, -1, _(U"&Sort order by: "))
self.sortorder = wx.ComboBox(panel, wx.NewId(), choices=[_(u"Date added"), _(u"Duration"), _(u"Popularity")], value=_(u"Popularity"), style=wx.CB_READONLY)
rBox = wx.BoxSizer(wx.HORIZONTAL)
rBox.Add(sort_order, 0, wx.ALL, 5)
rBox.Add(self.sortorder, 0, wx.ALL, 5)
sizer.Add(rBox, 0, wx.ALL, 5)
ok = wx.Button(panel, wx.ID_OK, _(u"&OK")) ok = wx.Button(panel, wx.ID_OK, _(u"&OK"))
ok.SetDefault() ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close")) cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Close"))
@ -43,15 +25,6 @@ class searchAudioDialog(widgetUtils.BaseDialog):
panel.SetSizer(sizer) panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin()) self.SetClientSize(sizer.CalcMin())
def get_checkable(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): class searchVideoDialog(widgetUtils.BaseDialog):
def __init__(self, value=""): def __init__(self, value=""):
super(searchVideoDialog, self).__init__(None, -1) super(searchVideoDialog, self).__init__(None, -1)