wrapper update and minor fixes
This commit is contained in:
parent
c7a83055b1
commit
25de4fa2ef
@ -179,7 +179,11 @@ class ContactsManager(ToxSave):
|
|||||||
part2 = sorted(part2, key=key_lambda)
|
part2 = sorted(part2, key=key_lambda)
|
||||||
self._contacts = part1 + part2
|
self._contacts = part1 + part2
|
||||||
elif sorting == 0:
|
elif sorting == 0:
|
||||||
self._contacts = sorted(self._contacts, key=lambda x: x.number)
|
contacts = sorted(self._contacts, key=lambda c: c.number)
|
||||||
|
friends = filter(lambda c: type(c) is Friend, contacts)
|
||||||
|
groups = filter(lambda c: type(c) is GroupChat, contacts)
|
||||||
|
group_peers = filter(lambda c: type(c) is GroupPeerContact, contacts)
|
||||||
|
self._contacts = list(friends) + list(groups) + list(group_peers)
|
||||||
else:
|
else:
|
||||||
self._contacts = sorted(self._contacts, key=lambda x: x.name.lower())
|
self._contacts = sorted(self._contacts, key=lambda x: x.name.lower())
|
||||||
|
|
||||||
@ -194,6 +198,7 @@ class ContactsManager(ToxSave):
|
|||||||
friend.visibility = (friend.status is not None or sorting not in (1, 4)) and filtered_by_name
|
friend.visibility = (friend.status is not None or sorting not in (1, 4)) and filtered_by_name
|
||||||
# show friend even if it's hidden when there any unread messages/actions
|
# show friend even if it's hidden when there any unread messages/actions
|
||||||
friend.visibility = friend.visibility or friend.messages or friend.actions
|
friend.visibility = friend.visibility or friend.messages or friend.actions
|
||||||
|
# TODO: calculate height
|
||||||
if friend.visibility:
|
if friend.visibility:
|
||||||
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, self._friend_item_height))
|
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, self._friend_item_height))
|
||||||
else:
|
else:
|
||||||
@ -542,10 +547,7 @@ class ContactsManager(ToxSave):
|
|||||||
remove(avatar_path)
|
remove(avatar_path)
|
||||||
|
|
||||||
def _delete_contact(self, num):
|
def _delete_contact(self, num):
|
||||||
if len(self._contacts) == 1:
|
self.set_active(-1 if len(self._contacts) == 1 else 0)
|
||||||
self.set_active(-1)
|
|
||||||
else:
|
|
||||||
self.set_active(0)
|
|
||||||
|
|
||||||
self._contact_provider.remove_contact_from_cache(self._contacts[num].tox_id)
|
self._contact_provider.remove_contact_from_cache(self._contacts[num].tox_id)
|
||||||
del self._contacts[num]
|
del self._contacts[num]
|
||||||
|
@ -104,7 +104,7 @@ class GroupsService(tox_save.ToxSave):
|
|||||||
def set_group_topic(self, group):
|
def set_group_topic(self, group):
|
||||||
if not group.is_moderator_or_founder():
|
if not group.is_moderator_or_founder():
|
||||||
return
|
return
|
||||||
text = util_ui.tr('New topic for group {}:'.format(group.name))
|
text = util_ui.tr('New topic for group "{}":'.format(group.name))
|
||||||
title = util_ui.tr('Set group topic')
|
title = util_ui.tr('Set group topic')
|
||||||
topic, ok = util_ui.text_dialog(text, title, group.status_message)
|
topic, ok = util_ui.text_dialog(text, title, group.status_message)
|
||||||
if not ok or not topic:
|
if not ok or not topic:
|
||||||
@ -151,6 +151,7 @@ class GroupsService(tox_save.ToxSave):
|
|||||||
self_peer = group.get_self_peer()
|
self_peer = group.get_self_peer()
|
||||||
self_peer.name = name
|
self_peer.name = name
|
||||||
self_peer.status = status
|
self_peer.status = status
|
||||||
|
self.generate_peers_list()
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
# Private methods
|
# Private methods
|
||||||
|
@ -1940,6 +1940,13 @@ class Tox:
|
|||||||
result = Tox.libtoxcore.tox_group_get_number_groups(self._tox_pointer)
|
result = Tox.libtoxcore.tox_group_get_number_groups(self._tox_pointer)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def groups_get_list(self):
|
||||||
|
groups_list_size = self.group_get_number_groups()
|
||||||
|
groups_list = create_string_buffer(sizeof(c_uint32) * groups_list_size)
|
||||||
|
groups_list = POINTER(c_uint32)(groups_list)
|
||||||
|
Tox.libtoxcore.tox_groups_get_list(self._tox_pointer, groups_list)
|
||||||
|
return groups_list[0:groups_list_size]
|
||||||
|
|
||||||
def group_get_privacy_state(self, group_number):
|
def group_get_privacy_state(self, group_number):
|
||||||
"""
|
"""
|
||||||
Return the privacy state of the group designated by the given group number. If group number
|
Return the privacy state of the group designated by the given group number. If group number
|
||||||
@ -2461,7 +2468,7 @@ class Tox:
|
|||||||
create_string_buffer(sizeof(c_uint32) * self.group_ban_get_list_size(group_number)), byref(error)))
|
create_string_buffer(sizeof(c_uint32) * self.group_ban_get_list_size(group_number)), byref(error)))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_ban_get_name_size(self, group_number, ban_id):
|
def group_ban_get_target_size(self, group_number, ban_id):
|
||||||
"""
|
"""
|
||||||
Return the length of the name for the ban list entry designated by ban_id, in the
|
Return the length of the name for the ban list entry designated by ban_id, in the
|
||||||
group designated by the given group number. If either group_number or ban_id is invalid,
|
group designated by the given group number. If either group_number or ban_id is invalid,
|
||||||
@ -2469,10 +2476,10 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
error = c_int()
|
error = c_int()
|
||||||
result = Tox.libtoxcore.tox_group_ban_get_name_size(self._tox_pointer, group_number, ban_id, byref(error))
|
result = Tox.libtoxcore.tox_group_ban_get_target_size(self._tox_pointer, group_number, ban_id, byref(error))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def group_ban_get_name(self, group_number, ban_id):
|
def group_ban_get_target(self, group_number, ban_id):
|
||||||
"""
|
"""
|
||||||
Write the name of the ban entry designated by ban_id in the group designated by the
|
Write the name of the ban entry designated by ban_id in the group designated by the
|
||||||
given group number to a byte array.
|
given group number to a byte array.
|
||||||
@ -2483,12 +2490,12 @@ class Tox:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
error = c_int()
|
error = c_int()
|
||||||
size = self.group_ban_get_name_size(group_number, ban_id)
|
size = self.group_ban_get_target_size(group_number, ban_id)
|
||||||
name = create_string_buffer()
|
target = create_string_buffer(size)
|
||||||
|
|
||||||
result = Tox.libtoxcore.tox_group_ban_get_name(self._tox_pointer, group_number, ban_id,
|
result = Tox.libtoxcore.tox_group_ban_get_target(self._tox_pointer, group_number, ban_id,
|
||||||
name, byref(error))
|
target, byref(error))
|
||||||
return str(name[:size], 'utf-8')
|
return str(target[:size], 'utf-8')
|
||||||
|
|
||||||
def group_ban_get_time_set(self, group_number, ban_id):
|
def group_ban_get_time_set(self, group_number, ban_id):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user