fixes after revert. identicons update

This commit is contained in:
ingvar1995 2018-07-05 00:26:05 +03:00
parent e8193afedf
commit d09609a5e5
3 changed files with 7 additions and 3 deletions

View file

@ -299,7 +299,7 @@ class App:
self._app.exec_() self._app.exec_()
if p.result is not None: if p.result is not None:
return p.result return p.result
raise SystemExit() self._force_exit()
def _reset(self): def _reset(self):
""" """
@ -380,6 +380,9 @@ class App:
def _create_tox(self, data): def _create_tox(self, data):
return tox_factory(data, self._settings) return tox_factory(data, self._settings)
def _force_exit(self):
raise SystemExit()
def _init_callbacks(self): def _init_callbacks(self):
callbacks.init_callbacks(self._tox, self._profile, self._settings, self._plugin_loader, self._contacts_manager, 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, self._calls_manager, self._file_transfer_handler, self._ms, self._tray,

View file

@ -1,4 +1,5 @@
from pydenticon import Generator from pydenticon import Generator
import hashlib
class BaseTypingNotificationHandler: class BaseTypingNotificationHandler:
@ -34,6 +35,7 @@ def generate_avatar(public_key):
'rgb(49,203,115)', 'rgb(49,203,115)',
'rgb(141,69,170)'] 'rgb(141,69,170)']
generator = Generator(5, 5, foreground=foreground, background='rgba(42,42,42,0)') 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 return identicon

View file

@ -347,5 +347,4 @@ class ReceiveAvatar(ReceiveTransfer):
chdir(dirname(avatar_path)) chdir(dirname(avatar_path))
remove(avatar_path) remove(avatar_path)
rename(self._path, avatar_path) rename(self._path, avatar_path)
self._finished()
super().write_chunk(position, data) super().write_chunk(position, data)