From 5cfa484a67b8070ed96dff7983414c12f7bc8f8a Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Fri, 24 Jun 2016 15:00:13 +0300 Subject: [PATCH] name && status bug fixes --- src/menu.py | 2 +- src/profile.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/menu.py b/src/menu.py index 6d89db9..0aff83f 100644 --- a/src/menu.py +++ b/src/menu.py @@ -258,7 +258,7 @@ class ProfileSettings(CenteredWidget): def closeEvent(self, event): profile = Profile.get_instance() - profile.set_name(self.nick.text().encode('utf-8')) + profile.set_name(self.nick.text()) profile.set_status_message(self.status_message.text().encode('utf-8')) profile.set_status(self.status.currentIndex()) diff --git a/src/profile.py b/src/profile.py index d1aa7a2..0e79c63 100644 --- a/src/profile.py +++ b/src/profile.py @@ -74,18 +74,19 @@ class Profile(contact.Contact, Singleton): self.set_status((self._status + 1) % 3) def set_status(self, status): - super(Profile, self).set_status(status) - if status is not None: + if self._status is not None: + super(Profile, self).set_status(status) self._tox.self_set_status(status) def set_name(self, value): if self.name == value: return - super(Profile, self).set_name(value) + tmp = self.name + super(Profile, self).set_name(value.encode('utf-8')) self._tox.self_set_name(self._name.encode('utf-8')) message = QtGui.QApplication.translate("MainWindow", 'User {} is now known as {}', None, QtGui.QApplication.UnicodeUTF8) - message = message.format(tmp, str(value, 'utf-8')) + message = message.format(tmp, value) for friend in self._friends: friend.append_message(InfoMessage(message, time.time())) if self._active_friend + 1: