This commit is contained in:
emdee 2022-09-27 16:02:36 +00:00
parent 870e3125ad
commit a365b7d54c
9 changed files with 166 additions and 123 deletions

View file

@ -21,6 +21,7 @@ LOG = logging.getLogger('app.'+__name__)
TIMER_TIMEOUT = 30.0 TIMER_TIMEOUT = 30.0
bSTREAM_CALLBACK = False bSTREAM_CALLBACK = False
iFPS = 25
class AV(common.tox_save.ToxAvSave): class AV(common.tox_save.ToxAvSave):
@ -56,7 +57,7 @@ class AV(common.tox_save.ToxAvSave):
self._video = None self._video = None
self._video_thread = None self._video_thread = None
self._video_running = False self._video_running = None
self._video_width = 320 self._video_width = 320
self._video_height = 240 self._video_height = 240
@ -278,12 +279,7 @@ class AV(common.tox_save.ToxAvSave):
self._video_width = s['video']['width'] self._video_width = s['video']['width']
self._video_height = s['video']['height'] self._video_height = s['video']['height']
LOG.info("start_video_thread " \ if True or s['video']['device'] == -1:
+f" device: {s['video']['device']}" \
+f" supported: {s['video']['width']} {s['video']['height']}")
s['video']['device'] = -1
if s['video']['device'] == -1:
self._video = screen_sharing.DesktopGrabber(s['video']['x'], self._video = screen_sharing.DesktopGrabber(s['video']['x'],
s['video']['y'], s['video']['y'],
s['video']['width'], s['video']['width'],
@ -291,10 +287,23 @@ class AV(common.tox_save.ToxAvSave):
else: else:
with ts.ignoreStdout(): with ts.ignoreStdout():
import cv2 import cv2
if s['video']['device'] == 0:
# webcam
self._video = cv2.VideoCapture(s['video']['device'], cv2.DSHOW)
else:
self._video = cv2.VideoCapture(s['video']['device']) self._video = cv2.VideoCapture(s['video']['device'])
self._video.set(cv2.CAP_PROP_FPS, 25) self._video.set(cv2.CAP_PROP_FPS, iFPS)
self._video.set(cv2.CAP_PROP_FRAME_WIDTH, self._video_width) self._video.set(cv2.CAP_PROP_FRAME_WIDTH, self._video_width)
self._video.set(cv2.CAP_PROP_FRAME_HEIGHT, self._video_height) self._video.set(cv2.CAP_PROP_FRAME_HEIGHT, self._video_height)
# self._video.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))
if self._video is None:
LOG.error("start_video_thread " \
+f" device: {s['video']['device']}" \
+f" supported: {s['video']['width']} {s['video']['height']}")
return
LOG.info("start_video_thread " \
+f" device: {s['video']['device']}" \
+f" supported: {s['video']['width']} {s['video']['height']}")
self._video_running = True self._video_running = True
self._video_thread = BaseThread(target=self.send_video, self._video_thread = BaseThread(target=self.send_video,
@ -346,7 +355,6 @@ class AV(common.tox_save.ToxAvSave):
output=True) output=True)
except Exception as e: except Exception as e:
LOG.error(f"Error playing audio_chunk creating self._out_stream {e}") LOG.error(f"Error playing audio_chunk creating self._out_stream {e}")
LOG.debug(f"audio_chunk output_device_index={self._settings._args.audio['input']} rate={rate} channels={channels_count}")
invoke_in_main_thread(util_ui.message_box, invoke_in_main_thread(util_ui.message_box,
str(e), str(e),
util_ui.tr("Error Chunking audio")) util_ui.tr("Error Chunking audio"))
@ -354,6 +362,7 @@ class AV(common.tox_save.ToxAvSave):
self.stop() self.stop()
return return
LOG.debug(f"audio_chunk output_device_index={self._settings._args.audio['input']} rate={rate} channels={channels_count}")
self._out_stream.write(samples) self._out_stream.write(samples)
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
@ -410,18 +419,30 @@ class AV(common.tox_save.ToxAvSave):
""" """
This method sends video to friends This method sends video to friends
""" """
LOG.debug(f"send_video thread={threading.current_thread()}" LOG.debug(f"send_video thread={threading.current_thread().name}"
+f" self._video_running={self._video_running}" +f" self._video_running={self._video_running}"
+f" device: {self._settings['video']['device']}" ) +f" device: {self._settings['video']['device']}" )
while self._video_running: while self._video_running:
try: try:
result, frame = self._video.read() result, frame = self._video.read()
if result: if not result:
LOG.warn(f"send_video video_send_frame _video.read") LOG.warn(f"send_video video_send_frame _video.read result={result}")
break
if frame is None:
LOG.warn(f"send_video video_send_frame _video.read result={result} frame={frame}")
continue
else: else:
LOG.debug(f"send_video video_send_frame _video.read result={result}")
height, width, channels = frame.shape height, width, channels = frame.shape
friends = []
for friend_num in self._calls: for friend_num in self._calls:
if self._calls[friend_num].out_video: if self._calls[friend_num].out_video:
friends.append(friend_num)
if len(friends) == 0:
LOG.warn(f"send_video video_send_frame no friends")
else:
LOG.debug(f"send_video video_send_frame {friends}")
friend_num = friends[0]
try: try:
y, u, v = self.convert_bgr_to_yuv(frame) y, u, v = self.convert_bgr_to_yuv(frame)
self._toxav.video_send_frame(friend_num, width, height, y, u, v) self._toxav.video_send_frame(friend_num, width, height, y, u, v)
@ -429,10 +450,11 @@ class AV(common.tox_save.ToxAvSave):
LOG.debug(f"send_video video_send_frame ERROR {e}") LOG.debug(f"send_video video_send_frame ERROR {e}")
pass pass
except: except Exception as e:
LOG.error(f"send_video video_send_frame {e}")
pass pass
sleep(0.1) sleep( 1.0/iFPS)
def convert_bgr_to_yuv(self, frame): def convert_bgr_to_yuv(self, frame):
""" """

View file

@ -1,4 +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 traceback
from contacts.friend import Friend from contacts.friend import Friend
from contacts.group_chat import GroupChat from contacts.group_chat import GroupChat
from messenger.messages import * from messenger.messages import *
@ -11,6 +14,8 @@ import logging
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+__name__)
log = lambda x: LOG.info(x) log = lambda x: LOG.info(x)
UINT32_MAX = 2 ** 32 -1
class ContactsManager(ToxSave): class ContactsManager(ToxSave):
""" """
Represents contacts list. Represents contacts list.
@ -21,6 +26,7 @@ class ContactsManager(ToxSave):
super().__init__(tox) super().__init__(tox)
self._settings = settings self._settings = settings
self._screen = screen self._screen = screen
self._ms = screen
self._profile_manager = profile_manager self._profile_manager = profile_manager
self._contact_provider = contact_provider self._contact_provider = contact_provider
self._tox_dns = tox_dns self._tox_dns = tox_dns
@ -34,6 +40,8 @@ class ContactsManager(ToxSave):
self._history = history self._history = history
self._load_contacts() self._load_contacts()
def _log(self, s): self._ms(s)
def get_contact(self, num): def get_contact(self, num):
if num < 0 or num >= len(self._contacts): if num < 0 or num >= len(self._contacts):
return None return None
@ -106,6 +114,7 @@ class ContactsManager(ToxSave):
current_contact.curr_text = self._screen.messageEdit.toPlainText() current_contact.curr_text = self._screen.messageEdit.toPlainText()
except: except:
pass pass
# IndexError: list index out of range
contact = self._contacts[value] contact = self._contacts[value]
self._subscribe_to_events(contact) self._subscribe_to_events(contact)
contact.remove_invalid_unsent_files() contact.remove_invalid_unsent_files()
@ -137,7 +146,7 @@ class ContactsManager(ToxSave):
except Exception as ex: # no friend found. ignore except Exception as ex: # no friend found. ignore
LOG.warn(f"no friend found. Friend value: {value!s}") LOG.warn(f"no friend found. Friend value: {value!s}")
LOG.error('in set active: ' + str(ex)) LOG.error('in set active: ' + str(ex))
raise # gulp raise
active_contact = property(get_active, set_active) active_contact = property(get_active, set_active)
@ -322,7 +331,7 @@ class ContactsManager(ToxSave):
Block user with specified tox id (or public key) - delete from friends list and ignore friend requests Block user with specified tox id (or public key) - delete from friends list and ignore friend requests
""" """
tox_id = tox_id[:TOX_PUBLIC_KEY_SIZE * 2] tox_id = tox_id[:TOX_PUBLIC_KEY_SIZE * 2]
if tox_id == self._tox.self_get_address[:TOX_PUBLIC_KEY_SIZE * 2]: if tox_id == self._tox.self_get_address()[:TOX_PUBLIC_KEY_SIZE * 2]:
return return
if tox_id not in self._settings['blocked']: if tox_id not in self._settings['blocked']:
self._settings['blocked'].append(tox_id) self._settings['blocked'].append(tox_id)
@ -424,25 +433,35 @@ class ContactsManager(ToxSave):
""" """
try: try:
message = message or 'Hello! Add me to your contact list please' message = message or 'Hello! Add me to your contact list please'
if '@' in tox_id: # value like groupbot@toxme.io
tox_id = self._tox_dns.lookup(tox_id)
if tox_id is None:
raise Exception('TOX DNS lookup failed')
if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key if len(tox_id) == TOX_PUBLIC_KEY_SIZE * 2: # public key
self.add_friend(tox_id) self.add_friend(tox_id)
title = util_ui.tr('Friend added') title = 'Friend added'
text = util_ui.tr('Friend added without sending friend request') text = 'Friend added without sending friend request'
util_ui.message_box(text, title)
else: else:
self._tox.friend_add(tox_id, message.encode('utf-8')) num = self._tox.friend_add(tox_id, message.encode('utf-8'))
tox_id = tox_id[:TOX_PUBLIC_KEY_SIZE * 2] if num < UINT32_MAX:
self._add_friend(tox_id) tox_pk = tox_id[:TOX_PUBLIC_KEY_SIZE * 2]
self._add_friend(tox_pk)
self.update_filtration() self.update_filtration()
title = 'Friend added'
text = 'Friend added by sending friend request'
self.save_profile() self.save_profile()
return True retval = True
else:
title = 'Friend failed'
text = 'Friend failed sending friend request'
retval = text
except Exception as ex: # wrong data except Exception as ex: # wrong data
LOG.error('Friend request failed with ' + str(ex)) title = 'Friend add exception'
return str(ex) text = 'Friend request exception with ' + str(ex)
self._log(text)
LOG.error(traceback.format_exc())
retval = str(ex)
title = util_ui.tr(title)
text = util_ui.tr(text)
util_ui.message_box(text, title)
return retval
def process_friend_request(self, tox_id, message): def process_friend_request(self, tox_id, message):
""" """

BIN
toxygen/images/icon.xcf Normal file

Binary file not shown.

View file

@ -29,7 +29,6 @@ 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
import utils.util as util import utils.util as util
from tests import omain
with ts.ignoreStderr(): with ts.ignoreStderr():
import pyaudio import pyaudio
@ -272,7 +271,7 @@ def main_parser():
parser.add_argument('--download_nodes_url', type=str, parser.add_argument('--download_nodes_url', type=str,
default='https://nodes.tox.chat/json') default='https://nodes.tox.chat/json')
parser.add_argument('--network', type=str, parser.add_argument('--network', type=str,
choices=['main', 'new', 'local', 'newlocal'], choices=['old', 'new', 'local', 'newlocal'],
default='new') default='new')
parser.add_argument('--video_input', type=str, parser.add_argument('--video_input', type=str,
default=-1, default=-1,
@ -307,8 +306,13 @@ lKEEP_SETTINGS = ['uri',
'loglevel', 'loglevel',
'logfile', 'logfile',
'mode', 'mode',
# dunno
'audio_input',
'audio_output',
'audio', 'audio',
'video', 'video',
'ipv6_enabled', 'ipv6_enabled',
'udp_enabled', 'udp_enabled',
'local_discovery_enabled', 'local_discovery_enabled',
@ -326,20 +330,6 @@ lKEEP_SETTINGS = ['uri',
'audio', 'audio',
'video' 'video'
] # , 'nodes_json' ] # , 'nodes_json'
lBOOLEANS = [
'local_discovery_enabled',
'udp_enabled',
'ipv6_enabled',
'compact_mode',
'allow_inline',
'notifications',
'sound_notifications',
'hole_punching_enabled',
'dht_announcements_enabled',
'save_history',
'download_nodes_list'
'core_logging',
]
class A(): pass class A(): pass
@ -373,7 +363,7 @@ def main(lArgs):
if getattr(default_ns, key) == getattr(oArgs, key): if getattr(default_ns, key) == getattr(oArgs, key):
delattr(oArgs, key) delattr(oArgs, key)
for key in lBOOLEANS: for key in ts.lBOOLEANS:
if not hasattr(oArgs, key): continue if not hasattr(oArgs, key): continue
val = getattr(oArgs, key) val = getattr(oArgs, key)
if type(val) == bool: continue if type(val) == bool: continue
@ -385,15 +375,15 @@ def main(lArgs):
aArgs = A() aArgs = A()
for key in oArgs.__dict__.keys(): for key in oArgs.__dict__.keys():
setattr(aArgs, key, getattr(oArgs, key)) setattr(aArgs, key, getattr(oArgs, key))
setattr(aArgs, 'video', setup_video(oArgs)) #setattr(aArgs, 'video', setup_video(oArgs))
aArgs.video = setup_video(oArgs) aArgs.video = setup_video(oArgs)
assert 'video' in aArgs.__dict__ assert 'video' in aArgs.__dict__
setattr(aArgs, 'audio', setup_audio(oArgs)) #setattr(aArgs, 'audio', setup_audio(oArgs))
aArgs.audio = setup_audio(oArgs) aArgs.audio = setup_audio(oArgs)
assert 'audio' in aArgs.__dict__ assert 'audio' in aArgs.__dict__
oArgs = aArgs oArgs = aArgs
toxygen = app.App(__version__, oArgs) toxygen = app.App(__version__, oArgs)
global oAPP global oAPP
oAPP = toxygen oAPP = toxygen

View file

@ -1,4 +1,5 @@
# -*- 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 os import os
import threading import threading
from PyQt5 import QtGui from PyQt5 import QtGui
@ -13,10 +14,10 @@ from notifications.sound import *
from datetime import datetime from datetime import datetime
iMAX_INT32 = 4294967295 iMAX_INT32 = 4294967295
def LOG_ERROR(l): print('ERRORc: '+l) def LOG_ERROR(l): print('EROR< '+l)
def LOG_WARN(l): print('WARNc: '+l) def LOG_WARN(l): print('WARN< '+l)
def LOG_INFO(l): print('INFOc: '+l) def LOG_INFO(l): print('INFO< '+l)
def LOG_DEBUG(l): print('DEBUGc: '+l) def LOG_DEBUG(l): print('DBUG< '+l)
def LOG_TRACE(l): pass # print('TRACE+ '+l) def LOG_TRACE(l): pass # print('TRACE+ '+l)
global aTIMES global aTIMES
@ -45,6 +46,7 @@ def bTooSoon(key, sSlot, fSec=10.0):
global iBYTES global iBYTES
iBYTES=0 iBYTES=0
def sProcBytes(sFile=None): def sProcBytes(sFile=None):
if sys.platform == 'win32': return ''
global iBYTES global iBYTES
if sFile is None: if sFile is None:
pid = os.getpid() pid = os.getpid()
@ -69,13 +71,11 @@ def self_connection_status(tox, profile):
""" """
Current user changed connection status (offline, TCP, UDP) Current user changed connection status (offline, TCP, UDP)
""" """
pid = os.getpid()
sFile = '/proc/'+str(pid) +'/net/softnet_stat'
sSlot = 'self connection status' sSlot = 'self connection status'
def wrapped(tox_link, connection, user_data): def wrapped(tox_link, connection, user_data):
key = f"connection {connection}" key = f"connection {connection}"
if bTooSoon(key, sSlot, 10): return if bTooSoon(key, sSlot, 10): return
s = sProcBytes(sFile) s = sProcBytes()
try: try:
status = tox.self_get_status() if connection != TOX_CONNECTION['NONE'] else None status = tox.self_get_status() if connection != TOX_CONNECTION['NONE'] else None
if status: if status:
@ -148,10 +148,10 @@ def friend_name(contacts_provider, messenger):
""" """
key = f"friend_number={friend_number}" key = f"friend_number={friend_number}"
if bTooSoon(key, sSlot, 60): return if bTooSoon(key, sSlot, 60): return
LOG_DEBUG(f'New name friend #' + str(friend_number))
friend = contacts_provider.get_friend_by_number(friend_number) friend = contacts_provider.get_friend_by_number(friend_number)
old_name = friend.name old_name = friend.name
new_name = str(name, 'utf-8') new_name = str(name, 'utf-8')
LOG_DEBUG(f"get_friend_by_number #{friend_number} {new_name}")
invoke_in_main_thread(friend.set_name, new_name) invoke_in_main_thread(friend.set_name, new_name)
invoke_in_main_thread(messenger.new_friend_name, friend, old_name, new_name) invoke_in_main_thread(messenger.new_friend_name, friend, old_name, new_name)
@ -364,7 +364,7 @@ def callback_audio(calls_manager):
New audio chunk New audio chunk
""" """
LOG_DEBUG(f"callback_audio #{friend_number}") LOG_DEBUG(f"callback_audio #{friend_number}")
# guessing was .call # dunno was .call
calls_manager._call.audio_chunk( calls_manager._call.audio_chunk(
bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]), bytes(samples[:audio_samples_per_channel * 2 * audio_channels_count]),
audio_channels_count, audio_channels_count,
@ -401,7 +401,7 @@ def video_receive_frame(toxav, friend_number, width, height, y, u, v, ystride, u
It can be created from initial y, u, v using slices It can be created from initial y, u, v using slices
""" """
LOG_DEBUG(f"video_receive_frame from {friend_number}") LOG_DEBUG(f"video_receive_frame from toxav_video_receive_frame_cb={friend_number}")
import cv2 import cv2
import numpy as np import numpy as np
try: try:
@ -480,6 +480,7 @@ def group_private_message(window, tray, tox, messenger, settings, profile):
if settings['sound_notifications'] and bl and profile.status != TOX_USER_STATUS['BUSY']: if settings['sound_notifications'] and bl and profile.status != TOX_USER_STATUS['BUSY']:
sound_notification(SOUND_NOTIFICATION['MESSAGE']) sound_notification(SOUND_NOTIFICATION['MESSAGE'])
icon = util.join_path(util.get_images_directory(), 'icon_new_messages.png') icon = util.join_path(util.get_images_directory(), 'icon_new_messages.png')
if tray and hasattr(tray, 'setIcon'):
invoke_in_main_thread(tray.setIcon, QtGui.QIcon(icon)) invoke_in_main_thread(tray.setIcon, QtGui.QIcon(icon))
return wrapped return wrapped
@ -507,7 +508,10 @@ def group_invite(window, settings, tray, profile, groups_service, contacts_provi
def group_self_join(contacts_provider, contacts_manager, groups_service): def group_self_join(contacts_provider, contacts_manager, groups_service):
sSlot = 'group_self_join'
def wrapped(tox, group_number, user_data): def wrapped(tox, group_number, user_data):
key = f"group_number {group_number}"
if bTooSoon(key, sSlot, 10): return
LOG_DEBUG(f"group_self_join #{group_number}") LOG_DEBUG(f"group_self_join #{group_number}")
group = contacts_provider.get_group_by_number(group_number) group = contacts_provider.get_group_by_number(group_number)
invoke_in_main_thread(group.set_status, TOX_USER_STATUS['NONE']) invoke_in_main_thread(group.set_status, TOX_USER_STATUS['NONE'])
@ -535,11 +539,18 @@ def group_peer_join(contacts_provider, groups_service):
def group_peer_exit(contacts_provider, groups_service, contacts_manager): def group_peer_exit(contacts_provider, groups_service, contacts_manager):
def wrapped(tox, group_number, peer_id, message, length, user_data): def wrapped(tox,
LOG_DEBUG(f"group_peer_exit #{group_number} peer_id={peer_id}") group_number, peer_id,
exit_type, name, name_length,
message, length,
user_data):
group = contacts_provider.get_group_by_number(group_number) group = contacts_provider.get_group_by_number(group_number)
if group:
LOG_DEBUG(f"group_peer_exit #{group_number} peer_id={peer_id} exit_type={exit_type}")
group.remove_peer(peer_id) group.remove_peer(peer_id)
invoke_in_main_thread(groups_service.generate_peers_list) invoke_in_main_thread(groups_service.generate_peers_list)
else:
LOG_WARN(f"group_peer_exit group not found #{group_number} peer_id={peer_id}")
return wrapped return wrapped
@ -700,9 +711,6 @@ def init_callbacks(tox, profile, settings, plugin_loader, contacts_manager,
:param groups_service: GroupsService instance :param groups_service: GroupsService instance
:param contacts_provider: ContactsProvider instance :param contacts_provider: ContactsProvider instance
""" """
global LOG
import logging
LOG = logging.getLogger('app.'+__name__)
# self callbacks # self callbacks
tox.callback_self_connection_status(self_connection_status(tox, profile)) tox.callback_self_connection_status(self_connection_status(tox, profile))

View file

@ -30,10 +30,10 @@ import logging
LOG = logging.getLogger('app.'+'threads') LOG = logging.getLogger('app.'+'threads')
# log = lambda x: LOG.info(x) # log = lambda x: LOG.info(x)
def LOG_ERROR(l): print('ERRORt: '+l) def LOG_ERROR(l): print('EROR+ '+l)
def LOG_WARN(l): print('WARNt: '+l) def LOG_WARN(l): print('WARN+ '+l)
def LOG_INFO(l): print('INFOt: '+l) def LOG_INFO(l): print('INFO+ '+l)
def LOG_DEBUG(l): print('DEBUGt: '+l) def LOG_DEBUG(l): print('DBUG+ '+l)
def LOG_TRACE(l): pass # print('TRACE+ '+l) def LOG_TRACE(l): pass # print('TRACE+ '+l)
# ----------------------------------------------------------------------------------------------------------------- # -----------------------------------------------------------------------------------------------------------------
@ -148,7 +148,8 @@ class ToxIterateThread(BaseQThread):
self._tox.iterate() self._tox.iterate()
except Exception as e: except Exception as e:
# Fatal Python error: Segmentation fault # Fatal Python error: Segmentation fault
LOG_ERROR('ToxIterateThread run: {e}') LOG_ERROR(f"ToxIterateThread run: {e}")
else:
sleep(iMsec / 1000) sleep(iMsec / 1000)

View file

@ -9,8 +9,9 @@ import os
global LOG global LOG
import logging import logging
LOG = logging.getLogger('app.'+'tox_factory') LOG = logging.getLogger('app.'+'tox_factory')
def LOG_DEBUG(l): print('DEBUGf: '+l) def LOG_INFO(l): print('DBUG> '+l)
def LOG_LOG(l): print('TRACf: '+l) def LOG_DEBUG(l): print('DBUG> '+l)
def LOG_LOG(l): print('TRAC> '+l)
from ctypes import * from ctypes import *
from utils import util from utils import util
@ -32,8 +33,7 @@ def tox_log_cb(iTox, level, file, line, func, message, *args):
# root WARNING 3network.c#944:b'send_packet'attempted to send message with network family 10 (probably IPv6) on IPv4 socket # root WARNING 3network.c#944:b'send_packet'attempted to send message with network family 10 (probably IPv6) on IPv4 socket
if file == 'network.c' and line == 944: return if file == 'network.c' and line == 944: return
message = f"{file}#{line}:{func} {message}" message = f"{file}#{line}:{func} {message}"
LOG_LOG(# 'TRAC: ' + LOG_LOG(message)
message)
def tox_factory(data=None, settings=None, args=None, app=None): def tox_factory(data=None, settings=None, args=None, app=None):
""" """

View file

@ -12,7 +12,7 @@ from user_data.settings import Settings
iMAX = 70 iMAX = 70
global LOG global LOG
LOG = logging.getLogger('app.'+__name__) LOG = logging.getLogger('app.'+'mains')
class QTextEditLogger(logging.Handler): class QTextEditLogger(logging.Handler):
def __init__(self, parent, app): def __init__(self, parent, app):
@ -190,7 +190,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.menuSettings.addAction(self.actionNetwork) self.menuSettings.addAction(self.actionNetwork)
self.menuSettings.addAction(self.audioSettings) self.menuSettings.addAction(self.audioSettings)
self.menuSettings.addAction(self.videoSettings) self.menuSettings.addAction(self.videoSettings)
self.menuSettings.addAction(self.updateSettings) ## self.menuSettings.addAction(self.updateSettings)
self.menuPlugins.addAction(self.pluginData) self.menuPlugins.addAction(self.pluginData)
self.menuPlugins.addAction(self.importPlugin) self.menuPlugins.addAction(self.importPlugin)
self.menuPlugins.addAction(self.reloadPlugins) self.menuPlugins.addAction(self.reloadPlugins)
@ -221,7 +221,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionNotifications.triggered.connect(self.notification_settings) self.actionNotifications.triggered.connect(self.notification_settings)
self.audioSettings.triggered.connect(self.audio_settings) self.audioSettings.triggered.connect(self.audio_settings)
self.videoSettings.triggered.connect(self.video_settings) self.videoSettings.triggered.connect(self.video_settings)
self.updateSettings.triggered.connect(self.update_settings) ## self.updateSettings.triggered.connect(self.update_settings)
self.pluginData.triggered.connect(self.plugins_menu) self.pluginData.triggered.connect(self.plugins_menu)
self.lockApp.triggered.connect(self.lock_app) self.lockApp.triggered.connect(self.lock_app)
self.importPlugin.triggered.connect(self.import_plugin) self.importPlugin.triggered.connect(self.import_plugin)
@ -514,7 +514,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.peers_list.setGeometry(width * 3 // 4, 0, width - width * 3 // 4, self.height() - 155) self.peers_list.setGeometry(width * 3 // 4, 0, width - width * 3 // 4, self.height() - 155)
invites_button_visible = self.groupInvitesPushButton.isVisible() invites_button_visible = self.groupInvitesPushButton.isVisible()
LOG.debug(f"invites_button_visible={invites_button_visible}") # LOG.debug(f"invites_button_visible={invites_button_visible}")
self.friends_list.setGeometry(0, 125 if invites_button_visible else 100, self.friends_list.setGeometry(0, 125 if invites_button_visible else 100,
270, self.height() - 150 if invites_button_visible else self.height() - 125) 270, self.height() - 150 if invites_button_visible else self.height() - 125)

View file

@ -400,6 +400,9 @@ class Settings(dict):
if key not in aArgs.__dict__: continue if key not in aArgs.__dict__: continue
val = aArgs.__dict__[key] val = aArgs.__dict__[key]
if val in ['0.0.0.0']: continue if val in ['0.0.0.0']: continue
if key in aArgs.__dict__ and key not in info:
# dunno = network
continue
if key in aArgs.__dict__ and info[key] != val: if key in aArgs.__dict__ and info[key] != val:
aRet[key] = val aRet[key] = val
return aRet return aRet