Philipp Hörist pushed to branch master at gajim / gajim
Commits:
b6e7f5c6 by Daniel Brötzmann at 2019-03-25T20:00:40Z
Format OMEMO fingerprint in tooltip
- - - - -
2 changed files:
- gajim/conversation_textview.py
- gajim/gtk/util.py
Changes:
=====================================
gajim/conversation_textview.py
=====================================
@@ -49,6 +49,7 @@ from gajim.common.const import StyleAttr, Trust
from gajim.gtk import util
from gajim.gtk.util import load_icon
from gajim.gtk.util import get_cursor
+from gajim.gtk.util import format_fingerprint
from gajim.gtk.emoji_data import emoji_pixbufs
from gajim.gtk.emoji_data import is_emoji
from gajim.gtk.emoji_data import get_emoji_pixbuf
@@ -1159,7 +1160,8 @@ class ConversationTextview(GObject.GObject):
icon, trust_tooltip, color = TRUST_SYMBOL_DATA[trust]
tooltip = tooltip + '\n' + trust_tooltip
if fingerprint is not None:
- tooltip = tooltip + ' (' + fingerprint + ')'
+ fingerprint = format_fingerprint(fingerprint)
+ tooltip = tooltip + '\n' + fingerprint
temp_mark = self._buffer.create_mark(None, iter_, True)
self._buffer.insert(iter_, ' ')
=====================================
gajim/gtk/util.py
=====================================
@@ -23,6 +23,7 @@ from typing import Optional
import os
import sys
import logging
+import textwrap
import xml.etree.ElementTree as ET
from pathlib import Path
from functools import wraps
@@ -578,3 +579,13 @@ def format_location(location):
'tag': tag.capitalize(), 'text': text}
return location_string.strip()
+
+
+def format_fingerprint(fingerprint):
+ fplen = len(fingerprint)
+ wordsize = fplen // 8
+ buf = ''
+ for w in range(0, fplen, wordsize):
+ buf += '{0} '.format(fingerprint[w:w + wordsize])
+ buf = textwrap.fill(buf, width=36)
+ return buf.rstrip().upper()
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/b6e7f5c6d2ecfa6be6044e2bec58ed93fe726401
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/b6e7f5c6d2ecfa6be6044e2bec58ed93fe726401
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits