Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <forenjunkie@chello.at>2017-09-16 00:22:21 +0300
committerPhilipp Hörist <forenjunkie@chello.at>2017-09-16 00:22:47 +0300
commit41b977b91491b9acdb672cebc81081aa4be74148 (patch)
treeca466aebf3503d696ae97bcca1f63f4cadadddca
parent5c0538a202d3750686bd50d8d66c84637c28ec3b (diff)
Add option to disable ascii emoticons
-rw-r--r--gajim/common/config.py1
-rw-r--r--gajim/emoticons.py8
-rw-r--r--gajim/gui_interface.py3
3 files changed, 10 insertions, 2 deletions
diff --git a/gajim/common/config.py b/gajim/common/config.py
index 6fbf8570d..4b5f05ae6 100644
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -124,6 +124,7 @@ class Config:
'print_time': [ opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [ opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable fuzzyclock. 1 is the most precise clock, 4 the least precise one. This is used only if print_time is \'sometimes\'.') ],
'emoticons_theme': [opt_str, 'noto-emoticons', '', True ],
+ 'ascii_emoticons': [opt_bool, True, _('Enable ASCII emoticons'), True],
'ascii_formatting': [ opt_bool, True,
_('Treat * / _ pairs as possible formatting characters.'), True],
'show_ascii_formatting_chars': [ opt_bool, True, _('If True, do not '
diff --git a/gajim/emoticons.py b/gajim/emoticons.py
index f37142494..3d086c1e0 100644
--- a/gajim/emoticons.py
+++ b/gajim/emoticons.py
@@ -59,7 +59,7 @@ class SubPixbuf:
return subpixbuf
-def load(path):
+def load(path, ascii_emoticons):
module_name = 'emoticons_theme.py'
theme_path = os.path.join(path, module_name)
if sys.platform == 'win32' and not os.path.exists(theme_path):
@@ -87,6 +87,12 @@ def load(path):
def add_emoticon(codepoint_, sub, mod_list=None):
pix = sub.get_pixbuf()
for alternate in codepoint_:
+ if not ascii_emoticons:
+ try:
+ alternate.encode('ascii')
+ continue
+ except UnicodeEncodeError:
+ pass
codepoints[alternate] = pix
if pix not in pixbufs:
pixbufs[pix] = alternate
diff --git a/gajim/gui_interface.py b/gajim/gui_interface.py
index dbe4f2d55..60331e942 100644
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -1925,6 +1925,7 @@ class Interface:
def init_emoticons(self):
emot_theme = app.config.get('emoticons_theme')
+ ascii_emoticons = app.config.get('ascii_emoticons')
if not emot_theme:
return
@@ -1944,7 +1945,7 @@ class Interface:
transient_for=transient_for)
app.config.set('emoticons_theme', '')
return
- if not emoticons.load(path):
+ if not emoticons.load(path, ascii_emoticons):
dialogs.WarningDialog(
_('Emoticons disabled'),
_('Your configured emoticons theme could not be loaded.'