various fixes

This commit is contained in:
ingvar1995 2018-08-01 00:47:57 +03:00
parent dd323e3cbb
commit c7a83055b1
4 changed files with 12 additions and 8 deletions

View File

@ -203,8 +203,9 @@ class ContactsManager(ToxSave):
self._settings['sorting'] = self._sorting self._settings['sorting'] = self._sorting
self._settings.save() self._settings.save()
# update active contact # update active contact
index = self._contacts.index(contact) if contact is not None:
self.set_active(index) index = self._contacts.index(contact)
self.set_active(index)
def update_filtration(self): def update_filtration(self):
""" """

View File

@ -409,7 +409,7 @@ def group_invite(window, settings, tray, profile, groups_service, contacts_provi
if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY'] and not settings.locked: if settings['notifications'] and profile.status != TOX_USER_STATUS['BUSY'] and not settings.locked:
friend = contacts_provider.get_friend_by_number(friend_number) friend = contacts_provider.get_friend_by_number(friend_number)
title = util_ui.tr('New invite to group chat') title = util_ui.tr('New invite to group chat')
text = util_ui.tr('{} invites you to group {}').format(friend.name, group_name) text = util_ui.tr('{} invites you to group "{}"').format(friend.name, group_name)
invoke_in_main_thread(tray_notification, title, text, tray, window) invoke_in_main_thread(tray_notification, title, text, tray, window)
icon = os.path.join(util.get_images_directory(), 'icon_new_messages.png') icon = os.path.join(util.get_images_directory(), 'icon_new_messages.png')
invoke_in_main_thread(tray.setIcon, QtGui.QIcon(icon)) invoke_in_main_thread(tray.setIcon, QtGui.QIcon(icon))

View File

@ -678,8 +678,9 @@ class MainWindow(QtWidgets.QMainWindow):
def _selected_contact_changed(self): def _selected_contact_changed(self):
num = self.friends_list.currentRow() num = self.friends_list.currentRow()
self._contacts_manager.active_contact = num if self._contacts_manager.active_contact != num:
self.groupMenuButton.setVisible(not self._contacts_manager.is_active_a_friend()) self._contacts_manager.active_contact = num
self.groupMenuButton.setVisible(self._contacts_manager.is_active_a_group())
def mouseReleaseEvent(self, event): def mouseReleaseEvent(self, event):
pos = self.connection_status.pos() pos = self.connection_status.pos()

View File

@ -1553,10 +1553,11 @@ class Tox:
error = c_int() error = c_int()
peer_info = self.group_self_peer_info_new() peer_info = self.group_self_peer_info_new()
nick = bytes(nick, 'utf-8') nick = bytes(nick, 'utf-8')
group_name = group_name.encode('utf-8')
peer_info.contents.nick = c_char_p(nick) peer_info.contents.nick = c_char_p(nick)
peer_info.contents.nick_length = len(nick) peer_info.contents.nick_length = len(nick)
peer_info.contents.user_status = status peer_info.contents.user_status = status
result = Tox.libtoxcore.tox_group_new(self._tox_pointer, privacy_state, group_name.encode('utf-8'), result = Tox.libtoxcore.tox_group_new(self._tox_pointer, privacy_state, group_name,
len(group_name), peer_info, byref(error)) len(group_name), peer_info, byref(error))
return result return result
@ -2180,11 +2181,12 @@ class Tox:
result = Tox.libtoxcore.tox_group_invite_friend(self._tox_pointer, group_number, friend_number, byref(error)) result = Tox.libtoxcore.tox_group_invite_friend(self._tox_pointer, group_number, friend_number, byref(error))
return result return result
def group_self_peer_info_new(self): @staticmethod
def group_self_peer_info_new():
error = c_int() error = c_int()
f = Tox.libtoxcore.tox_group_self_peer_info_new f = Tox.libtoxcore.tox_group_self_peer_info_new
f.restype = POINTER(GroupChatSelfPeerInfo) f.restype = POINTER(GroupChatSelfPeerInfo)
result = f(self._tox_pointer, byref(error)) result = f(byref(error))
return result return result