From 257271cf939d1c6b576ecf865a8679752255a1b2 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Wed, 16 Mar 2016 23:12:51 +0300 Subject: [PATCH] bug fixes --- src/menu.py | 2 +- src/profile.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/menu.py b/src/menu.py index 60c92e0..ab77c47 100644 --- a/src/menu.py +++ b/src/menu.py @@ -165,7 +165,7 @@ class ProfileSettings(CenteredWidget): Profile.get_instance().reset_avatar() def set_avatar(self): - name = QtGui.QFileDialog.getOpenFileName(self, 'Open file', None, 'Image Files (*.png *.jpg *.bmp)') + name = QtGui.QFileDialog.getOpenFileName(self, 'Open file', None, 'Image Files (*.png)') print name if name[0]: with open(name[0], 'rb') as f: diff --git a/src/profile.py b/src/profile.py index 26157fd..9ef7a44 100644 --- a/src/profile.py +++ b/src/profile.py @@ -170,7 +170,7 @@ class Contact(object): def get_avatar_hash(self): avatar_path = (Settings.get_default_path() + 'avatars/{}.png').format(self._tox_id[:TOX_PUBLIC_KEY_SIZE * 2]) if not os.path.isfile(avatar_path): # load default image - avatar_path = curr_directory() + '/images/avatar.png' + return 0 with open(avatar_path, 'rb') as fl: data = fl.read() return Tox.hash(data) @@ -705,6 +705,12 @@ class Profile(Contact, Singleton): pass def incoming_avatar(self, friend_number, file_number, size): + """ + Friend changed avatar + :param friend_number: friend number + :param file_number: file number + :param size: size of avatar or 0 (default avatar) + """ friend = self.get_friend_by_number(friend_number) if not size: friend.reset_avatar()