Compare commits

...

3 Commits

Author SHA1 Message Date
emdee@spm.plastiras.org dda2a9147a sound fixes
CI / Python ${{ matrix.python-version }} (3.10) (push) Has been cancelled Details
CI / Python ${{ matrix.python-version }} (3.7) (push) Has been cancelled Details
CI / Python ${{ matrix.python-version }} (3.8) (push) Has been cancelled Details
CI / Python ${{ matrix.python-version }} (3.9) (push) Has been cancelled Details
2024-02-10 23:54:53 +00:00
emdee@spm.plastiras.org d936663591 sound fixes 2024-02-10 23:53:28 +00:00
emdee@spm.plastiras.org ac6999924f sound fixes 2024-02-10 23:52:50 +00:00
34 changed files with 140 additions and 160 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
.pylint.out
*.pyc
*.pyo
*.bak
toxygen/toxcore
tests/tests

View File

@ -1,13 +0,0 @@
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install build-essential libtool autotools-dev automake checkinstall cmake check git yasm libsodium-dev libopus-dev libvpx-dev pkg-config -y && \
git clone https://github.com/ingvar1995/toxcore.git --branch=ngc_rebase && \
cd toxcore && mkdir _build && cd _build && \
cmake .. && make && make install
RUN apt-get install portaudio19-dev python3-pyqt5 python3-pyaudio python3-pip -y && \
pip3 install numpy pydenticon opencv-python pyinstaller
RUN useradd -ms /bin/bash toxygen
USER toxygen

View File

@ -1,33 +0,0 @@
#!/usr/bin/env bash
cd ~
git clone https://github.com/toxygen-project/toxygen.git --branch=next_gen
cd toxygen/toxygen
pyinstaller --windowed --icon=images/icon.ico main.py
cp -r styles dist/main/
find . -type f ! -name '*.qss' -delete
cp -r plugins dist/main/
mkdir -p dist/main/ui/views
cp -r ui/views dist/main/ui/
cp -r sounds dist/main/
cp -r smileys dist/main/
cp -r stickers dist/main/
cp -r bootstrap dist/main/
find . -type f ! -name '*.json' -delete
cp -r images dist/main/
cp -r translations dist/main/
find . -name "*.ts" -type f -delete
cd dist
mv main toxygen
cd toxygen
mv main toxygen
wget -O updater https://github.com/toxygen-project/toxygen_updater/releases/download/v0.1/toxygen_updater_linux_64
echo "[Paths]" >> qt.conf
echo "Prefix = PyQt5/Qt" >> qt.conf
cd ..
tar -zcvf toxygen_linux_64.tar.gz toxygen > /dev/null
rm -rf toxygen

View File

@ -8,10 +8,11 @@ QtPy >= 2.4.1
PyAudio >= 0.2.13
numpy >= 1.26.1
opencv_python >= 4.8.0
pydenticon >= 0.3.1
pillow >= 10.2.0
gevent >= 23.9.1
pydenticon >= 0.3.1
greenlet >= 2.0.2
sounddevice >= 0.3.15
# this is optional
coloredlogs >= 15.0.1
# this is optional

View File

@ -14,7 +14,7 @@ faulthandler.enable()
import warnings
warnings.filterwarnings('ignore')
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
try:
from trepan.interfaces import server as Mserver
from trepan.api import debug

View File

