Added setting to hide emojis in usernames

This commit is contained in:
Manuel Cortez 2022-05-13 13:04:12 -05:00
parent 20ad268e5a
commit ab979e2623
No known key found for this signature in database
GPG Key ID: 9E0735CA15EFE790
6 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,11 @@
TWBlue Changelog TWBlue Changelog
## changes in this version ## changes in this version
* Fixed an issue that was making TWBlue to display incorrectly some retweets of quoted tweets.
* Implemented a new setting, available in the account settings dialog, that allows to hide emojis in twitter usernames.
## changes in version 22.2.23
* We have added Experimental support for templates in the invisible interface. The GUI will remain unchanged for now: * We have added Experimental support for templates in the invisible interface. The GUI will remain unchanged for now:
* Each object (tweet, received direct message, sent direct message and people) has its own template in the settings. You can edit those templates from the account settings dialog, in the new "templates" tab. * Each object (tweet, received direct message, sent direct message and people) has its own template in the settings. You can edit those templates from the account settings dialog, in the new "templates" tab.
* Every template is composed of the group of variables you want to display for each object. Each variable will start with a dollar sign ($) and cannot contain spaces or special characters. Templates can include arbitrary text that will not be processed. When editing the example templates, you can get an idea of the variables that are available for each object by using the template editing dialog. When you press enter on a variable from the list of available variables, it will be added to the template automatically. When you try to save a template, TWBlue will warn you if the template is incorrectly formatted or if it includes variables that do not exist in the information provided by objects. It is also possible to return to default values from the same dialog when editing a template. * Every template is composed of the group of variables you want to display for each object. Each variable will start with a dollar sign ($) and cannot contain spaces or special characters. Templates can include arbitrary text that will not be processed. When editing the example templates, you can get an idea of the variables that are available for each object by using the template editing dialog. When you press enter on a variable from the list of available variables, it will be added to the template automatically. When you try to save a template, TWBlue will warn you if the template is incorrectly formatted or if it includes variables that do not exist in the information provided by objects. It is also possible to return to default values from the same dialog when editing a template.

View File

@ -48,6 +48,7 @@ importlib-metadata
numpy numpy
pillow pillow
charset-normalizer charset-normalizer
demoji
git+https://github.com/accessibleapps/libloader git+https://github.com/accessibleapps/libloader
git+https://github.com/accessibleapps/platform_utils git+https://github.com/accessibleapps/platform_utils
git+https://github.com/accessibleapps/accessible_output2 git+https://github.com/accessibleapps/accessible_output2

View File

@ -14,6 +14,7 @@ retweet_mode = string(default="ask")
persist_size = integer(default=0) persist_size = integer(default=0)
load_cache_in_memory=boolean(default=True) load_cache_in_memory=boolean(default=True)
show_screen_names = boolean(default=False) show_screen_names = boolean(default=False)
hide_emojis = boolean(default=False)
buffer_order = list(default=list('home','mentions', 'dm', 'sent_dm', 'sent_tweets','favorites','followers','friends','blocks','muted')) buffer_order = list(default=list('home','mentions', 'dm', 'sent_dm', 'sent_tweets','favorites','followers','friends','blocks','muted'))
[sound] [sound]

View File

