This commit is contained in:
emdee 2022-10-26 09:01:50 +00:00
parent 5f1b7d8d93
commit 0819fd4088
8 changed files with 31 additions and 14 deletions

View File

@ -886,13 +886,25 @@ class App:
else:
LOG.debug("Have default route for network " +self._oArgs.network)
LOG.debug(f"test_net {self._oArgs.network} iMax= {iMax}")
lUdpElts = self._settings['current_nodes_udp']
if self._oArgs.proxy_type <= 0 and not lUdpElts:
title = 'test_net Error'
text = 'Error: ' + str('No UDP nodes')
util_ui.message_box(text, title)
return
lTcpElts = self._settings['current_nodes_tcp']
if self._oArgs.proxy_type > 0 and not lTcpElts:
title = 'test_net Error'
text = 'Error: ' + str('No TCP nodes')
util_ui.message_box(text, title)
return
LOG.debug(f"test_net {self._oArgs.network} lenU={len(lUdpElts)} lenT={len(lTcpElts)} iMax= {iMax}")
i = 0
while i < iMax:
# if oThread and oThread._stop_thread: return
i = i + 1
LOG.debug(f"bootstrapping status # {i}")
self._test_bootstrap(self._settings['current_nodes_udp'])
self._test_bootstrap(lUdpElts)
if hasattr(self._oArgs, 'proxy_type') and self._oArgs.proxy_type > 0:
LOG.debug(f"relaying status # {i}")
self._test_relays(self._settings['current_nodes_tcp'])
@ -930,9 +942,11 @@ class App:
def _test_bootstrap(self, lElts=None):
if lElts is None:
lElts = self._settings['current_nodes_udp']
shuffle(lElts)
LOG.debug(f"_test_bootstrap #Elts={len(lElts)}")
ts.bootstrap_good(lElts[:iNODES], [self._tox])
if not lElts:
return
shuffle(lElts)
ts.bootstrap_udp(lElts[:iNODES], [self._tox])
LOG.info("Connected status: " +repr(self._tox.self_get_connection_status()))
def _test_relays(self, lElts=None):

View File

@ -13,6 +13,7 @@ except ImportError:
from user_data.settings import get_user_config_path
from wrapper_tests.support_testing import _get_nodes_path
from wrapper_tests.support_http import download_url
import wrapper_tests.support_testing as ts
global LOG
import logging

View File

@ -110,7 +110,6 @@ class GroupChat(contact.Contact, ToxSave):
def get_peer_by_id(self, peer_id):
peers = list(filter(lambda p: p.id == peer_id, self._peers))
if peers:
#? broken
return peers[0]
else:
LOG_WARN(f"get_peer_by_id empty peers for {peer_id}")

View File

@ -95,7 +95,7 @@ class InitThread(BaseThread):
try:
if self._is_first_start and ts.bAreWeConnected() and \
self._settings['download_nodes_list']:
LOG_INFO('downloading list of nodes')
LOG_INFO(f"downloading list of nodes {self._settings['download_nodes_list']}")
download_nodes_list(self._settings, oArgs=self._app._args)
if ts.bAreWeConnected():

View File

@ -101,8 +101,9 @@ def tox_factory(data=None, settings=None, args=None, app=None):
LOG.debug("wrapper.tox.Tox settings: " +repr(settings))
if 'trace_enabled' in settings and settings['trace_enabled'] and \
tox_options._options_pointer:
if 'trace_enabled' in settings and settings['trace_enabled']:
LOG_INFO("settings['trace_enabled' disabled" )
elif tox_options._options_pointer:
c_callback = CFUNCTYPE(None, c_void_p, c_int, c_char_p, c_int, c_char_p, c_char_p, c_void_p)
tox_options.self_logger_cb = c_callback(tox_log_cb)
wrapper.tox.Tox.libtoxcore.tox_options_set_log_callback(

View File

@ -362,7 +362,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.actionLog_console.setText(util_ui.tr("Console Log"))
self.actionPython_console.setText(util_ui.tr("Python Console"))
self.actionTest_tox.setText(util_ui.tr("Bootstrap"))
self.actionTest_nmap.setText(util_ui.tr("Test Nmap"))
self.actionTest_nmap.setText(util_ui.tr("Test Nodes"))
self.actionTest_main.setText(util_ui.tr("Test Program"))
self.actionQuit_program.setText(util_ui.tr("Quit program"))
self.actionSettings.setText(util_ui.tr("Settings"))

View File

@ -29,9 +29,11 @@ class PeerScreen(CenteredWidget):
self.statusCircle = StatusCircle(self)
self.statusCircle.setGeometry(50, 15, 30, 30)
self.statusCircle.update(self._peer.status)
self.peerNameLabel.setText(self._peer.name)
self.ignorePeerCheckBox.setChecked(self._peer.is_muted)
if self._peer:
self.statusCircle.update(self._peer.status)
self.peerNameLabel.setText(self._peer.name)
self.ignorePeerCheckBox.setChecked(self._peer.is_muted)
self.ignorePeerCheckBox.clicked.connect(self._toggle_ignore)
self.sendPrivateMessagePushButton.clicked.connect(self._send_private_message)
self.copyPublicKeyPushButton.clicked.connect(self._copy_public_key)

View File

@ -162,7 +162,7 @@ class Settings(dict):
info = Settings.get_default_settings(app._oArgs)
if not os.path.exists(path):
merge_oArgs_into_settings(app._oArgs, info)
merge_args_into_settings(app._oArgs, info)
else:
aC = self._changed(app._oArgs, info)
if aC:
@ -175,7 +175,7 @@ class Settings(dict):
text += repr(aC)
reply = util_ui.question(text, title)
if reply:
merge_oArgs_into_settings(app._oArgs, info)
merge_args_into_settings(app._oArgs, info)
info['audio'] = getattr(app._oArgs, 'audio')
info['video'] = getattr(app._oArgs, 'video')
super().__init__(info)