Fixed title for Trending topic buffers after a restart. Closes #421

This commit is contained in:
Manuel Cortez 2021-11-01 05:18:46 -06:00
parent ff0a2b5692
commit 84fa2fad91
No known key found for this signature in database
GPG Key ID: 262CC30FA01B5CBF
3 changed files with 9 additions and 5 deletions

View File

@ -4,8 +4,9 @@
## changes in this version ## changes in this version
* fixed a bug when clearing the direct messages buffer. ([#418](https://github.com/manuelcortez/TWBlue/issues/418))
* TWBlue should retrieve tweets from threads and conversations in a more reliable way. Tweets in the same thread (made by the same author) will be sorted correctly, although replies to the thread (made by different people) may not be ordered in the same way they are displayed in Twitter apps. ([#417](https://github.com/manuelcortez/TWBlue/issues/417)) * TWBlue should retrieve tweets from threads and conversations in a more reliable way. Tweets in the same thread (made by the same author) will be sorted correctly, although replies to the thread (made by different people) may not be ordered in the same way they are displayed in Twitter apps. ([#417](https://github.com/manuelcortez/TWBlue/issues/417))
* fixed a bug when clearing the direct messages buffer. ([#418](https://github.com/manuelcortez/TWBlue/issues/418))
* fixed an issue that was making TWBlue to show incorrectly titles for trending topic buffers upon startup. ([#421](https://github.com/manuelcortez/TWBlue/issues/421))
## Changes in Version 2021.10.30 ## Changes in Version 2021.10.30

View File

@ -49,6 +49,7 @@ class TrendsBuffer(base.Buffer):
log.exception("Error %s" % (str(err))) log.exception("Error %s" % (str(err)))
if not hasattr(self, "name_"): if not hasattr(self, "name_"):
self.name_ = data[0]["locations"][0]["name"] self.name_ = data[0]["locations"][0]["name"]
pub.sendMessage("buffer-title-changed", buffer=self)
self.trends = data[0]["trends"] self.trends = data[0]["trends"]
self.put_items_on_the_list() self.put_items_on_the_list()
if self.sound != None and self.session.settings["sound"]["session_mute"] == False and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and play_sound == True: if self.sound != None and self.session.settings["sound"]["session_mute"] == False and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and play_sound == True:

View File

@ -1581,14 +1581,16 @@ class Controller(object):
output.speak(_(u"{0} items retrieved").format(n,)) output.speak(_(u"{0} items retrieved").format(n,))
def buffer_title_changed(self, buffer): def buffer_title_changed(self, buffer):
if "-timeline" in buffer.name: if buffer.name.endswith("-timeline"):
title = _(u"Timeline for {}").format(buffer.username,) title = _(u"Timeline for {}").format(buffer.username,)
elif "-favorite" in buffer.name: elif buffer.name.endswith("-favorite"):
title = _(u"Likes for {}").format(buffer.username,) title = _(u"Likes for {}").format(buffer.username,)
elif "-followers" in buffer.name: elif buffer.name.endswith("-followers"):
title = _(u"Followers for {}").format(buffer.username,) title = _(u"Followers for {}").format(buffer.username,)
elif "-friends" in buffer.name: elif buffer.name.endswith("-friends"):
title = _(u"Friends for {}").format(buffer.username,) title = _(u"Friends for {}").format(buffer.username,)
elif buffer.name.endswith("_tt"):
title = _("Trending topics for %s") % (buffer.name_)
buffer_index = self.view.search(buffer.name, buffer.account) buffer_index = self.view.search(buffer.name, buffer.account)
self.view.set_page_title(buffer_index, title) self.view.set_page_title(buffer_index, title)