AudioQThread
Some checks failed
CI / Python ${{ matrix.python-version }} (3.10) (push) Has been cancelled
CI / Python ${{ matrix.python-version }} (3.7) (push) Has been cancelled
CI / Python ${{ matrix.python-version }} (3.8) (push) Has been cancelled
CI / Python ${{ matrix.python-version }} (3.9) (push) Has been cancelled

This commit is contained in:
emdee@spm.plastiras.org 2024-02-12 13:14:59 +00:00
parent d9ef18631d
commit f7e260a355
10 changed files with 27 additions and 27 deletions

1
toxygen/.#.pylint.out Symbolic link
View File

@ -0,0 +1 @@
root@pentoo.5923:1706589296

View File

@ -1,24 +1,22 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import sys import sys
import os import os
import app
import logging import logging
import signal import signal
import time import time
import warnings
import faulthandler
from gevent import monkey; monkey.patch_all(); del monkey # noqa from gevent import monkey; monkey.patch_all(); del monkey # noqa
import faulthandler
faulthandler.enable() faulthandler.enable()
import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
import toxygen_wrapper.tests.support_testing as ts import toxygen_wrapper.tests.support_testing as ts
try: try:
from trepan.interfaces import server as Mserver from trepan.interfaces import server as Mserver
from trepan.api import debug from trepan.api import debug
except: except Exception as e:
print('trepan3 TCP server NOT enabled.') print('trepan3 TCP server NOT enabled.')
else: else:
import signal import signal
@ -27,6 +25,7 @@ else:
print('trepan3 TCP server enabled on port 6666.') print('trepan3 TCP server enabled on port 6666.')
except: pass except: pass
import app
from user_data.settings import * from user_data.settings import *
from user_data.settings import Settings from user_data.settings import Settings
from user_data import settings from user_data import settings
@ -40,7 +39,7 @@ __version__ = '1.0.0' # was 0.5.0+
path = os.path.dirname(os.path.realpath(__file__)) # curr dir path = os.path.dirname(os.path.realpath(__file__)) # curr dir
sys.path.insert(0, os.path.join(path, 'styles')) sys.path.insert(0, os.path.join(path, 'styles'))
sys.path.insert(0, os.path.join(path, 'plugins')) sys.path.insert(0, os.path.join(path, 'plugins'))
sys.path.insert(0, os.path.join(path, 'third_party')) # sys.path.insert(0, os.path.join(path, 'third_party'))
sys.path.insert(0, path) sys.path.insert(0, path)
sleep = time.sleep sleep = time.sleep

View File

@ -1,6 +1,7 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import time import time
import threading import threading
import logging
import itertools import itertools
from toxygen_wrapper.toxav_enums import * from toxygen_wrapper.toxav_enums import *
@ -14,14 +15,12 @@ from av.call import Call
import common.tox_save import common.tox_save
from utils import ui as util_ui from utils import ui as util_ui
import toxygen_wrapper.tests.support_testing as ts
from middleware.threads import invoke_in_main_thread from middleware.threads import invoke_in_main_thread
from middleware.threads import BaseThread, BaseQThread # from middleware.threads import BaseThread
sleep = time.sleep sleep = time.sleep
global LOG global LOG
import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
TIMER_TIMEOUT = 30.0 TIMER_TIMEOUT = 30.0
@ -463,7 +462,7 @@ class AV(common.tox_save.ToxAvSave):
count, count,
self._audio_channels, self._audio_channels,
self._audio_rate_tox) self._audio_rate_tox)
ts)
except Exception as e: except Exception as e:
LOG.error(f"Error send_audio_data audio_send_frame: {e}") LOG.error(f"Error send_audio_data audio_send_frame: {e}")
LOG.debug(f"send_audio_data self._audio_rate_tox={self._audio_rate_tox} self._audio_channels={self._audio_channels}") LOG.debug(f"send_audio_data self._audio_rate_tox={self._audio_rate_tox} self._audio_channels={self._audio_channels}")

View File

@ -12,6 +12,7 @@ from messenger.messages import *
from ui import av_widgets from ui import av_widgets
import common.event as event import common.event as event
import utils.ui as util_ui import utils.ui as util_ui
from toxygen_wrapper.tests import support_testing as ts
global LOG global LOG
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)

View File

@ -1,8 +1,7 @@
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
import random import random
import urllib.request import logging
from utils.util import *
from qtpy import QtNetwork
from qtpy import QtCore from qtpy import QtCore
try: try:
import certifi import certifi
@ -11,12 +10,13 @@ except ImportError:
certifi = None certifi = None
from user_data.settings import get_user_config_path from user_data.settings import get_user_config_path
from utils.util import *
from toxygen_wrapper.tests.support_testing import _get_nodes_path from toxygen_wrapper.tests.support_testing import _get_nodes_path
from toxygen_wrapper.tests.support_http import download_url from toxygen_wrapper.tests.support_http import download_url
import toxygen_wrapper.tests.support_testing as ts import toxygen_wrapper.tests.support_testing as ts
global LOG global LOG
import logging
LOG = logging.getLogger('app.'+'bootstrap') LOG = logging.getLogger('app.'+'bootstrap')
def download_nodes_list(settings, oArgs): def download_nodes_list(settings, oArgs):

