mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 19:28:09 -06:00
Open a search from the trending topics buffer is now possible
This commit is contained in:
parent
c7d007636e
commit
89e541be95
@ -50,10 +50,10 @@ class bufferController(object):
|
|||||||
event = None
|
event = None
|
||||||
ev.Skip()
|
ev.Skip()
|
||||||
if event != None:
|
if event != None:
|
||||||
# try:
|
try:
|
||||||
getattr(self, event)()
|
getattr(self, event)()
|
||||||
# except AttributeError:
|
except AttributeError:
|
||||||
#pass
|
pass
|
||||||
|
|
||||||
def volume_down(self):
|
def volume_down(self):
|
||||||
if self.session.settings["sound"]["volume"] > 0.0:
|
if self.session.settings["sound"]["volume"] > 0.0:
|
||||||
@ -689,3 +689,6 @@ class trendsBufferController(bufferController):
|
|||||||
return True
|
return True
|
||||||
elif dlg == widgetUtils.NO:
|
elif dlg == widgetUtils.NO:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def url(self, *args, **kwargs):
|
||||||
|
self.searchfunction(value=self.get_message())
|
@ -325,6 +325,7 @@ class Controller(object):
|
|||||||
for i in session.settings["other_buffers"]["trending_topic_buffers"]:
|
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 = buffersController.trendsBufferController(self.view.nb, "%s_tt" % (i,), session, session.db["user_name"], i)
|
||||||
buffer.start_stream()
|
buffer.start_stream()
|
||||||
|
buffer.searchfunction = self.search
|
||||||
self.buffers.append(buffer)
|
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"]))
|
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)
|
buffer.timer = RepeatingTimer(300, buffer.start_stream)
|
||||||
@ -363,10 +364,10 @@ class Controller(object):
|
|||||||
self.buffers.remove(buffer)
|
self.buffers.remove(buffer)
|
||||||
del 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."""
|
""" Searches words or users in twitter. This creates a new buffer containing the search results."""
|
||||||
log.debug("Creating a new search...")
|
log.debug("Creating a new search...")
|
||||||
dlg = dialogs.search.searchDialog()
|
dlg = dialogs.search.searchDialog(value)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
term = dlg.get("term")
|
term = dlg.get("term")
|
||||||
buffer = self.get_best_buffer()
|
buffer = self.get_best_buffer()
|
||||||
@ -662,15 +663,6 @@ class Controller(object):
|
|||||||
self.view.Show()
|
self.view.Show()
|
||||||
self.showing = True
|
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):
|
def get_trending_topics(self, *args, **kwargs):
|
||||||
buff = self.get_best_buffer()
|
buff = self.get_best_buffer()
|
||||||
trends = trendingTopics.trendingTopicsController(buff.session)
|
trends = trendingTopics.trendingTopicsController(buff.session)
|
||||||
@ -678,6 +670,7 @@ class Controller(object):
|
|||||||
woeid = trends.get_woeid()
|
woeid = trends.get_woeid()
|
||||||
if woeid in buff.session.settings["other_buffers"]["trending_topic_buffers"]: return
|
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 = buffersController.trendsBufferController(self.view.nb, "%s_tt" % (woeid,), buff.session, buff.account, woeid)
|
||||||
|
buffer.searchfunction = self.search
|
||||||
self.buffers.append(buffer)
|
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"]))
|
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()
|
buffer.start_stream()
|
||||||
@ -919,7 +912,8 @@ class Controller(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def url(self, *args, **kwargs):
|
def url(self, *args, **kwargs):
|
||||||
self.get_current_buffer().url()
|
buffer = self.get_current_buffer()
|
||||||
|
buffer.url()
|
||||||
|
|
||||||
def audio(self, *args, **kwargs):
|
def audio(self, *args, **kwargs):
|
||||||
self.get_current_buffer().audio()
|
self.get_current_buffer().audio()
|
||||||
|
@ -4,7 +4,8 @@ from arrow.locales import Locale
|
|||||||
|
|
||||||
def fix():
|
def fix():
|
||||||
''' This function adds the Catala, Basque and galician locales to the list of locales supported in Arrow.
|
''' 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.CatalaLocale = CatalaLocale
|
||||||
locales.GalicianLocale = GalicianLocale
|
locales.GalicianLocale = GalicianLocale
|
||||||
locales.BasqueLocale = BasqueLocale
|
locales.BasqueLocale = BasqueLocale
|
||||||
|
@ -3,13 +3,13 @@ import baseDialog
|
|||||||
import wx
|
import wx
|
||||||
|
|
||||||
class searchDialog(baseDialog.BaseWXDialog):
|
class searchDialog(baseDialog.BaseWXDialog):
|
||||||
def __init__(self):
|
def __init__(self, value=""):
|
||||||
super(searchDialog, self).__init__(None, -1)
|
super(searchDialog, self).__init__(None, -1)
|
||||||
panel = wx.Panel(self)
|
panel = wx.Panel(self)
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
self.SetTitle(_(u"Search on Twitter"))
|
self.SetTitle(_(u"Search on Twitter"))
|
||||||
label = wx.StaticText(panel, -1, _(u"Search"))
|
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 = wx.WindowDC(self.term)
|
||||||
dc.SetFont(self.term.GetFont())
|
dc.SetFont(self.term.GetFont())
|
||||||
self.term.SetSize(dc.GetTextExtent("0"*40))
|
self.term.SetSize(dc.GetTextExtent("0"*40))
|
||||||
|
Loading…
Reference in New Issue
Block a user