From d09609a5e5a2254f82ab4077cbc9e9feccc9ea0d Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Thu, 5 Jul 2018 00:26:05 +0300 Subject: [PATCH] fixes after revert. identicons update --- toxygen/app.py | 5 ++++- toxygen/contacts/common.py | 4 +++- toxygen/file_transfers/file_transfers.py | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/toxygen/app.py b/toxygen/app.py index 3d20389..3f66e2c 100644 --- a/toxygen/app.py +++ b/toxygen/app.py @@ -299,7 +299,7 @@ class App: self._app.exec_() if p.result is not None: return p.result - raise SystemExit() + self._force_exit() def _reset(self): """ @@ -380,6 +380,9 @@ class App: def _create_tox(self, data): return tox_factory(data, self._settings) + def _force_exit(self): + raise SystemExit() + def _init_callbacks(self): callbacks.init_callbacks(self._tox, self._profile, self._settings, self._plugin_loader, self._contacts_manager, self._calls_manager, self._file_transfer_handler, self._ms, self._tray, diff --git a/toxygen/contacts/common.py b/toxygen/contacts/common.py index 4dc25e8..ba5dac6 100644 --- a/toxygen/contacts/common.py +++ b/toxygen/contacts/common.py @@ -1,4 +1,5 @@ from pydenticon import Generator +import hashlib class BaseTypingNotificationHandler: @@ -34,6 +35,7 @@ def generate_avatar(public_key): 'rgb(49,203,115)', 'rgb(141,69,170)'] generator = Generator(5, 5, foreground=foreground, background='rgba(42,42,42,0)') - identicon = generator.generate(public_key, 220, 220, padding=(10, 10, 10, 10)) + digest = hashlib.sha256(public_key.encode('utf-8')).hexdigest() + identicon = generator.generate(digest, 220, 220, padding=(10, 10, 10, 10)) return identicon diff --git a/toxygen/file_transfers/file_transfers.py b/toxygen/file_transfers/file_transfers.py index c2d1168..46a777f 100644 --- a/toxygen/file_transfers/file_transfers.py +++ b/toxygen/file_transfers/file_transfers.py @@ -347,5 +347,4 @@ class ReceiveAvatar(ReceiveTransfer): chdir(dirname(avatar_path)) remove(avatar_path) rename(self._path, avatar_path) - self._finished() super().write_chunk(position, data)