View File

@ -41,14 +41,14 @@ class ContactProvider(tox_save.ToxSave):
LOG_DEBUG(f"CP.get_friend_by_public_key ADDED {friend} ") LOG_DEBUG(f"CP.get_friend_by_public_key ADDED {friend} ")
return friend return friend
def get_all_friends(self): def get_all_friends(self) -> list:
if self._app and self._app.bAppExiting: if self._app and self._app.bAppExiting:
return return []
try: try:
friend_numbers = self._tox.self_get_friend_list() friend_numbers = self._tox.self_get_friend_list()
except Exception as e: except Exception as e:
LOG_WARN(f"CP.get_all_friends EXCEPTION {e} ") LOG_WARN(f"CP.get_all_friends EXCEPTION {e} ")
return None return []
friends = map(lambda n: self.get_friend_by_number(n), friend_numbers) friends = map(lambda n: self.get_friend_by_number(n), friend_numbers)
return list(friends) return list(friends)

View File

@ -1,9 +1,9 @@
import os
from contacts import contact, common from contacts import contact, common
from messenger.messages import * from messenger.messages import *
import os
from contacts.contact_menu import * from contacts.contact_menu import *
class Friend(contact.Contact): class Friend(contact.Contact):
""" """
Friend in list of friends. Friend in list of friends.
@ -27,7 +27,7 @@ class Friend(contact.Contact):
self._corr.insert(i, inline) self._corr.insert(i, inline)
return i - len(self._corr) return i - len(self._corr)
except: except:
pass return -1
def get_unsent_files(self): def get_unsent_files(self):
messages = filter(lambda m: type(m) is UnsentFileMessage, self._corr) messages = filter(lambda m: type(m) is UnsentFileMessage, self._corr)

View File

@ -328,11 +328,11 @@ class ReceiveAvatar(ReceiveTransfer):
self._file.close() self._file.close()
remove(full_path) remove(full_path)
elif exists(path): elif exists(path):
hash = self.get_file_id() ihash = self.get_file_id()
with open(path, 'rb') as fl: with open(path, 'rb') as fl:
data = fl.read() data = fl.read()
existing_hash = Tox.hash(data) existing_ihash = Tox.hash(data)
if hash == existing_hash: if ihash == existing_hash:
self.send_control(TOX_FILE_CONTROL['CANCEL']) self.send_control(TOX_FILE_CONTROL['CANCEL'])
self._file.close() self._file.close()
remove(full_path) remove(full_path)

View File

@ -50,7 +50,7 @@ class FileTransfersHandler(ToxSave):
friend = self._get_friend_by_number(friend_number) friend = self._get_friend_by_number(friend_number)
if friend is None: if friend is None:
LOG.info(f'incoming_file_handler Friend NULL friend_number={friend_number}') LOG.info(f'incoming_file_handler Friend NULL friend_number={friend_number}')
return None return
auto = self._settings['allow_auto_accept'] and friend.tox_id in self._settings['auto_accept_from_friends'] auto = self._settings['allow_auto_accept'] and friend.tox_id in self._settings['auto_accept_from_friends']
inline = False # ?is_inline(file_name) and self._settings['allow_inline'] inline = False # ?is_inline(file_name) and self._settings['allow_inline']
file_id = self._tox.file_get_file_id(friend_number, file_number) file_id = self._tox.file_get_file_id(friend_number, file_number)
@ -234,7 +234,7 @@ class FileTransfersHandler(ToxSave):
def send_files(self, friend_number): def send_files(self, friend_number):
try: try:
friend = self._get_friend_by_number(friend_number) friend = self._get_friend_by_number(friend_number)
if friend is None: return None if friend is None: return
friend.remove_invalid_unsent_files() friend.remove_invalid_unsent_files()
files = friend.get_unsent_files() files = friend.get_unsent_files()
for fl in files: for fl in files:
@ -317,7 +317,7 @@ class FileTransfersHandler(ToxSave):
:param size: size of avatar or 0 (default avatar) :param size: size of avatar or 0 (default avatar)
""" """
friend = self._get_friend_by_number(friend_number) friend = self._get_friend_by_number(friend_number)
if friend is None: return None if friend is None: return
ra = ReceiveAvatar(friend.get_contact_avatar_path(), self._tox, friend_number, size, file_number) ra = ReceiveAvatar(friend.get_contact_avatar_path(), self._tox, friend_number, size, file_number)
if ra.state != FILE_TRANSFER_STATE['CANCELLED']: if ra.state != FILE_TRANSFER_STATE['CANCELLED']:
self._file_transfers[(friend_number, file_number)] = ra self._file_transfers[(friend_number, file_number)] = ra

View File

@ -237,7 +237,7 @@ class Settings(dict):
Mark current profile as active Mark current profile as active
""" """
if not profile_path: if not profile_path:
profile_path = get_auto_profile() profile_path = self.get_auto_profile()
path = profile_path + '.lock' path = profile_path + '.lock'
try: try: