various bug fixes
This commit is contained in:
parent
ee994973db
commit
a4ceeccfd8
@ -107,6 +107,7 @@ class App:
|
|||||||
self._tray.hide()
|
self._tray.hide()
|
||||||
self._save_profile()
|
self._save_profile()
|
||||||
self._settings.close()
|
self._settings.close()
|
||||||
|
self._unset_callbacks()
|
||||||
self._kill_toxav()
|
self._kill_toxav()
|
||||||
del self._tox
|
del self._tox
|
||||||
|
|
||||||
@ -319,6 +320,7 @@ class App:
|
|||||||
self._stop_threads(False)
|
self._stop_threads(False)
|
||||||
data = self._tox.get_savedata()
|
data = self._tox.get_savedata()
|
||||||
self._save_profile(data)
|
self._save_profile(data)
|
||||||
|
self._unset_callbacks()
|
||||||
self._kill_toxav()
|
self._kill_toxav()
|
||||||
del self._tox
|
del self._tox
|
||||||
# create new tox instance
|
# create new tox instance
|
||||||
@ -408,6 +410,9 @@ class App:
|
|||||||
self._calls_manager, self._file_transfer_handler, self._ms, self._tray,
|
self._calls_manager, self._file_transfer_handler, self._ms, self._tray,
|
||||||
self._messenger, self._groups_service, self._contacts_provider)
|
self._messenger, self._groups_service, self._contacts_provider)
|
||||||
|
|
||||||
|
def _unset_callbacks(self):
|
||||||
|
callbacks.unset_callbacks(self._tox)
|
||||||
|
|
||||||
def _init_profile(self):
|
def _init_profile(self):
|
||||||
if not self._profile.has_avatar():
|
if not self._profile.has_avatar():
|
||||||
self._profile.reset_avatar(self._settings['identicons'])
|
self._profile.reset_avatar(self._settings['identicons'])
|
||||||
|
@ -146,8 +146,7 @@ class Contact(basecontact.BaseContact):
|
|||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def delete_message(self, message_id):
|
def delete_message(self, message_id):
|
||||||
elem = list(filter(lambda m: type(m) in (TextMessage, GroupChatMessage) and m.message_id == message_id,
|
elem = list(filter(lambda m: m.message_id == message_id, self._corr))[0]
|
||||||
self._corr))[0]
|
|
||||||
tmp = list(filter(lambda m: m.type in (MESSAGE_TYPE['TEXT'], MESSAGE_TYPE['ACTION']), self._corr))
|
tmp = list(filter(lambda m: m.type in (MESSAGE_TYPE['TEXT'], MESSAGE_TYPE['ACTION']), self._corr))
|
||||||
if elem in tmp[-self._unsaved_messages:] and self._unsaved_messages:
|
if elem in tmp[-self._unsaved_messages:] and self._unsaved_messages:
|
||||||
self._unsaved_messages -= 1
|
self._unsaved_messages -= 1
|
||||||
|
@ -110,7 +110,7 @@ class BaseContactMenuGenerator:
|
|||||||
(history_menu_builder
|
(history_menu_builder
|
||||||
.with_name(util_ui.tr('Chat history'))
|
.with_name(util_ui.tr('Chat history'))
|
||||||
.with_action(util_ui.tr('Clear history'), lambda: history_loader.clear_history(self._contact)
|
.with_action(util_ui.tr('Clear history'), lambda: history_loader.clear_history(self._contact)
|
||||||
and main_screen.messages.clear())
|
or main_screen.messages.clear())
|
||||||
.with_action(util_ui.tr('Export as text'), lambda: history_loader.export_history(self._contact))
|
.with_action(util_ui.tr('Export as text'), lambda: history_loader.export_history(self._contact))
|
||||||
.with_action(util_ui.tr('Export as HTML'), lambda: history_loader.export_history(self._contact, False))
|
.with_action(util_ui.tr('Export as HTML'), lambda: history_loader.export_history(self._contact, False))
|
||||||
)
|
)
|
||||||
|
@ -90,6 +90,7 @@ class ContactsManager(ToxSave):
|
|||||||
self._screen.typing.setVisible(False)
|
self._screen.typing.setVisible(False)
|
||||||
current_contact = self.get_curr_contact()
|
current_contact = self.get_curr_contact()
|
||||||
if current_contact is not None:
|
if current_contact is not None:
|
||||||
|
# TODO: send when needed
|
||||||
current_contact.typing_notification_handler.send(self._tox, False)
|
current_contact.typing_notification_handler.send(self._tox, False)
|
||||||
current_contact.remove_messages_widgets() # TODO: if required
|
current_contact.remove_messages_widgets() # TODO: if required
|
||||||
self._unsubscribe_from_events(current_contact)
|
self._unsubscribe_from_events(current_contact)
|
||||||
@ -118,6 +119,7 @@ class ContactsManager(ToxSave):
|
|||||||
self._messages_items_factory.create_inline_item(message.data)
|
self._messages_items_factory.create_inline_item(message.data)
|
||||||
else:
|
else:
|
||||||
self._messages_items_factory.create_message_item(message)
|
self._messages_items_factory.create_message_item(message)
|
||||||
|
self._messages.scrollToBottom()
|
||||||
# if value in self._call:
|
# if value in self._call:
|
||||||
# self._screen.active_call()
|
# self._screen.active_call()
|
||||||
# elif value in self._incoming_calls:
|
# elif value in self._incoming_calls:
|
||||||
@ -365,6 +367,8 @@ class ContactsManager(ToxSave):
|
|||||||
|
|
||||||
def add_group_peer(self, group, peer):
|
def add_group_peer(self, group, peer):
|
||||||
contact = self._contact_provider.get_group_peer_by_id(group, peer.id)
|
contact = self._contact_provider.get_group_peer_by_id(group, peer.id)
|
||||||
|
if self.check_if_contact_exists(contact.tox_id):
|
||||||
|
return
|
||||||
self._contacts.append(contact)
|
self._contacts.append(contact)
|
||||||
contact.reset_avatar(self._settings['identicons'])
|
contact.reset_avatar(self._settings['identicons'])
|
||||||
self._save_profile()
|
self._save_profile()
|
||||||
|
@ -604,3 +604,50 @@ def init_callbacks(tox, profile, settings, plugin_loader, contacts_manager,
|
|||||||
tox.callback_group_password(group_password(contacts_provider), 0)
|
tox.callback_group_password(group_password(contacts_provider), 0)
|
||||||
tox.callback_group_peer_limit(group_peer_limit(contacts_provider), 0)
|
tox.callback_group_peer_limit(group_peer_limit(contacts_provider), 0)
|
||||||
tox.callback_group_privacy_state(group_privacy_state(contacts_provider), 0)
|
tox.callback_group_privacy_state(group_privacy_state(contacts_provider), 0)
|
||||||
|
|
||||||
|
|
||||||
|
def unset_callbacks(tox):
|
||||||
|
# self callbacks
|
||||||
|
tox.callback_self_connection_status(0)
|
||||||
|
|
||||||
|
# friend callbacks
|
||||||
|
tox.callback_friend_status(0)
|
||||||
|
tox.callback_friend_message(0)
|
||||||
|
tox.callback_friend_connection_status(0)
|
||||||
|
tox.callback_friend_name(0)
|
||||||
|
tox.callback_friend_status_message(0)
|
||||||
|
tox.callback_friend_request(0)
|
||||||
|
tox.callback_friend_typing(0)
|
||||||
|
tox.callback_friend_read_receipt(0)
|
||||||
|
|
||||||
|
# file transfer
|
||||||
|
tox.callback_file_recv(0)
|
||||||
|
tox.callback_file_recv_chunk(0)
|
||||||
|
tox.callback_file_chunk_request(0)
|
||||||
|
tox.callback_file_recv_control(0)
|
||||||
|
|
||||||
|
# av
|
||||||
|
toxav = tox.AV
|
||||||
|
toxav.callback_call_state(0, 0)
|
||||||
|
toxav.callback_call(0, 0)
|
||||||
|
toxav.callback_audio_receive_frame(0, 0)
|
||||||
|
toxav.callback_video_receive_frame(0, 0)
|
||||||
|
|
||||||
|
# custom packets
|
||||||
|
tox.callback_friend_lossless_packet(0)
|
||||||
|
tox.callback_friend_lossy_packet(0)
|
||||||
|
|
||||||
|
# gc callbacks
|
||||||
|
tox.callback_group_message(0, 0)
|
||||||
|
tox.callback_group_private_message(0, 0)
|
||||||
|
tox.callback_group_invite(0, 0)
|
||||||
|
tox.callback_group_self_join(0, 0)
|
||||||
|
tox.callback_group_peer_join(0, 0)
|
||||||
|
tox.callback_group_peer_exit(0, 0)
|
||||||
|
tox.callback_group_peer_name(0, 0)
|
||||||
|
tox.callback_group_peer_status(0, 0)
|
||||||
|
tox.callback_group_topic(0, 0)
|
||||||
|
tox.callback_group_moderation(0, 0)
|
||||||
|
tox.callback_group_password(0, 0)
|
||||||
|
tox.callback_group_peer_limit(0, 0)
|
||||||
|
tox.callback_group_privacy_state(0, 0)
|
||||||
|
@ -594,7 +594,6 @@ class InterfaceSettings(CenteredWidget):
|
|||||||
app.removeTranslator(app.translator)
|
app.removeTranslator(app.translator)
|
||||||
app.translator.load(join_path(get_translations_directory(), path))
|
app.translator.load(join_path(get_translations_directory(), path))
|
||||||
app.installTranslator(app.translator)
|
app.installTranslator(app.translator)
|
||||||
self._settings.save()
|
|
||||||
|
|
||||||
app_closing_setting = 0
|
app_closing_setting = 0
|
||||||
if self.hideRadioButton.isChecked():
|
if self.hideRadioButton.isChecked():
|
||||||
@ -602,6 +601,7 @@ class InterfaceSettings(CenteredWidget):
|
|||||||
elif self.closeToTrayRadioButton.isChecked():
|
elif self.closeToTrayRadioButton.isChecked():
|
||||||
app_closing_setting = 2
|
app_closing_setting = 2
|
||||||
self._settings['close_app'] = app_closing_setting
|
self._settings['close_app'] = app_closing_setting
|
||||||
|
self._settings.save()
|
||||||
|
|
||||||
if restart:
|
if restart:
|
||||||
util_ui.message_box(util_ui.tr('Restart app to apply settings'), util_ui.tr('Restart required'))
|
util_ui.message_box(util_ui.tr('Restart app to apply settings'), util_ui.tr('Restart required'))
|
||||||
|
@ -121,6 +121,7 @@ class Tox:
|
|||||||
self.AV = ToxAV(self._tox_pointer)
|
self.AV = ToxAV(self._tox_pointer)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
del self.AV
|
||||||
Tox.libtoxcore.tox_kill(self._tox_pointer)
|
Tox.libtoxcore.tox_kill(self._tox_pointer)
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user