utf-8 decoding moved from contacts
This commit is contained in:
parent
a935d602f8
commit
b591ac13ba
@ -39,7 +39,6 @@ class BaseContact:
|
||||
return self._name
|
||||
|
||||
def set_name(self, value):
|
||||
value = str(value, 'utf-8')
|
||||
if self._name != value:
|
||||
self._name = value
|
||||
self._widget.name.setText(self._name)
|
||||
@ -61,7 +60,6 @@ class BaseContact:
|
||||
return self._status_message
|
||||
|
||||
def set_status_message(self, value):
|
||||
value = str(value, 'utf-8')
|
||||
if self._status_message != value:
|
||||
self._status_message = value
|
||||
self._widget.status_message.setText(self._status_message)
|
||||
|
@ -224,7 +224,6 @@ class ContactsManager:
|
||||
friend = self.get_friend_by_number(number)
|
||||
tmp = friend.name
|
||||
friend.set_name(name)
|
||||
name = str(name, 'utf-8')
|
||||
if friend.name == name and tmp != name:
|
||||
# TODO: move to friend?
|
||||
message = util_ui.tr('User {} is now known as {}')
|
||||
|
@ -49,7 +49,7 @@ class Profile(basecontact.BaseContact):
|
||||
def set_name(self, value):
|
||||
if self.name == value:
|
||||
return
|
||||
super().set_name(value.encode('utf-8'))
|
||||
super().set_name(value)
|
||||
self._tox.self_set_name(self._name.encode('utf-8'))
|
||||
|
||||
def set_status_message(self, value):
|
||||
|
@ -53,8 +53,8 @@ class GroupsService(tox_save.ToxSave):
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
def update_group_info(self, group):
|
||||
group.name = self._tox.group_get_name(group.number).encode('utf-8')
|
||||
group.status_message = self._tox.group_get_topic(group.number).encode('utf-8')
|
||||
group.name = self._tox.group_get_name(group.number)
|
||||
group.status_message = self._tox.group_get_topic(group.number)
|
||||
|
||||
# -----------------------------------------------------------------------------------------------------------------
|
||||
# Private methods
|
||||
|
@ -86,7 +86,7 @@ def friend_name(contacts_manager):
|
||||
Friend changed his name
|
||||
"""
|
||||
print('New name friend #' + str(friend_number))
|
||||
invoke_in_main_thread(contacts_manager.new_name, friend_number, name)
|
||||
invoke_in_main_thread(contacts_manager.new_name, friend_number, str(name, 'utf-8'))
|
||||
|
||||
return wrapped
|
||||
|
||||
@ -98,7 +98,7 @@ def friend_status_message(contacts_manager, messenger):
|
||||
and calls window repaint
|
||||
"""
|
||||
friend = contacts_manager.get_friend_by_number(friend_number)
|
||||
invoke_in_main_thread(friend.set_status_message, status_message)
|
||||
invoke_in_main_thread(friend.set_status_message, str(status_message, 'utf-8'))
|
||||
print('User #{} has new status'.format(friend_number))
|
||||
invoke_in_main_thread(messenger.send_messages, friend_number)
|
||||
|
||||
|
@ -272,7 +272,7 @@ class ProfileSettings(CenteredWidget):
|
||||
|
||||
def closeEvent(self, event):
|
||||
self._profile.set_name(self.nick.text())
|
||||
self._profile.set_status_message(self.status_message.text().encode('utf-8'))
|
||||
self._profile.set_status_message(self.status_message.text())
|
||||
self._profile.set_status(self.status.currentIndex())
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user