@ -38,7 +38,7 @@ from middleware import threads
import middleware.callbacks as callbacks
import updater.updater as updater
from middleware.tox_factory import tox_factory
import tox_wrapper.toxencryptsave as tox_encrypt_save
import toxygen_wrapper.toxencryptsave as tox_encrypt_save
import user_data.toxes
from user_data import settings
from user_data.settings import get_user_config_path, merge_args_into_settings
@ -76,7 +76,7 @@ from ui.widgets_factory import WidgetsFactory
from user_data.backup_service import BackupService
import styles.style # TODO: dynamic loading
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
global LOG
import logging
@ -114,7 +114,7 @@ def setup_logging(oArgs) -> None:
LOG.setLevel(oArgs.loglevel)
LOG.trace = lambda l: LOG.log(0, repr(l))
LOG.info(f"Setting loglevel to {oArgs.loglevel!s}")
LOG.info(f"Setting loglevel to {oArgs.loglevel}")
if oArgs.loglevel < 20:
# opencv debug
@ -164,7 +164,7 @@ class App:
setup_logging(oArgs)
# sys.stderr.write( 'Command line args: ' +repr(oArgs) +'\n')
LOG.info("Command line: " +' '.join(sys.argv[1:]))
LOG.debug(f'oArgs = {oArgs!r}')
LOG.debug(f'oArgs = {oArgs}')
LOG.info("Starting toxygen version " +version)
self._version = version
@ -238,8 +238,8 @@ class App:
if self._uri is not None:
self._ms.add_contact(self._uri)
except Exception as e:
LOG.error(f"Error loading profile: {e!s}")
sys.stderr.write(' iMain(): ' +f"Error loading profile: {e!s}" \
LOG.error(f"Error loading profile: {e}")
sys.stderr.write(' iMain(): ' +f"Error loading profile: {e}" \
+'\n' + traceback.format_exc()+'\n')
util_ui.message_box(str(e),
util_ui.tr('Error loading profile'))
@ -350,7 +350,7 @@ class App:
self._app.setStyleSheet(style)
def _load_app_styles(self) -> None:
LOG.debug(f"_load_app_styles {list(settings.built_in_themes().keys())!r}")
LOG.debug(f"_load_app_styles {list(settings.built_in_themes().keys())}")
# application color scheme
if self._settings['theme'] in ['', 'default']: return
for theme in settings.built_in_themes().keys():
@ -478,7 +478,7 @@ class App:
# Threads
def _start_threads(self, initial_start=True) -> None:
LOG.debug(f"_start_threads before: {threading.enumerate()!r}")
LOG.debug(f"_start_threads before: {threading.enumerate()}")
# init thread
self._init = threads.InitThread(self._tox,
self._plugin_loader,
@ -487,7 +487,7 @@ class App:
initial_start)
self._init.start()
def te(): return [t.name for t in threading.enumerate()]
LOG.debug(f"_start_threads init: {te()!r}")
LOG.debug(f"_start_threads init: {te()}")
# starting threads for tox iterate and toxav iterate
self._main_loop = threads.ToxIterateThread(self._tox, app=self)
@ -498,7 +498,7 @@ class App:
if initial_start:
threads.start_file_transfer_thread()
LOG.debug(f"_start_threads after: {[t.name for t in threading.enumerate()]!r}")
LOG.debug(f"_start_threads after: {[t.name for t in threading.enumerate()]}")
def _stop_threads(self, is_app_closing=True) -> None:
LOG.debug("_stop_threads")
@ -917,7 +917,7 @@ class App:
if status > 0:
LOG.info(f"Connected # {i}" +' : ' +repr(status))
break
LOG.trace(f"Connected status #{i}: {status!r}")
LOG.trace(f"Connected status #{i}: {status}")
self.loop(2)
def _test_env(self) -> None:
@ -995,7 +995,7 @@ class App:
self._ms.log_console()
def _test_main(self) -> None:
from toxygen_tox_wrapper.tox_wrapper.tests.tests_wrapper import main as tests_main
from toxygen_toxygen_wrapper.toxygen_wrapper.tests.tests_wrapper import main as tests_main
LOG.debug("_test_main")
if not self._tox: return
title = 'Extended Test Suite'

View File

@ -3,9 +3,9 @@ import time
import threading
import itertools
from tox_wrapper.toxav_enums import *
from tox_wrapper.tests import support_testing as ts
from tox_wrapper.tests.support_testing import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
from toxygen_wrapper.toxav_enums import *
from toxygen_wrapper.tests import support_testing as ts
from toxygen_wrapper.tests.support_testing import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
with ts.ignoreStderr():
import pyaudio
@ -14,7 +14,7 @@ from av.call import Call
import common.tox_save
from utils import ui as util_ui
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
from middleware.threads import invoke_in_main_thread
from middleware.threads import BaseThread
@ -38,10 +38,10 @@ class AV(common.tox_save.ToxAvSave):
s = settings
if 'video' not in s:
LOG.warn("AV.__init__ 'video' not in s" )
LOG.debug(f"AV.__init__ {s!r}" )
LOG.debug(f"AV.__init__ {s}" )
elif 'device' not in s['video']:
LOG.warn("AV.__init__ 'device' not in s.video" )
LOG.debug(f"AV.__init__ {s['video']!r}" )
LOG.debug(f"AV.__init__ {s['video']}" )
self._calls = {} # dict: key - friend number, value - Call instance
@ -71,12 +71,15 @@ class AV(common.tox_save.ToxAvSave):
# was iOutput = self._settings._args.audio['output']
iInput = self._settings['audio']['input']
self.lPaSampleratesI = ts.lSdSamplerates(iInput)
if not self.lPaSampleratesI: LOG.warn(f"empty self.lPaSampleratesI iInput={iInput}")
iOutput = self._settings['audio']['output']
self.lPaSampleratesO = ts.lSdSamplerates(iOutput)
if not self.lPaSampleratesO: LOG.warn(f"empty self.lPaSampleratesO iOutput={iOutput}")
global oPYA
oPYA = self._audio = pyaudio.PyAudio()
def stop(self):
LOG_DEBUG(f"AV.CA stop {self._video_thread}")
self._running = False
self.stop_audio_thread()
self.stop_video_thread()
@ -126,8 +129,7 @@ class AV(common.tox_save.ToxAvSave):
self._audio_krate_tox_audio if audio_enabled else 0,
self._audio_krate_tox_video if video_enabled else 0)
except Exception as e:
LOG.debug(f"AV accept_call error from {friend_number} {self._running}" +
f"{e}")
LOG.debug(f"AV accept_call error from {friend_number} {self._running} {e}")
raise
if audio_enabled:
# may raise
@ -194,26 +196,34 @@ class AV(common.tox_save.ToxAvSave):
LOG_WARN(f"start_audio_thread device={iInput}")
return
LOG_DEBUG(f"start_audio_thread device={iInput}")
lPaSamplerates = ts.lSdSamplerates(iInput)
lPaSamplerates = ts.lSdSamplerates(iInput)
if not(len(lPaSamplerates)):
e = f"No supported sample rates for device: audio[input]={iInput!r}"
e = f"No sample rates for device: audio[input]={iInput}"
LOG_ERROR(f"start_audio_thread {e}")
#?? dunno - cancel call?
return
if not self._audio_rate_pa in lPaSamplerates:
LOG_WARN(f"{self._audio_rate_pa} not in {lPaSamplerates!r}")
if False:
self._audio_rate_pa = oPYA.get_device_info_by_index(iInput)['defaultSampleRate']
else:
LOG_WARN(f"Setting audio_rate to: {lPaSamplerates[0]}")
self._audio_rate_pa = lPaSamplerates[0]
#?? dunno - cancel call? - no let the user do it
# return
# just guessing here in case that's a false negative
lPaSamplerates = [round(oPYA.get_device_info_by_index(iInput)['defaultSampleRate'])]
if lPaSamplerates and self._audio_rate_pa in lPaSamplerates:
pass
elif lPaSamplerates:
LOG_WARN(f"{self._audio_rate_pa} not in {lPaSamplerates}")
self._audio_rate_pa = lPaSamplerates[0]
LOG_WARN(f"Setting audio_rate to: {lPaSamplerates[0]}")
elif 'defaultSampleRate' in oPYA.get_device_info_by_index(iInput):
self._audio_rate_pa = oPYA.get_device_info_by_index(iInput)['defaultSampleRate']
else:
LOG_WARN(f"{self._audio_rate_pa} not in {lPaSamplerates}")
# a float is in here - must it be int?
if type(self._audio_rate_pa) == float:
self._audio_rate_pa = round(self._audio_rate_pa)
try:
LOG_DEBUG( f"start_audio_thread framerate: {self._audio_rate_pa}" \
+f" device: {iInput}"
+f" supported: {lPaSamplerates!r}")
+f" supported: {lPaSamplerates}")
if self._audio_rate_pa not in lPaSamplerates:
LOG_WARN(f"PAudio sampling rate was {self._audio_rate_pa} changed to {lPaSamplerates[0]}")
LOG_DEBUG(f"lPaSamplerates={lPaSamplerates}")
self._audio_rate_pa = lPaSamplerates[0]
if bSTREAM_CALLBACK:
@ -256,9 +266,10 @@ class AV(common.tox_save.ToxAvSave):
# raise RuntimeError(e)
return
else:
LOG_DEBUG(f"start_audio_thread {self._audio_stream!r}")
LOG_DEBUG(f"start_audio_thread {self._audio_stream}")
def stop_audio_thread(self):
LOG_DEBUG(f"stop_audio_thread {self._audio_stream}")
if self._audio_thread is None:
return
@ -279,11 +290,11 @@ class AV(common.tox_save.ToxAvSave):
s = self._settings
if 'video' not in s:
LOG.warn("AV.__init__ 'video' not in s" )
LOG.debug(f"start_video_thread {s!r}" )
LOG.debug(f"start_video_thread {s}" )
raise RuntimeError("start_video_thread not 'video' in s)" )
elif 'device' not in s['video']:
LOG.error("start_video_thread not 'device' in s['video']" )
LOG.debug(f"start_video_thread {s['video']!r}" )
LOG.debug(f"start_video_thread {s['video']}" )
raise RuntimeError("start_video_thread not 'device' ins s['video']" )
self._video_width = s['video']['width']
self._video_height = s['video']['height']
@ -321,6 +332,7 @@ class AV(common.tox_save.ToxAvSave):
self._video_thread.start()
def stop_video_thread(self) -> None:
LOG_DEBUG(f"stop_video_thread {self._video_thread}")
if self._video_thread is None:
return
@ -331,7 +343,6 @@ class AV(common.tox_save.ToxAvSave):
try:
if not self._video_thread.is_alive(): break
except:
# AttributeError: 'NoneType' object has no attribute 'join'
break
i = i + 1
else:
@ -349,12 +360,20 @@ class AV(common.tox_save.ToxAvSave):
if self._out_stream is None:
# was iOutput = self._settings._args.audio['output']
iOutput = self._settings['audio']['output']
if not rate in self.lPaSampleratesO:
LOG.warn(f"{rate} not in {self.lPaSampleratesO!r}")
if False:
rate = oPYA.get_device_info_by_index(iOutput)['defaultSampleRate']
if self.lPaSampleratesO and rate in self.lPaSampleratesO:
pass
elif self.lPaSampleratesO:
LOG.warn(f"{rate} not in {self.lPaSampleratesO}")
LOG.warn(f"Setting audio_rate to: {self.lPaSampleratesO[0]}")
rate = self.lPaSampleratesO[0]
elif 'defaultSampleRate' in oPYA.get_device_info_by_index(iOutput):
rate = round(oPYA.get_device_info_by_index(iOutput)['defaultSampleRate'])
LOG.warn(f"Setting rate to {rate} empty self.lPaSampleratesO")
else:
LOG.warn(f"Using rate {rate} empty self.lPaSampleratesO")
if type(rate) == float:
rate = round(rate)
try:
with ts.ignoreStderr():
self._out_stream = oPYA.open(format=pyaudio.paInt16,
@ -372,7 +391,7 @@ class AV(common.tox_save.ToxAvSave):
return
iOutput = self._settings['audio']['output']
LOG.debug(f"audio_chunk output_device_index={iOutput} rate={rate} channels={channels_count}")
#trace LOG.debug(f"audio_chunk output_device_index={iOutput} rate={rate} channels={channels_count}")
self._out_stream.write(samples)
# AV sending
@ -389,7 +408,6 @@ class AV(common.tox_save.ToxAvSave):
for friend_num in self._calls:
if self._calls[friend_num].out_audio:
try:
# app.av.calls ERROR Error send_audio: One of the frame parameters was invalid. E.g. the resolution may be too small or too large, or the audio sampling rate may be unsupported
# app.av.calls ERROR Error send_audio audio_send_frame: This client is currently not in a call with the friend.
self._toxav.audio_send_frame(friend_num,
pcm,
@ -402,7 +420,8 @@ class AV(common.tox_save.ToxAvSave):
# invoke_in_main_thread(util_ui.message_box,
# str(e),
# util_ui.tr("Error send_audio audio_send_frame"))
pass
# raise #? stop ? endcall?
self.stop_audio_thread()
def send_audio(self) -> None:
"""

View File

@ -2,6 +2,7 @@
import sys
import threading
import traceback
import av.calls
from messenger.messages import *
@ -88,7 +89,9 @@ class CallsManager:
try:
self._callav.call_accept_call(friend_number, audio, video)
except Exception as e:
#
LOG.error(f"accept_call _call.accept_call ERROR for {friend_number} {e}")
LOG.debug(traceback.print_exc())
self._main_screen.call_finished()
if hasattr(self._main_screen, '_settings') and \
'audio' in self._main_screen._settings and \
@ -100,11 +103,11 @@ class CallsManager:
elif hasattr(self._main_screen, '_settings') and \
hasattr(self._main_screen._settings, 'audio') and \
'input' not in self._main_screen._settings['audio']:
LOG.warn(f"'audio' not in {self._main_screen._settings!r}")
LOG.warn(f"'audio' not in {self._main_screen._settings}")
elif hasattr(self._main_screen, '_settings') and \
hasattr(self._main_screen._settings, 'audio') and \
'input' not in self._main_screen._settings['audio']:
LOG.warn(f"'audio' not in {self._main_screen._settings!r}")
LOG.warn(f"'audio' not in {self._main_screen._settings}")
else:
LOG.warn(f"_settings not in self._main_screen")
util_ui.message_box(str(e),

View File

@ -11,9 +11,9 @@ except ImportError:
certifi = None
from user_data.settings import get_user_config_path
from tox_wrapper.tests.support_testing import _get_nodes_path
from tox_wrapper.tests.support_http import download_url
import tox_wrapper.tests.support_testing as ts
from toxygen_wrapper.tests.support_testing import _get_nodes_path
from toxygen_wrapper.tests.support_http import download_url
import toxygen_wrapper.tests.support_testing as ts
global LOG
import logging

View File

@ -1,7 +1,7 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from user_data.settings import *
from qtpy import QtCore, QtGui
from tox_wrapper.toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE
from toxygen_wrapper.toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE
import utils.util as util
import common.event as event
import contacts.common as common

View File

@ -146,7 +146,7 @@ class Contact(basecontact.BaseContact):
message.mark_as_sent()
except Exception as ex:
# wrapped C/C++ object of type QLabel has been deleted
LOG.error(f"Mark as sent: {ex!s}")
LOG.error(f"Mark as sent: {ex}")
# Message deletion

View File

@ -2,7 +2,7 @@
from qtpy import QtWidgets
import utils.ui as util_ui
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
global LOG
import logging

View File

@ -9,7 +9,7 @@ from common.tox_save import ToxSave
from contacts.group_peer_contact import GroupPeerContact
from groups.group_peer import GroupChatPeer
from middleware.callbacks import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
import tox_wrapper.toxcore_enums_and_consts as enums
import toxygen_wrapper.toxcore_enums_and_consts as enums
# LOG=util.log
global LOG

View File

@ -4,7 +4,7 @@ from contacts import contact
from contacts.contact_menu import GroupMenuGenerator
import utils.util as util
from groups.group_peer import GroupChatPeer
from tox_wrapper import toxcore_enums_and_consts as constants
from toxygen_wrapper import toxcore_enums_and_consts as constants
from common.tox_save import ToxSave
from groups.group_ban import GroupBan

View File

@ -2,7 +2,7 @@
from contacts.group_chat import GroupChat
from common.tox_save import ToxSave
import tox_wrapper.toxcore_enums_and_consts as constants
import toxygen_wrapper.toxcore_enums_and_consts as constants
global LOG
import logging

View File

@ -96,8 +96,8 @@ class Profile(basecontact.BaseContact, tox_save.ToxSave):
self._timer.start()
# Current thread 0x00007901a13ccb80 (most recent call first):
# File "/usr/local/lib/python3.11/site-packages/tox_wrapper/tox.py", line 826 in self_get_friend_list_size
# File "/usr/local/lib/python3.11/site-packages/tox_wrapper/tox.py", line 838 in self_get_friend_list
# File "/usr/local/lib/python3.11/site-packages/toxygen_wrapper/tox.py", line 826 in self_get_friend_list_size
# File "/usr/local/lib/python3.11/site-packages/toxygen_wrapper/tox.py", line 838 in self_get_friend_list
# File "/mnt/o/var/local/src/toxygen/toxygen/contacts/contact_provider.py", line 45 in get_all_friends
# File "/mnt/o/var/local/src/toxygen/toxygen/contacts/profile.py", line 90 in _reconnect
# File "/usr/lib/python3.11/threading.py", line 1401 in run

View File

@ -5,8 +5,8 @@ from time import time
from common.event import Event
from middleware.threads import invoke_in_main_thread
from tox_wrapper.tox import Tox
from tox_wrapper.toxcore_enums_and_consts import TOX_FILE_KIND, TOX_FILE_CONTROL
from toxygen_wrapper.tox import Tox
from toxygen_wrapper.toxcore_enums_and_consts import TOX_FILE_KIND, TOX_FILE_CONTROL
from middleware.callbacks import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
FILE_TRANSFER_STATE = {

View File

@ -4,9 +4,9 @@ import common.tox_save as tox_save
import utils.ui as util_ui
from groups.peers_list import PeersListGenerator
from groups.group_invite import GroupInvite
import tox_wrapper.toxcore_enums_and_consts as constants
from tox_wrapper.toxcore_enums_and_consts import *
from tox_wrapper.tox import UINT32_MAX
import toxygen_wrapper.toxcore_enums_and_consts as constants
from toxygen_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.tox import UINT32_MAX
global LOG
import logging

View File

@ -1,5 +1,5 @@
from ui.group_peers_list import PeerItem, PeerTypeItem
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
from ui.widgets import *

View File

@ -3,8 +3,8 @@ import common.tox_save as tox_save
import utils.ui as util_ui
from messenger.messages import *
from tox_wrapper.tests.support_testing import assert_main_thread
from tox_wrapper.toxcore_enums_and_consts import TOX_MAX_MESSAGE_LENGTH
from toxygen_wrapper.tests.support_testing import assert_main_thread
from toxygen_wrapper.toxcore_enums_and_consts import TOX_MAX_MESSAGE_LENGTH
global LOG
import logging

View File

@ -3,9 +3,9 @@ import sys
import os
import threading
from qtpy import QtGui
from tox_wrapper.toxcore_enums_and_consts import *
from tox_wrapper.toxav_enums import *
from tox_wrapper.tox import bin_to_string
from toxygen_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxav_enums import *
from toxygen_wrapper.tox import bin_to_string
import utils.ui as util_ui
import utils.util as util
from middleware.threads import invoke_in_main_thread, execute
@ -582,7 +582,7 @@ def group_peer_name(contacts_provider, groups_service):
else:
# FixMe: known signal to revalidate roles...
#_peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"remove_peer group {group!r} has no peer_id={peer_id} in _peers!r")
LOG_TRACE(f"remove_peer group {group} has no peer_id={peer_id} in _peers!r")
return
return wrapped
@ -597,7 +597,7 @@ def group_peer_status(contacts_provider, groups_service):
peer.status = peer_status
else:
# _peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"remove_peer group {group!r} has no peer_id={peer_id} in _peers!r")
LOG_TRACE(f"remove_peer group {group} has no peer_id={peer_id} in _peers!r")
# TODO: add info message
invoke_in_main_thread(groups_service.generate_peers_list)
@ -613,7 +613,7 @@ def group_topic(contacts_provider):
invoke_in_main_thread(group.set_status_message, topic)
else:
_peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_WARN(f"group_topic {group!r} has no peer_id={peer_id} in {_peers!r}")
LOG_WARN(f"group_topic {group} has no peer_id={peer_id} in {_peers}")
# TODO: add info message
return wrapped
@ -627,7 +627,7 @@ def group_moderation(groups_service, contacts_provider, contacts_manager, messen
else:
# FixMe: known signal to revalidate roles...
# _peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"update_peer_role group {group!r} has no peer_id={peer_id} in _peers!r")
LOG_TRACE(f"update_peer_role group {group} has no peer_id={peer_id} in _peers!r")
# TODO: add info message
def remove_peer(group, mod_peer_id, peer_id, is_ban):
@ -638,7 +638,7 @@ def group_moderation(groups_service, contacts_provider, contacts_manager, messen
else:
# FixMe: known signal to revalidate roles...
#_peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"remove_peer group {group!r} has no peer_id={peer_id} in _peers!r")
LOG_TRACE(f"remove_peer group {group} has no peer_id={peer_id} in _peers!r")
# TODO: add info message
# source_peer_number, target_peer_number,
@ -651,13 +651,13 @@ def group_moderation(groups_service, contacts_provider, contacts_manager, messen
mod_peer = group.get_peer_by_id(mod_peer_id)
if not mod_peer:
#_peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"remove_peer group {group!r} has no mod_peer_id={mod_peer_id} in _peers!r")
LOG_TRACE(f"remove_peer group {group} has no mod_peer_id={mod_peer_id} in _peers!r")
return
peer = group.get_peer_by_id(peer_id)
if not peer:
# FixMe: known signal to revalidate roles...
#_peers = [(p._name, p._peer_id) for p in group.get_peers()]
LOG_TRACE(f"remove_peer group {group!r} has no peer_id={peer_id} in _peers!r")
LOG_TRACE(f"remove_peer group {group} has no peer_id={peer_id} in _peers!r")
return
if event_type == TOX_GROUP_MOD_EVENT['KICK']:

View File

@ -6,8 +6,8 @@ from qtpy import QtCore
from bootstrap.bootstrap import *
from bootstrap.bootstrap import download_nodes_list
from tox_wrapper.toxcore_enums_and_consts import TOX_USER_STATUS, TOX_CONNECTION
import tox_wrapper.tests.support_testing as ts
from toxygen_wrapper.toxcore_enums_and_consts import TOX_USER_STATUS, TOX_CONNECTION
import toxygen_wrapper.tests.support_testing as ts
from utils import util
import time
@ -86,7 +86,7 @@ class InitThread(BaseThread):
def run(self):
# DBUG+ InitThread run: ERROR name 'ts' is not defined
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
LOG_DEBUG('InitThread run: ')
try:
if self._is_first_start and ts.bAreWeConnected() and \

View File

@ -6,12 +6,12 @@ import os
from ctypes import *
import user_data.settings
import tox_wrapper.tox
import tox_wrapper.toxcore_enums_and_consts as enums
from tox_wrapper.tests import support_testing as ts
import toxygen_wrapper.tox
import toxygen_wrapper.toxcore_enums_and_consts as enums
from toxygen_wrapper.tests import support_testing as ts
# callbacks can be called in any thread so were being careful
# tox.py can be called by callbacks
from tox_wrapper.tests.support_testing import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
from toxygen_wrapper.tests.support_testing import LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG, LOG_TRACE
global LOG
import logging
@ -34,7 +34,7 @@ def tox_factory(data=None, settings=None, args=None, app=None):
user_data.settings.clean_settings(settings)
try:
tox_options = tox_wrapper.tox.Tox.options_new()
tox_options = toxygen_wrapper.tox.Tox.options_new()
tox_options.contents.ipv6_enabled = settings['ipv6_enabled']
tox_options.contents.udp_enabled = settings['udp_enabled']
tox_options.contents.proxy_type = int(settings['proxy_type'])
@ -65,7 +65,7 @@ def tox_factory(data=None, settings=None, args=None, app=None):
tox_options.contents.ipv6_enabled = False
tox_options.contents.hole_punching_enabled = False
LOG.debug("tox_wrapper.tox.Tox settings: " +repr(settings))
LOG.debug("toxygen_wrapper.tox.Tox settings: " +repr(settings))
if 'trace_enabled' in settings and not settings['trace_enabled']:
LOG_DEBUG("settings['trace_enabled' disabled" )
@ -76,14 +76,14 @@ def tox_factory(data=None, settings=None, args=None, app=None):
else:
LOG_WARN("No tox_options._options_pointer to add self_logger_cb" )
retval = tox_wrapper.tox.Tox(tox_options)
retval = toxygen_wrapper.tox.Tox(tox_options)
except Exception as e:
if app and hasattr(app, '_log'):
pass
LOG_ERROR(f"tox_wrapper.tox.Tox failed: {e}")
LOG_ERROR(f"toxygen_wrapper.tox.Tox failed: {e}")
LOG_WARN(traceback.format_exc())
raise
if app and hasattr(app, '_log'):
app._log("DEBUG: tox_wrapper.tox.Tox succeeded")
app._log("DEBUG: toxygen_wrapper.tox.Tox succeeded")
return retval

View File

@ -2,7 +2,7 @@ import os.path
import utils.util
import wave
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
with ts.ignoreStderr():
import pyaudio
@ -36,7 +36,7 @@ class AudioFile:
self.stream.write(data)
data = self.wf.readframes(self.chunk)
except Exception as e:
LOG.error(f"Error during AudioFile play {e!s}")
LOG.error(f"Error during AudioFile play {e}")
LOG.debug("Error during AudioFile play " \
+' rate=' +str(self.wf.getframerate()) \
+ 'format=' +str(self.p.get_format_from_width(self.wf.getsampwidth())) \

View File

@ -854,14 +854,14 @@ id(42)
cmd = textwrap.dedent('''
class MyList(list):
def __init__(self):
super().__init__() # tox_wrapper_call()
super().__init__() # toxygen_wrapper_call()
id("first break point")
l = MyList()
''')
# Verify with "py-bt":
gdb_output = self.get_stack_trace(cmd,
cmds_after_breakpoint=['break tox_wrapper_call', 'continue', 'py-bt'])
cmds_after_breakpoint=['break toxygen_wrapper_call', 'continue', 'py-bt'])
self.assertRegex(gdb_output,
r"<method-wrapper u?'__init__' of MyList object at ")

View File

@ -67,10 +67,10 @@ except ImportError as e:
logging.log(logging.DEBUG, f"color_runner not available: {e}")
color_runner = None
import tox_wrapper
import tox_wrapper.toxcore_enums_and_consts as enums
from tox_wrapper.tox import Tox
from tox_wrapper.toxcore_enums_and_consts import (TOX_ADDRESS_SIZE, TOX_CONNECTION,
import toxygen_wrapper
import toxygen_wrapper.toxcore_enums_and_consts as enums
from toxygen_wrapper.tox import Tox
from toxygen_wrapper.toxcore_enums_and_consts import (TOX_ADDRESS_SIZE, TOX_CONNECTION,
TOX_FILE_CONTROL,
TOX_MESSAGE_TYPE,
TOX_SECRET_KEY_SIZE,
@ -79,7 +79,7 @@ from tox_wrapper.toxcore_enums_and_consts import (TOX_ADDRESS_SIZE, TOX_CONNECTI
try:
import support_testing as ts
except ImportError:
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
try:
from tests.toxygen_tests import test_sound_notification
@ -511,7 +511,7 @@ class ToxSuite(unittest.TestCase):
try:
oRet = method(*args)
if oRet:
LOG.info(f"wait_ensure_exec oRet {oRet!r}")
LOG.info(f"wait_ensure_exec oRet {oRet}")
return True
except ArgumentError as e:
# ArgumentError('This client is currently NOT CONNECTED to the friend.')
@ -1788,7 +1788,7 @@ def iMain(oArgs):
def oToxygenToxOptions(oArgs):
data = None
tox_options = tox_wrapper.tox.Tox.options_new()
tox_options = toxygen_wrapper.tox.Tox.options_new()
if oArgs.proxy_type:
tox_options.contents.proxy_type = int(oArgs.proxy_type)
tox_options.contents.proxy_host = bytes(oArgs.proxy_host, 'UTF-8')

View File

@ -5,7 +5,7 @@ import wave
from ui import widgets
import utils.util as util
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
with ts.ignoreStderr():
import pyaudio
@ -118,6 +118,7 @@ class IncomingCallWidget(widgets.CenteredWidget):
self.thread = None
def stop(self):
LOG.debug(f"stop from {self._friend_number}")
if self._processing:
self.close()
if self.thread is not None:
@ -128,8 +129,7 @@ class IncomingCallWidget(widgets.CenteredWidget):
if not self.thread.isRunning(): break
i = i + 1
else:
LOG.warn(f"SoundPlay {self.thread.a} BLOCKED")
# Fatal Python error: Segmentation fault
LOG.warn(f"stop {self.thread.a} BLOCKED")
self.thread.a.stream.close()
self.thread.a.p.terminate()
self.thread.a.close()
@ -153,7 +153,7 @@ class IncomingCallWidget(widgets.CenteredWidget):
# ts.trepan_handler()
if self._processing:
LOG.warn(__name__+f" accept_call_with_video from {self._friend_number}")
LOG.warn(f" accept_call_with_video from {self._friend_number}")
return
self.setWindowTitle('Answering video call')
self._processing = True
@ -164,11 +164,14 @@ class IncomingCallWidget(widgets.CenteredWidget):
self.stop()
def decline_call(self):
LOG.debug(f"decline_call from {self._friend_number}")
if self._processing:
return
self._processing = True
try:
self._calls_manager.stop_call(self._friend_number, False)
except Exception as e:
LOG.warn(f"decline_call from {self._friend_number} {e}")
finally:
self.stop()

View File

@ -1,4 +1,4 @@
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
from qtpy import QtCore, QtGui, QtWidgets
from utils.util import *
from ui.widgets import DataLabel

View File

@ -1,5 +1,5 @@
from ui.widgets import *
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
class PeerItem(QtWidgets.QWidget):

View File

@ -1,7 +1,7 @@
from qtpy import uic
import utils.util as util
from ui.widgets import *
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
class BaseGroupScreen(CenteredWidget):

View File

@ -1,7 +1,7 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
from qtpy import QtCore, QtGui, QtWidgets, uic
import tox_wrapper.tests.support_testing as ts
import toxygen_wrapper.tests.support_testing as ts
with ts.ignoreStderr(): # not out
import pyaudio
@ -504,7 +504,7 @@ class AudioSettings(CenteredWidget):
def closeEvent(self, event):
if 'audio' not in self._settings:
ex = f"self._settings=id(self._settings) {self._settings!r}"
ex = f"self._settings=id(self._settings) {self._settings}"
LOG.warn('AudioSettings.closeEvent settings error: ' + str(ex))
else:
self._settings['audio']['input'] = \
@ -574,7 +574,7 @@ class VideoSettings(CenteredWidget):
if index in self._devices:
self._settings['video']['device'] = self._devices[index]
else:
LOG.warn(f"{index} not in deviceComboBox self._devices {self._devices!r}")
LOG.warn(f"{index} not in deviceComboBox self._devices {self._devices}")
text = self.resolutionComboBox.currentText()
if len(text.split(' ')[0]) > 1:
self._settings['video']['width'] = int(text.split(' ')[0])
@ -621,7 +621,7 @@ class VideoSettings(CenteredWidget):
self.deviceComboBox.addItem(util_ui.tr('Device #') + str(i))
if 'device' not in self._settings['video']:
LOG.warn(f"'device' not in self._settings['video']: {self._settings!r}")
LOG.warn(f"'device' not in self._settings['video']: {self._settings}")
self._settings['video']['device'] = self._devices[-1]
iIndex = self._settings['video']['device']
try:

View File

@ -1,4 +1,4 @@
from tox_wrapper.toxcore_enums_and_consts import *
from toxygen_wrapper.toxcore_enums_and_consts import *
import ui.widgets as widgets
import utils.util as util
import ui.menu as menu

View File

@ -3,7 +3,7 @@ from qtpy import uic
import utils.util as util
import utils.ui as util_ui
from ui.contact_items import *
import tox_wrapper.toxcore_enums_and_consts as consts
import toxygen_wrapper.toxcore_enums_and_consts as consts
class PeerScreen(CenteredWidget):

View File

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