Files
socializer/src/wxUI/dialogs/search.py

90 lines
3.4 KiB
Python
Raw Normal View History

2016-03-23 13:52:43 -06:00
# -*- coding: utf-8 -*-
2019-01-02 04:42:53 +03:00
from __future__ import unicode_literals
2016-03-23 13:52:43 -06:00
import widgetUtils
import wx
class searchAudioDialog(widgetUtils.BaseDialog):
def __init__(self, value=""):
super(searchAudioDialog, self).__init__(None, -1)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
2019-01-02 04:42:53 +03:00
self.SetTitle(_("audio Search"))
label = wx.StaticText(panel, -1, _("&Search"))
2016-03-23 13:52:43 -06:00
self.term = wx.TextCtrl(panel, -1, value)
dc = wx.WindowDC(self.term)
dc.SetFont(self.term.GetFont())
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)
2019-01-02 04:42:53 +03:00
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
2016-03-23 13:52:43 -06:00
ok.SetDefault()
2019-01-02 04:42:53 +03:00
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
2016-03-23 13:52:43 -06:00
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
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()
2016-08-15 17:00:49 -05:00
class searchVideoDialog(widgetUtils.BaseDialog):
def __init__(self, value=""):
super(searchVideoDialog, self).__init__(None, -1)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
2019-01-02 04:42:53 +03:00
self.SetTitle(_("video Search"))
label = wx.StaticText(panel, -1, _("&Search"))
2016-08-15 17:00:49 -05:00
self.term = wx.TextCtrl(panel, -1, value)
dc = wx.WindowDC(self.term)
dc.SetFont(self.term.GetFont())
self.term.SetSize(dc.GetTextExtent("0"*40))
sizer.Add(label, 0, wx.ALL, 5)
sizer.Add(self.term, 0, wx.ALL, 5)
2019-01-02 04:42:53 +03:00
sort_order = wx.StaticText(panel, -1, _("&Sort order by: "))
self.sortorder = wx.ComboBox(panel, wx.NewId(), choices=[_("Date added"), _("Duration"), _("Popularity")], value=_("Popularity"), style=wx.CB_READONLY)
2016-08-15 17:00:49 -05:00
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)
2019-01-02 04:42:53 +03:00
self.hd = wx.CheckBox(panel, wx.NewId(), _("Search only for videos in &High definition"))
2016-08-15 17:00:49 -05:00
self.hd.SetValue(False)
sizer.Add(self.hd, 0, wx.ALL, 5)
2019-01-02 04:42:53 +03:00
self.safe_search = wx.CheckBox(panel, wx.NewId(), _("S&afe search"))
2016-08-15 17:00:49 -05:00
self.safe_search.SetValue(True)
sizer.Add(self.safe_search, 0, wx.ALL, 5)
2019-01-02 04:42:53 +03:00
ok = wx.Button(panel, wx.ID_OK, _("&OK"))
2016-08-15 17:00:49 -05:00
ok.SetDefault()
2019-01-02 04:42:53 +03:00
cancel = wx.Button(panel, wx.ID_CANCEL, _("&Close"))
2016-08-15 17:00:49 -05:00
btnsizer = wx.BoxSizer()
btnsizer.Add(ok, 0, wx.ALL, 5)
btnsizer.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnsizer, 0, wx.ALL, 5)
panel.SetSizer(sizer)
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()