Open a search from the trending topics buffer is now possible

This commit is contained in:
Manuel Cortez 2015-03-17 12:24:29 -06:00
parent c7d007636e
commit 89e541be95
4 changed files with 18 additions and 20 deletions

View File

@ -50,10 +50,10 @@ class bufferController(object):
event = None
ev.Skip()
if event != None:
# try:
getattr(self, event)()
# except AttributeError:
#pass
try:
getattr(self, event)()
except AttributeError:
pass
def volume_down(self):
if self.session.settings["sound"]["volume"] > 0.0:
@ -688,4 +688,7 @@ class trendsBufferController(bufferController):
self.timer.cancel()
return True
elif dlg == widgetUtils.NO:
return False
return False
def url(self, *args, **kwargs):
self.searchfunction(value=self.get_message())

View File

@ -325,6 +325,7 @@ class Controller(object):
for i in session.settings["other_buffers"]["trending_topic_buffers"]:
buffer = buffersController.trendsBufferController(self.view.nb, "%s_tt" % (i,), session, session.db["user_name"], i)
buffer.start_stream()
buffer.searchfunction = self.search
self.buffers.append(buffer)
self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (buffer.name_), pos=self.view.search(session.db["user_name"], session.db["user_name"]))
buffer.timer = RepeatingTimer(300, buffer.start_stream)
@ -363,10 +364,10 @@ class Controller(object):
self.buffers.remove(buffer)
del buffer
def search(self, *args, **kwargs):
def search(self, value="", *args, **kwargs):
""" Searches words or users in twitter. This creates a new buffer containing the search results."""
log.debug("Creating a new search...")
dlg = dialogs.search.searchDialog()
dlg = dialogs.search.searchDialog(value)
if dlg.get_response() == widgetUtils.OK:
term = dlg.get("term")
buffer = self.get_best_buffer()
@ -662,15 +663,6 @@ class Controller(object):
self.view.Show()
self.showing = True
def toggle_global_mute(self):
pass
def toggle_mute(self):
pass
def toggle_autoread(self):
pass
def get_trending_topics(self, *args, **kwargs):
buff = self.get_best_buffer()
trends = trendingTopics.trendingTopicsController(buff.session)
@ -678,6 +670,7 @@ class Controller(object):
woeid = trends.get_woeid()
if woeid in buff.session.settings["other_buffers"]["trending_topic_buffers"]: return
buffer = buffersController.trendsBufferController(self.view.nb, "%s_tt" % (woeid,), buff.session, buff.account, woeid)
buffer.searchfunction = self.search
self.buffers.append(buffer)
self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (trends.get_string()), pos=self.view.search(buff.session.db["user_name"], buff.session.db["user_name"]))
buffer.start_stream()
@ -919,7 +912,8 @@ class Controller(object):
pass
def url(self, *args, **kwargs):
self.get_current_buffer().url()
buffer = self.get_current_buffer()
buffer.url()
def audio(self, *args, **kwargs):
self.get_current_buffer().audio()

View File

@ -4,7 +4,8 @@ from arrow.locales import Locale
def fix():
''' This function adds the Catala, Basque and galician locales to the list of locales supported in Arrow.
it also fixes capitalizations in names from turkish and arabian locales.'''
it also fixes capitalizations in names from turkish and arabian locales.
see https://github.com/crsmithdev/arrow/pull/207 for following the pull request.'''
locales.CatalaLocale = CatalaLocale
locales.GalicianLocale = GalicianLocale
locales.BasqueLocale = BasqueLocale

View File

@ -3,13 +3,13 @@ import baseDialog
import wx
class searchDialog(baseDialog.BaseWXDialog):
def __init__(self):
def __init__(self, value=""):
super(searchDialog, self).__init__(None, -1)
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
self.SetTitle(_(u"Search on Twitter"))
label = wx.StaticText(panel, -1, _(u"Search"))
self.term = wx.TextCtrl(panel, -1,)
self.term = wx.TextCtrl(panel, -1, value)
dc = wx.WindowDC(self.term)
dc.SetFont(self.term.GetFont())
self.term.SetSize(dc.GetTextExtent("0"*40))