fixes after revert
This commit is contained in:
parent
bc48537209
commit
e8193afedf
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,3 +24,5 @@ html
|
|||||||
Toxygen.egg-info
|
Toxygen.egg-info
|
||||||
*.tox
|
*.tox
|
||||||
.cache
|
.cache
|
||||||
|
*.db
|
||||||
|
|
||||||
|
@ -25,15 +25,15 @@ class FriendTypingNotificationHandler(BaseTypingNotificationHandler):
|
|||||||
BaseTypingNotificationHandler.DEFAULT_HANDLER = BaseTypingNotificationHandler()
|
BaseTypingNotificationHandler.DEFAULT_HANDLER = BaseTypingNotificationHandler()
|
||||||
|
|
||||||
|
|
||||||
def generate_avatar(tox_id):
|
def generate_avatar(public_key):
|
||||||
foreground = ["rgb(45,79,255)",
|
foreground = ['rgb(45,79,255)', 'rgb(185, 66, 244)', 'rgb(185, 66, 244)',
|
||||||
"rgb(254,180,44)",
|
'rgb(254,180,44)', 'rgb(252, 2, 2)', 'rgb(109, 198, 0)',
|
||||||
"rgb(226,121,234)",
|
'rgb(226,121,234)', 'rgb(130, 135, 124)',
|
||||||
"rgb(30,179,253)",
|
'rgb(30,179,253)', 'rgb(160, 157, 0)',
|
||||||
"rgb(232,77,65)",
|
'rgb(232,77,65)', 'rgb(102, 4, 4)',
|
||||||
"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(tox_id, 220, 220, padding=(10, 10, 10, 10))
|
identicon = generator.generate(public_key, 220, 220, padding=(10, 10, 10, 10))
|
||||||
|
|
||||||
return identicon
|
return identicon
|
||||||
|
@ -50,9 +50,6 @@ class FileTransfer:
|
|||||||
self._finished_event = Event()
|
self._finished_event = Event()
|
||||||
self._file_id = self._file = None
|
self._file_id = self._file = None
|
||||||
|
|
||||||
def set_tox(self, tox):
|
|
||||||
self._tox = tox
|
|
||||||
|
|
||||||
def set_state_changed_handler(self, handler):
|
def set_state_changed_handler(self, handler):
|
||||||
self._state_changed_event += handler
|
self._state_changed_event += handler
|
||||||
|
|
||||||
@ -344,11 +341,11 @@ class ReceiveAvatar(ReceiveTransfer):
|
|||||||
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
self.send_control(TOX_FILE_CONTROL['RESUME'])
|
||||||
|
|
||||||
def write_chunk(self, position, data):
|
def write_chunk(self, position, data):
|
||||||
super().write_chunk(position, data)
|
if data is None:
|
||||||
if self.state:
|
|
||||||
avatar_path = self._path[:-4]
|
avatar_path = self._path[:-4]
|
||||||
if exists(avatar_path):
|
if exists(avatar_path):
|
||||||
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()
|
self._finished()
|
||||||
|
super().write_chunk(position, data)
|
||||||
|
@ -13,7 +13,7 @@ class ProfileManager:
|
|||||||
self._path = path
|
self._path = path
|
||||||
self._directory = os.path.dirname(path)
|
self._directory = os.path.dirname(path)
|
||||||
# create /avatars if not exists:
|
# create /avatars if not exists:
|
||||||
avatars_directory = util.join_path(Settings.get_default_path(), 'avatars')
|
avatars_directory = util.join_path(self._directory, 'avatars')
|
||||||
if not os.path.exists(avatars_directory):
|
if not os.path.exists(avatars_directory):
|
||||||
os.makedirs(avatars_directory)
|
os.makedirs(avatars_directory)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user