AudioQThread
This commit is contained in:
parent
d9ef18631d
commit
f7e260a355
10 changed files with 27 additions and 27 deletions
1
toxygen/.#.pylint.out
Symbolic link
1
toxygen/.#.pylint.out
Symbolic link
|
@ -0,0 +1 @@
|
|||
root@pentoo.5923:1706589296
|
|
@ -1,24 +1,22 @@
|
|||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||
import sys
|
||||
import os
|
||||
import app
|
||||
import logging
|
||||
import signal
|
||||
import time
|
||||
import warnings
|
||||
import faulthandler
|
||||
|
||||
from gevent import monkey; monkey.patch_all(); del monkey # noqa
|
||||
|
||||
import faulthandler
|
||||
faulthandler.enable()
|
||||
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore')
|
||||
|
||||
import toxygen_wrapper.tests.support_testing as ts
|
||||
try:
|
||||
from trepan.interfaces import server as Mserver
|
||||
from trepan.api import debug
|
||||
except:
|
||||
except Exception as e:
|
||||
print('trepan3 TCP server NOT enabled.')
|
||||
else:
|
||||
import signal
|
||||
|
@ -27,6 +25,7 @@ else:
|
|||
print('trepan3 TCP server enabled on port 6666.')
|
||||
except: pass
|
||||
|
||||
import app
|
||||
from user_data.settings import *
|
||||
from user_data.settings 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
|
||||
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, 'third_party'))
|
||||
# sys.path.insert(0, os.path.join(path, 'third_party'))
|
||||
sys.path.insert(0, path)
|
||||
|
||||
sleep = time.sleep
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||
import time
|
||||
import threading
|
||||
import logging
|
||||
import itertools
|
||||
|
||||
from toxygen_wrapper.toxav_enums import *
|
||||
|
@ -14,14 +15,12 @@ from av.call import Call
|
|||
import common.tox_save
|
||||
|
||||
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 BaseThread, BaseQThread
|
||||
# from middleware.threads import BaseThread
|
||||
|
||||
sleep = time.sleep
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
LOG = logging.getLogger('app.'+__name__)
|
||||
|
||||
TIMER_TIMEOUT = 30.0
|
||||
|
@ -463,7 +462,7 @@ class AV(common.tox_save.ToxAvSave):
|
|||
count,
|
||||
self._audio_channels,
|
||||
self._audio_rate_tox)
|
||||
ts)
|
||||
|
||||
except Exception as 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}")
|
||||
|
|
|
@ -12,6 +12,7 @@ from messenger.messages import *
|
|||
from ui import av_widgets
|
||||
import common.event as event
|
||||
import utils.ui as util_ui
|
||||
from toxygen_wrapper.tests import support_testing as ts
|
||||
|
||||
global LOG
|
||||
LOG = logging.getLogger('app.'+__name__)
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*-
|
||||
import random
|
||||
import urllib.request
|
||||
from utils.util import *
|
||||
from qtpy import QtNetwork
|
||||
import logging
|
||||
|
||||
from qtpy import QtCore
|
||||
try:
|
||||
import certifi
|
||||
|
@ -11,12 +10,13 @@ except ImportError:
|
|||
certifi = None
|
||||
|
||||
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_http import download_url
|
||||
import toxygen_wrapper.tests.support_testing as ts
|
||||
|
||||
global LOG
|
||||
import logging
|
||||
LOG = logging.getLogger('app.'+'bootstrap')
|
||||
|
||||
def download_nodes_list(settings, oArgs):
|
||||
|
|
|
@ -41,14 +41,14 @@ class ContactProvider(tox_save.ToxSave):
|
|||
LOG_DEBUG(f"CP.get_friend_by_public_key ADDED {friend} ")
|
||||
return friend
|
||||
|
||||
def get_all_friends(self):
|
||||
def get_all_friends(self) -> list:
|
||||
if self._app and self._app.bAppExiting:
|
||||
return
|
||||
return []
|
||||
try:
|
||||
friend_numbers = self._tox.self_get_friend_list()
|
||||
except Exception as 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)
|
||||
return list(friends)
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import os
|
||||
|
||||
from contacts import contact, common
|
||||
from messenger.messages import *
|
||||
import os
|
||||
from contacts.contact_menu import *
|
||||
|
||||
|
||||
class Friend(contact.Contact):
|
||||
"""
|
||||
Friend in list of friends.
|
||||
|
@ -27,7 +27,7 @@ class Friend(contact.Contact):
|
|||
self._corr.insert(i, inline)
|
||||
return i - len(self._corr)
|
||||
except:
|
||||
pass
|
||||
return -1
|
||||
|
||||
def get_unsent_files(self):
|
||||
messages = filter(lambda m: type(m) is UnsentFileMessage, self._corr)
|
||||
|
|
|
@ -328,11 +328,11 @@ class ReceiveAvatar(ReceiveTransfer):
|
|||
self._file.close()
|
||||
remove(full_path)
|
||||
elif exists(path):
|
||||
hash = self.get_file_id()
|
||||
ihash = self.get_file_id()
|
||||
with open(path, 'rb') as fl:
|
||||
data = fl.read()
|
||||
existing_hash = Tox.hash(data)
|
||||
if hash == existing_hash:
|
||||
existing_ihash = Tox.hash(data)
|
||||
if ihash == existing_hash:
|
||||
self.send_control(TOX_FILE_CONTROL['CANCEL'])
|
||||
self._file.close()
|
||||
remove(full_path)
|
||||
|
|
|
@ -50,7 +50,7 @@ class FileTransfersHandler(ToxSave):
|
|||
friend = self._get_friend_by_number(friend_number)
|
||||
if friend is None:
|
||||
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']
|
||||
inline = False # ?is_inline(file_name) and self._settings['allow_inline']
|
||||
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):
|
||||
try:
|
||||
friend = self._get_friend_by_number(friend_number)
|
||||
if friend is None: return None
|
||||
if friend is None: return
|
||||
friend.remove_invalid_unsent_files()
|
||||
files = friend.get_unsent_files()
|
||||
for fl in files:
|
||||
|
@ -317,7 +317,7 @@ class FileTransfersHandler(ToxSave):
|
|||
:param size: size of avatar or 0 (default avatar)
|
||||
"""
|
||||
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)
|
||||
if ra.state != FILE_TRANSFER_STATE['CANCELLED']:
|
||||
self._file_transfers[(friend_number, file_number)] = ra
|
||||
|
|
|
@ -237,7 +237,7 @@ class Settings(dict):
|
|||
Mark current profile as active
|
||||
"""
|
||||
if not profile_path:
|
||||
profile_path = get_auto_profile()
|
||||
profile_path = self.get_auto_profile()
|
||||
|
||||
path = profile_path + '.lock'
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue