Trending topics improvements

This commit is contained in:
Manuel Cortez 2014-12-05 17:05:29 -06:00
parent a13536233e
commit f2fab29cb7
3 changed files with 20 additions and 17 deletions

View File

@ -91,3 +91,4 @@ view_user_lists = string(default="control+win+l")
get_more_items = string(default="alt+win+pageup")
reverse_geocode = string(default="control+win+g")
view_reverse_geocode = string(default="control+win+shift+g")
get_trending_topics = string(default="control+win+t")

View File

@ -85,8 +85,11 @@ class trendsPanel(wx.Panel):
def start_streams(self):
data = self.twitter.twitter.get_place_trends(id=self.argumento)
if not hasattr(self, "name"):
self.name = data[0]["locations"][0]["name"]
self.trends = data[0]["trends"]
sound.player.play(self.sound)
# We need to get the trends sound, so the next line is commented.
# sound.player.play(self.sound)
return len(self.trends)
def get_more_items(self):
@ -94,20 +97,11 @@ class trendsPanel(wx.Panel):
def put_items(self, num):
selected_item = self.list.get_selected()
if self.list.get_count() == 0:
for i in self.trends:
tweet = self.compose_function(i)
self.list.insert_item(False, *tweet)
self.list.clear()
for i in self.trends:
tweet = self.compose_function(i)
self.list.insert_item(False, *tweet)
self.set_list_position()
elif self.list.get_count() > 0:
if config.main["general"]["reverse_timelines"] == False:
for i in self.trends:
tweet = self.compose_function(i)
self.list.insert_item(False, *tweet)
else:
for i in self.trends:
tweet = self.compose_function(i)
self.list.insert_item(True, *tweet)
self.list.select_item(selected_item)
def post_status(self, ev=None):

View File

@ -319,6 +319,13 @@ class mainFrame(wx.Frame):
self.db.settings["buffers"].append(i+"favs")
self.fav_stream = RepeatingTimer(180, self.get_fav_buffers)
self.fav_stream.start()
for i in config.main["other_buffers"]["trending_topic_buffers"]:
buff = buffers.trendsPanel(self.nb, self, "%s_tt" % (i,), argumento=i, sound="trendd_updated.ogg")
timer = RepeatingTimer(300, buff.start_streams)
timer.start()
num = buff.start_streams()
buff.put_items(num)
self.nb.InsertSubPage(self.db.settings["buffers"].index(self.db.settings["user_name"]), buff, _(u"Trending topics for %s") % (buff.name,))
self.sizer.Add(self.nb, 0, wx.ALL, 5)
panel.SetSizer(self.sizer)
self.SetClientSize(self.sizer.CalcMin())
@ -1026,11 +1033,12 @@ class mainFrame(wx.Frame):
woeid = trendingDialog.countries[trendingDialog.location.GetStringSelection()]
elif trendingDialog.city.GetValue() == True:
woeid = trendingDialog.cities[trendingDialog.location.GetStringSelection()]
buff = buffers.trendsPanel(self.nb, self, "%s_tt" % (woeid,), argumento=woeid, sound="tweet_timeline.ogg")
buff = buffers.trendsPanel(self.nb, self, "%s_tt" % (woeid,), argumento=woeid, sound="trend_updated.ogg")
self.nb.InsertSubPage(self.db.settings["buffers"].index(self.db.settings["user_name"]), buff, _(u"Trending topics for %s") % (trendingDialog.location.GetStringSelection(),))
timer = RepeatingTimer(180, buff.start_streams)
timer = RepeatingTimer(300, buff.start_streams)
timer.start()
num = buff.start_streams()
config.main["other_buffers"]["trending_topic_buffers"].append(woeid)
buff.put_items(num)
### Close App