fixes
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-26 08:04:47 +00:00
parent affaa3814b
commit ef68b7e2e2
2 changed files with 22 additions and 13 deletions

View File

@ -8,6 +8,7 @@ import threading
from time import sleep, time
from copy import deepcopy
# used only in loop
import gevent
from qtpy import QtWidgets, QtGui, QtCore
@ -514,7 +515,9 @@ class App:
interval = self._tox.iteration_interval()
for i in range(n):
self._tox.iterate()
# Cooperative yield, allow gevent to monitor file handles via libevent
gevent.sleep(interval / 1000.0)
#? sleep(interval / 1000.0)
# Profiles
@ -844,10 +847,11 @@ class App:
interval = self._tox.iteration_interval()
for i in range(n):
self._tox.iterate()
QtCore.QThread.msleep(interval)
#? QtCore.QThread.msleep(interval)
# Cooperative yield, allow gevent to monitor file handles via libevent
gevent.sleep(interval / 1000.0)
# NO?
QtCore.QCoreApplication.processEvents()
# sleep(interval / 1000.0)
def _test_tox(self) -> None:
self.test_net(iMax=8)
@ -1019,6 +1023,7 @@ class App:
util_ui.message_box(text, title)
self._ms.log_console()
#? unused
class GEventProcessing:
"""Interoperability class between Qt/gevent that allows processing gevent
tasks during Qt idle periods."""
@ -1042,3 +1047,4 @@ class GEventProcessing:
idle_period = self._idle_period
# Cooperative yield, allow gevent to monitor file handles via libevent
gevent.sleep(idle_period)
#? QtCore.QCoreApplication.processEvents()

View File

@ -146,8 +146,8 @@ class Settings(dict):
try:
with open(path, 'rb') as fl:
data = fl.read()
if toxes.is_data_encrypted(data):
data = toxes.pass_decrypt(data)
if self._toxes.is_data_encrypted(data):
data = self._toxes.pass_decrypt(data)
info = json.loads(str(data, 'utf-8'))
LOG.debug('Parsed settings from: ' + str(path))
except Exception as ex:
@ -210,10 +210,7 @@ class Settings(dict):
text = bytes(self._toxes.pass_encrypt(bytes(text, 'utf-8')))
else:
text = bytes(text, 'utf-8')
json_path = self._path.replace('.tox', '.json')
if not json_path:
#?
json_path = os.path.join(get_user_config_path(), 'toxygen.json')
json_path = os.path.join(get_user_config_path(), 'toxygen.json')
tmp = json_path + str(os.getpid())
try:
with open(tmp, 'wb') as fl:
@ -271,12 +268,18 @@ class Settings(dict):
p = os.path.join(appdir, 'toxygen.json')
if not os.path.isfile(p):
return None
with open(p) as fl:
data = fl.read()
try:
auto = json.loads(data)
with open(p, 'rb') as fl:
data = fl.read()
if self._toxes.is_data_encrypted(data):
data = self._toxes.pass_decrypt(data)
except Exception as ex:
LOG.warn(f"json.loads {data}: {ex}")
LOG.warn(f"fl.read {p}: {ex}")
return None
try:
auto = json.loads(str(data, 'utf-8'))
except Exception as ex:
LOG.warn(f"json.loads {p}: {ex}")
auto = {}
if 'profile_path' in auto:
path = str(auto['profile_path'])
@ -375,7 +378,7 @@ class Settings(dict):
'unread_color': 'red',
'compact_mode': False,
'identicons': True,
'show_welcome_screen': True,
'show_welcome_screen': False,
'close_app': 0,
'font': 'Times New Roman',
'update': 0,