This commit is contained in:
emdee 2023-12-10 04:43:53 +00:00
parent 4109c822b3
commit ba013b6a81
7 changed files with 21 additions and 19 deletions

View file

@ -979,7 +979,7 @@ class App:
self._ms.log_console()
def _test_main(self):
from toxygen_wrapper.tests_wrapper import main as tests_main
from toxygen_wrapper.wrapper_tests.tests_wrapper import main as tests_main
LOG.debug("_test_main")
if not self._tox: return
title = 'Extended Test Suite'

View file

@ -105,7 +105,7 @@ class AV(common.tox_save.ToxAvSave):
self._toxav.call(friend_number,
self._audio_krate_tox_audio if audio else 0,
self._audio_krate_tox_video if video else 0)
except ArgumentError as e:
except Exception as e:
LOG.warn(f"_toxav.call already has {friend_number}")
return
self._calls[friend_number] = Call(audio, video)
@ -114,7 +114,7 @@ class AV(common.tox_save.ToxAvSave):
def accept_call(self, friend_number, audio_enabled, video_enabled):
# obsolete
return call_accept_call(self, friend_number, audio_enabled, video_enabled)
return self.call_accept_call(friend_number, audio_enabled, video_enabled)
def call_accept_call(self, friend_number, audio_enabled, video_enabled):
LOG.debug(f"call_accept_call from {friend_number} {self._running}" +

View file

@ -132,10 +132,11 @@ class Contact(basecontact.BaseContact):
"""
:return list of unsent messages for saving
"""
message = list(filter(lambda m: m.author is not None
# and m.tox_message_id == tox_message_id,
messages = filter(lambda m: m.author is not None
and m.author.type == MESSAGE_AUTHOR['NOT_SENT']
and m.tox_message_id == tox_message_id,
self._corr))[0]
self._corr)
# was message = list(...)[0]
return list(messages)
def mark_as_sent(self, tox_message_id):

View file

@ -34,7 +34,7 @@ class ContactProvider(tox_save.ToxSave):
try:
public_key = self._tox.friend_get_public_key(friend_number)
except Exception as e:
LOG_WARN(f"get_friend_by_number NO {friend_number} {e} ")
LOG_WARN(f"CP.get_friend_by_number NO {friend_number} {e} ")
return None
return self.get_friend_by_public_key(public_key)
@ -44,7 +44,7 @@ class ContactProvider(tox_save.ToxSave):
return friend
friend = self._friend_factory.create_friend_by_public_key(public_key)
self._add_to_cache(public_key, friend)
LOG_INFO(f"get_friend_by_public_key ADDED {friend} ")
LOG_INFO(f"CP.get_friend_by_public_key ADDED {friend} ")
return friend
@ -52,7 +52,7 @@ class ContactProvider(tox_save.ToxSave):
try:
friend_numbers = self._tox.self_get_friend_list()
except Exception as e:
LOG_WARN(f"get_all_friends NO {friend_numbers} {e} ")
LOG_WARN(f"CP.get_all_friends NO {friend_numbers} {e} ")
return None
friends = map(lambda n: self.get_friend_by_number(n), friend_numbers)
@ -71,11 +71,11 @@ class ContactProvider(tox_save.ToxSave):
# failsafe in case there are bogus None groups?
fgroups = list(filter(lambda x: x, groups))
if len(fgroups) != len_groups:
LOG_WARN(f"are there are bogus None groups in libtoxcore? {len(fgroups)} != {len_groups}")
LOG_WARN(f"CP.are there are bogus None groups in libtoxcore? {len(fgroups)} != {len_groups}")
for group_num in group_numbers:
group = self.get_group_by_number(group_num)
if group is None:
LOG_ERROR(f"there are bogus None groups in libtoxcore {group_num}!")
LOG_ERROR(f"There are bogus None groups in libtoxcore {group_num}!")
# fixme: do something
groups = fgroups
return groups
@ -83,7 +83,7 @@ class ContactProvider(tox_save.ToxSave):
def get_group_by_number(self, group_number):
group = None
try:
LOG_INFO(f"CP.group_get_number {group_number} ")
LOG_INFO(f"CP.CP.group_get_number {group_number} ")
# original code
chat_id = self._tox.group_get_chat_id(group_number)
if chat_id is None:
@ -91,16 +91,16 @@ class ContactProvider(tox_save.ToxSave):
elif chat_id == '-1':
LOG_ERROR(f"get_group_by_number <0 chat_id ({group_number})")
else:
LOG_INFO(f"group_get_number {group_number} {chat_id}")
LOG_INFO(f"CP.group_get_number {group_number} {chat_id}")
group = self.get_group_by_chat_id(chat_id)
if group is None or group == '-1':
LOG_WARN(f"get_group_by_number leaving {group} ({group_number})")
LOG_WARN(f"CP.get_group_by_number leaving {group} ({group_number})")
#? iRet = self._tox.group_leave(group_number)
# invoke in main thread?
# self._contacts_manager.delete_group(group_number)
return group
except Exception as e:
LOG_WARN(f"group_get_number {group_number} {e}")
LOG_WARN(f"CP.group_get_number {group_number} {e}")
return None
def get_group_by_chat_id(self, chat_id):

View file

@ -78,6 +78,9 @@ class FileTransfer:
def get_file_id(self):
return self._file_id
# WTF
def get_file_id(self):
return self._tox.file_get_file_id(self._friend_number, self._file_number)
file_id = property(get_file_id)
@ -112,9 +115,6 @@ class FileTransfer:
if self._tox.file_control(self._friend_number, self._file_number, control):
self.set_state(control)
def get_file_id(self):
return self._tox.file_get_file_id(self._friend_number, self._file_number)
def _signal(self):
percentage = self._done / self._size if self._size else 0
if self._creation_time is None or not percentage:

View file

@ -3,7 +3,7 @@ import os
from PyQt5 import uic
from PyQt5 import QtCore, QtGui, QtWidgets
from qtpy.QtGui import (QColor, QTextCharFormat, QFont, QSyntaxHighlighter)
from qtpy.QtGui import (QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QFontMetrics)
from ui.contact_items import *
from ui.widgets import MultilineEdit

1
toxygen/wrapper_tests Symbolic link
View file

@ -0,0 +1 @@
../../toxygen_wrapper.git/wrapper_tests/