mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-12-03 07:53:13 -06:00
Improvements in the tweets' searched
This commit is contained in:
parent
2bfb53abe1
commit
65c353450e
@ -428,7 +428,8 @@ class Controller(object):
|
||||
if dlg.get("tweets") == True:
|
||||
if term not in buffer.session.settings["other_buffers"]["tweet_searches"]:
|
||||
buffer.session.settings["other_buffers"]["tweet_searches"].append(term)
|
||||
search = buffersController.searchBufferController(self.view.nb, "search", "%s-searchterm" % (term,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", q=term, count=buffer.session.settings["general"]["max_tweets_per_call"])
|
||||
args = {"lang": dlg.get_language(), "result_type": dlg.get_result_type()}
|
||||
search = buffersController.searchBufferController(self.view.nb, "search", "%s-searchterm" % (term,), buffer.session, buffer.session.db["user_name"], bufferType="searchPanel", q=term, count=buffer.session.settings["general"]["max_tweets_per_call"], **args)
|
||||
else:
|
||||
log.error("A buffer for the %s search term is already created. You can't create a duplicate buffer." % (term,))
|
||||
return
|
||||
|
@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import widgetUtils
|
||||
import baseDialog
|
||||
import wx
|
||||
from extra import translator
|
||||
|
||||
class searchDialog(baseDialog.BaseWXDialog):
|
||||
def __init__(self, value=""):
|
||||
@ -17,10 +19,24 @@ class searchDialog(baseDialog.BaseWXDialog):
|
||||
sizer.Add(self.term, 0, wx.ALL, 5)
|
||||
self.tweets = wx.RadioButton(panel, -1, _(u"Tweets"), style=wx.RB_GROUP)
|
||||
self.users = wx.RadioButton(panel, -1, _(u"Users"))
|
||||
widgetUtils.connect_event(self.tweets, widgetUtils.RADIOBUTTON, self.show_advanced_search)
|
||||
widgetUtils.connect_event(self.users, widgetUtils.RADIOBUTTON, self.hide_advanced_search)
|
||||
radioSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
radioSizer.Add(self.tweets, 0, wx.ALL, 5)
|
||||
radioSizer.Add(self.users, 0, wx.ALL, 5)
|
||||
sizer.Add(radioSizer, 0, wx.ALL, 5)
|
||||
lang = wx.StaticText(panel, -1, _(u"Language for results: "))
|
||||
self.lang = wx.ComboBox(panel, -1, choices=[x[1] for x in translator.translator.available_languages()], style = wx.CB_READONLY)
|
||||
langBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
langBox.Add(lang, 0, wx.ALL, 5)
|
||||
langBox.Add(self.lang, 0, wx.ALL, 5)
|
||||
sizer.Add(langBox, 0, wx.ALL, 5)
|
||||
resulttype = wx.StaticText(panel, -1, _(U"Results type: "))
|
||||
self.resultstype = wx.ComboBox(panel, -1, choices=[_(u"Mixed"), _(u"Recent"), _(u"Popular")], value=_(u"Mixed"), style=wx.CB_READONLY)
|
||||
rBox = wx.BoxSizer(wx.HORIZONTAL)
|
||||
rBox.Add(resulttype, 0, wx.ALL, 5)
|
||||
rBox.Add(self.resultstype, 0, wx.ALL, 5)
|
||||
sizer.Add(rBox, 0, wx.ALL, 5)
|
||||
ok = wx.Button(panel, wx.ID_OK, _(u"OK"))
|
||||
ok.SetDefault()
|
||||
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Close"))
|
||||
@ -30,3 +46,20 @@ class searchDialog(baseDialog.BaseWXDialog):
|
||||
sizer.Add(btnsizer, 0, wx.ALL, 5)
|
||||
panel.SetSizer(sizer)
|
||||
self.SetClientSize(sizer.CalcMin())
|
||||
|
||||
def get_language(self):
|
||||
return [x[0] for x in translator.translator.available_languages()][self.lang.GetSelection()]
|
||||
|
||||
def get_result_type(self):
|
||||
r = self.resultstype.GetValue()
|
||||
if r == _(u"Mixed"): return "mixed"
|
||||
elif r == _(u"Recent"): return "recent"
|
||||
elif r == _(u"Popular"): return "popular"
|
||||
|
||||
def hide_advanced_search(self, *args, **kwargs):
|
||||
self.lang.Hide()
|
||||
self.resultstype.Hide()
|
||||
|
||||
def show_advanced_search(self, *args, **kwargs):
|
||||
self.lang.Show()
|
||||
self.resultstype.Show()
|
||||
|
Loading…
Reference in New Issue
Block a user