@ -145,6 +145,7 @@ class accountSettingsController(globalSettingsController):
widgetUtils.connect_event(self.dialog.general.au, widgetUtils.BUTTON_PRESSED, self.manage_autocomplete) widgetUtils.connect_event(self.dialog.general.au, widgetUtils.BUTTON_PRESSED, self.manage_autocomplete)
self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"]) self.dialog.set_value("general", "relative_time", self.config["general"]["relative_times"])
self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"]) self.dialog.set_value("general", "show_screen_names", self.config["general"]["show_screen_names"])
self.dialog.set_value("general", "hide_emojis", self.config["general"]["hide_emojis"])
self.dialog.set_value("general", "itemsPerApiCall", self.config["general"]["max_tweets_per_call"]) self.dialog.set_value("general", "itemsPerApiCall", self.config["general"]["max_tweets_per_call"])
self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"]) self.dialog.set_value("general", "reverse_timelines", self.config["general"]["reverse_timelines"])
rt = self.config["general"]["retweet_mode"] rt = self.config["general"]["retweet_mode"]
@ -242,6 +243,7 @@ class accountSettingsController(globalSettingsController):
log.debug("Triggered app restart due to change in relative times.") log.debug("Triggered app restart due to change in relative times.")
self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time") self.config["general"]["relative_times"] = self.dialog.get_value("general", "relative_time")
self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names") self.config["general"]["show_screen_names"] = self.dialog.get_value("general", "show_screen_names")
self.config["general"]["hide_emojis"] = self.dialog.get_value("general", "hide_emojis")
self.config["general"]["max_tweets_per_call"] = self.dialog.get_value("general", "itemsPerApiCall") self.config["general"]["max_tweets_per_call"] = self.dialog.get_value("general", "itemsPerApiCall")
if self.config["general"]["load_cache_in_memory"] != self.dialog.get_value("general", "load_cache_in_memory"): if self.config["general"]["load_cache_in_memory"] != self.dialog.get_value("general", "load_cache_in_memory"):
self.config["general"]["load_cache_in_memory"] = self.dialog.get_value("general", "load_cache_in_memory") self.config["general"]["load_cache_in_memory"] = self.dialog.get_value("general", "load_cache_in_memory")

View File

@ -5,6 +5,7 @@ import time
import logging import logging
import webbrowser import webbrowser
import wx import wx
import demoji
import config import config
import output import output
import application import application
@ -472,11 +473,16 @@ class Session(base.baseSession):
aliases = self.settings.get("user-aliases") aliases = self.settings.get("user-aliases")
if aliases == None: if aliases == None:
log.error("Aliases are not defined for this config spec.") log.error("Aliases are not defined for this config spec.")
return user.name return self.demoji_user(user.name)
user_alias = aliases.get(user.id_str) user_alias = aliases.get(user.id_str)
if user_alias != None: if user_alias != None:
return user_alias return user_alias
return user.name return self.demoji_user(user.name)
def demoji_user(self, name):
if self.settings["general"]["hide_emojis"] == True:
return demoji.replace(name, "")
return name
def get_user_by_screen_name(self, screen_name): def get_user_by_screen_name(self, screen_name):
""" Returns an user identifier associated with a screen_name. """ Returns an user identifier associated with a screen_name.

View File

@ -120,6 +120,8 @@ class generalAccount(wx.Panel, baseDialog.BaseWXDialog):
sizer.Add(rMode, 0, wx.ALL, 5) sizer.Add(rMode, 0, wx.ALL, 5)
self.show_screen_names = wx.CheckBox(self, wx.ID_ANY, _(U"Show screen names instead of full names")) self.show_screen_names = wx.CheckBox(self, wx.ID_ANY, _(U"Show screen names instead of full names"))
sizer.Add(self.show_screen_names, 0, wx.ALL, 5) sizer.Add(self.show_screen_names, 0, wx.ALL, 5)
self.hide_emojis = wx.CheckBox(self, wx.ID_ANY, _("hide emojis in usernames"))
sizer.Add(self.hide_emojis, 0, wx.ALL, 5)
PersistSizeLabel = wx.StaticText(self, -1, _(u"Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)")) PersistSizeLabel = wx.StaticText(self, -1, _(u"Number of items per buffer to cache in database (0 to disable caching, blank for unlimited)"))
self.persist_size = wx.TextCtrl(self, -1) self.persist_size = wx.TextCtrl(self, -1)
sizer.Add(PersistSizeLabel, 0, wx.ALL, 5) sizer.Add(PersistSizeLabel, 0, wx.ALL, 5)