diff --git a/requirements.txt b/requirements.txt index 980f137..449c2d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # the versions are the current ones tested - may work with earlier versions # choose one of PyQt5 PyQt6 PySide2 PySide6 +QtPy >= 2.4.1 PyAudio >= 0.2.13 numpy >= 1.26.1 opencv_python >= 4.8.0 diff --git a/toxygen/__main__.py b/toxygen/__main__.py index 046807b..1675c52 100644 --- a/toxygen/__main__.py +++ b/toxygen/__main__.py @@ -12,6 +12,7 @@ faulthandler.enable() import warnings warnings.filterwarnings('ignore') +import tox_wrapper.tests.support_testing as ts try: from trepan.interfaces import server as Mserver from trepan.api import debug @@ -28,15 +29,16 @@ from user_data.settings import * from user_data.settings import Settings from user_data import settings import utils.util as util -import tox_wrapper.tests.support_testing as ts with ts.ignoreStderr(): import pyaudio __maintainer__ = 'Ingvar' -__version__ = '0.5.0+' +__version__ = '1.0.0' # was 0.5.0+ sleep = time.sleep +os.environ['QT_API'] = 'pyqt5' + def reset(): Settings.reset_auto_profile() @@ -46,7 +48,7 @@ def clean(): util.remove(directory) def print_toxygen_version(): - print('Toxygen ' + __version__) + print('toxygen ' + __version__) def setup_default_audio(): # need: diff --git a/toxygen/app.py b/toxygen/app.py index 1267628..c672697 100644 --- a/toxygen/app.py +++ b/toxygen/app.py @@ -10,7 +10,7 @@ from copy import deepcopy from gevent import monkey; monkey.patch_all(); del monkey # noqa import gevent -from PyQt5 import QtWidgets, QtGui, QtCore +from qtpy import QtWidgets, QtGui, QtCore from qtpy.QtCore import QTimer from qtpy.QtWidgets import QApplication @@ -85,6 +85,7 @@ LOG = logging.getLogger('app') IDLE_PERIOD = 0.10 iNODES=8 +bSHOW_TRAY=False def setup_logging(oArgs): global LOG @@ -740,7 +741,7 @@ class App: self._groups_service, history, self._contacts_provider) - if True: # try it + if bSHOW_TRAY: self._tray = tray.init_tray(self._profile, self._settings, self._ms, self._toxes) @@ -755,7 +756,7 @@ class App: self._calls_manager, self._groups_service, self._toxes, self) - if True: # try it + if bSHOW_TRAY: # broken # the tray icon does not die with the app self._tray.show() self._ms.show() diff --git a/toxygen/av/calls.py b/toxygen/av/calls.py index 81aa440..6a1e793 100644 --- a/toxygen/av/calls.py +++ b/toxygen/av/calls.py @@ -16,7 +16,7 @@ import common.tox_save from utils import ui as util_ui import tox_wrapper.tests.support_testing as ts from middleware.threads import invoke_in_main_thread -from main import sleep +from __main__ import sleep from middleware.threads import BaseThread global LOG diff --git a/toxygen/av/screen_sharing.py b/toxygen/av/screen_sharing.py index 3739f0c..e82b991 100644 --- a/toxygen/av/screen_sharing.py +++ b/toxygen/av/screen_sharing.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from qtpy import QtWidgets class DesktopGrabber: diff --git a/toxygen/bootstrap/bootstrap.py b/toxygen/bootstrap/bootstrap.py index ec00d8b..0e1a666 100644 --- a/toxygen/bootstrap/bootstrap.py +++ b/toxygen/bootstrap/bootstrap.py @@ -2,8 +2,8 @@ import random import urllib.request from utils.util import * -from PyQt5 import QtNetwork -from PyQt5 import QtCore +from qtpy import QtNetwork +from qtpy import QtCore try: import certifi from io import BytesIO diff --git a/toxygen/contacts/basecontact.py b/toxygen/contacts/basecontact.py index 21fdcbb..ab9d3d7 100644 --- a/toxygen/contacts/basecontact.py +++ b/toxygen/contacts/basecontact.py @@ -1,6 +1,6 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- from user_data.settings import * -from PyQt5 import QtCore, QtGui +from qtpy import QtCore, QtGui from tox_wrapper.toxcore_enums_and_consts import TOX_PUBLIC_KEY_SIZE import utils.util as util import common.event as event @@ -165,7 +165,7 @@ class BaseContact: # contact.set_widget(item_widget) # File "/mnt/o/var/local/src/toxygen/toxygen/contacts/contact.py", line 320, in set_widget if not self._widget: - LOG_WARN("BC.init_widget self._widget is NULL") + LOG.warn("BC.init_widget self._widget is NULL") return self._widget.name.setText(self._name) self._widget.status_message.setText(self._status_message) diff --git a/toxygen/contacts/contact_menu.py b/toxygen/contacts/contact_menu.py index eab2585..0149940 100644 --- a/toxygen/contacts/contact_menu.py +++ b/toxygen/contacts/contact_menu.py @@ -1,5 +1,5 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- -from PyQt5 import QtWidgets +from qtpy import QtWidgets import utils.ui as util_ui from tox_wrapper.toxcore_enums_and_consts import * diff --git a/toxygen/middleware/callbacks.py b/toxygen/middleware/callbacks.py index 3421fdc..33e53cb 100644 --- a/toxygen/middleware/callbacks.py +++ b/toxygen/middleware/callbacks.py @@ -2,7 +2,7 @@ import sys import os import threading -from PyQt5 import QtGui +from qtpy import QtGui from tox_wrapper.toxcore_enums_and_consts import * from tox_wrapper.toxav_enums import * from tox_wrapper.tox import bin_to_string diff --git a/toxygen/middleware/threads.py b/toxygen/middleware/threads.py index 8a1d2e8..b90bc89 100644 --- a/toxygen/middleware/threads.py +++ b/toxygen/middleware/threads.py @@ -2,7 +2,7 @@ import sys import threading import queue -from PyQt5 import QtCore +from qtpy import QtCore from bootstrap.bootstrap import * from bootstrap.bootstrap import download_nodes_list diff --git a/toxygen/network/tox_dns.py b/toxygen/network/tox_dns.py index 2de374a..94ffd96 100644 --- a/toxygen/network/tox_dns.py +++ b/toxygen/network/tox_dns.py @@ -2,7 +2,7 @@ import json import urllib.request import utils.util as util -from PyQt5 import QtNetwork, QtCore +from qtpy import QtNetwork, QtCore try: import requests except ImportError: diff --git a/toxygen/notifications/tray.py b/toxygen/notifications/tray.py index 0858b83..55dcf29 100644 --- a/toxygen/notifications/tray.py +++ b/toxygen/notifications/tray.py @@ -1,4 +1,4 @@ -from PyQt5 import QtCore, QtWidgets +from qtpy import QtCore, QtWidgets def tray_notification(title, text, tray, window): diff --git a/toxygen/plugins/awayl.py b/toxygen/plugins/awayl.py index 9c12743..5df6109 100644 --- a/toxygen/plugins/awayl.py +++ b/toxygen/plugins/awayl.py @@ -1,7 +1,7 @@ import plugin_super_class import threading import time -from PyQt5 import QtCore, QtWidgets +from qtpy import QtCore, QtWidgets from subprocess import check_output import json diff --git a/toxygen/plugins/bday.py b/toxygen/plugins/bday.py index 976256d..6a6d327 100644 --- a/toxygen/plugins/bday.py +++ b/toxygen/plugins/bday.py @@ -1,5 +1,5 @@ import plugin_super_class -from PyQt5 import QtWidgets, QtCore +from qtpy import QtWidgets, QtCore import json import importlib diff --git a/toxygen/plugins/bot.py b/toxygen/plugins/bot.py index 4f6057a..bbd60d1 100644 --- a/toxygen/plugins/bot.py +++ b/toxygen/plugins/bot.py @@ -1,5 +1,5 @@ import plugin_super_class -from PyQt5 import QtCore +from qtpy import QtCore import time diff --git a/toxygen/plugins/chess.py b/toxygen/plugins/chess.py index 92fe439..89c7785 100644 --- a/toxygen/plugins/chess.py +++ b/toxygen/plugins/chess.py @@ -5,10 +5,10 @@ import re import math import plugin_super_class -from PyQt5.QtCore import * -from PyQt5.QtWidgets import * -from PyQt5.QtGui import * -from PyQt5.QtSvg import * +from qtpy.QtCore import * +from qtpy.QtWidgets import * +from qtpy.QtGui import * +from qtpy.QtSvg import * START_FEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" diff --git a/toxygen/plugins/garland.py b/toxygen/plugins/garland.py index c37f81e..2ad5747 100644 --- a/toxygen/plugins/garland.py +++ b/toxygen/plugins/garland.py @@ -1,7 +1,7 @@ import plugin_super_class import threading import time -from PyQt5 import QtCore +from qtpy import QtCore class InvokeEvent(QtCore.QEvent): diff --git a/toxygen/plugins/mrq.py b/toxygen/plugins/mrq.py index f91e2cb..9136c6d 100644 --- a/toxygen/plugins/mrq.py +++ b/toxygen/plugins/mrq.py @@ -2,7 +2,7 @@ import plugin_super_class import threading import time -from PyQt5 import QtCore +from qtpy import QtCore class InvokeEvent(QtCore.QEvent): diff --git a/toxygen/plugins/plugin_super_class.py b/toxygen/plugins/plugin_super_class.py index af0b792..0351253 100644 --- a/toxygen/plugins/plugin_super_class.py +++ b/toxygen/plugins/plugin_super_class.py @@ -1,6 +1,6 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- import os -from PyQt5 import QtCore, QtWidgets +from qtpy import QtCore, QtWidgets import utils.ui as util_ui import common.tox_save as tox_save diff --git a/toxygen/plugins/srch.py b/toxygen/plugins/srch.py index 08d5de8..a7678e3 100644 --- a/toxygen/plugins/srch.py +++ b/toxygen/plugins/srch.py @@ -1,5 +1,5 @@ import plugin_super_class -from PyQt5 import QtGui, QtCore, QtWidgets +from qtpy import QtGui, QtCore, QtWidgets class SearchPlugin(plugin_super_class.PluginSuperClass): diff --git a/toxygen/plugins/toxid.py b/toxygen/plugins/toxid.py index e403e5d..1646e57 100644 --- a/toxygen/plugins/toxid.py +++ b/toxygen/plugins/toxid.py @@ -1,5 +1,5 @@ import plugin_super_class -from PyQt5 import QtCore, QtWidgets +from qtpy import QtCore, QtWidgets import json diff --git a/toxygen/smileys/smileys.py b/toxygen/smileys/smileys.py index 43ae3fd..6bc50d2 100644 --- a/toxygen/smileys/smileys.py +++ b/toxygen/smileys/smileys.py @@ -2,7 +2,7 @@ from utils import util import json import os from collections import OrderedDict -from PyQt5 import QtCore +from qtpy import QtCore # LOG=util.log global LOG diff --git a/toxygen/styles/style.py b/toxygen/styles/style.py index 6e05c3e..9cca036 100644 --- a/toxygen/styles/style.py +++ b/toxygen/styles/style.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- try: - from PyQt5 import QtCore + from qtpy import QtCore except ImportError: from PyQt4 import QtCore diff --git a/toxygen/tests/conference_tests.py b/toxygen/tests/conference_tests.py.bak similarity index 100% rename from toxygen/tests/conference_tests.py rename to toxygen/tests/conference_tests.py.bak diff --git a/toxygen/tests/tests_socks.py b/toxygen/tests/tests_socks.py index 19cffce..fc69bdb 100644 --- a/toxygen/tests/tests_socks.py +++ b/toxygen/tests/tests_socks.py @@ -87,7 +87,7 @@ try: except ImportError: bIS_NOT_TOXYGEN = True -# from PyQt5 import QtCore +# from qtpy import QtCore import time sleep = time.sleep diff --git a/toxygen/third_party/qweechat/about.py b/toxygen/third_party/qweechat/about.py index 5754136..26dcd90 100644 --- a/toxygen/third_party/qweechat/about.py +++ b/toxygen/third_party/qweechat/about.py @@ -22,7 +22,7 @@ """About dialog box.""" -from PyQt5 import QtCore, QtWidgets as QtGui +from qtpy import QtCore, QtWidgets as QtGui from third_party.qweechat.version import qweechat_version diff --git a/toxygen/third_party/qweechat/buffer.py b/toxygen/third_party/qweechat/buffer.py index b948133..2a7fc3c 100644 --- a/toxygen/third_party/qweechat/buffer.py +++ b/toxygen/third_party/qweechat/buffer.py @@ -24,8 +24,8 @@ from pkg_resources import resource_filename -from PyQt5 import QtCore, QtGui, QtWidgets -from PyQt5.QtCore import pyqtSignal +from qtpy import QtCore, QtGui, QtWidgets +from qtpy.QtCore import pyqtSignal Signal = pyqtSignal from third_party.qweechat.chat import ChatTextEdit diff --git a/toxygen/third_party/qweechat/chat.py b/toxygen/third_party/qweechat/chat.py index 50ed52e..9bd1efe 100644 --- a/toxygen/third_party/qweechat/chat.py +++ b/toxygen/third_party/qweechat/chat.py @@ -24,7 +24,7 @@ import datetime -from PyQt5 import QtCore, QtWidgets, QtGui +from qtpy import QtCore, QtWidgets, QtGui from third_party.qweechat import config from third_party.qweechat.weechat import color diff --git a/toxygen/third_party/qweechat/connection.py b/toxygen/third_party/qweechat/connection.py index 3b44aab..6777122 100644 --- a/toxygen/third_party/qweechat/connection.py +++ b/toxygen/third_party/qweechat/connection.py @@ -22,7 +22,7 @@ """Connection window.""" -from PyQt5 import QtGui, QtWidgets +from qtpy import QtGui, QtWidgets class ConnectionDialog(QtWidgets.QDialog): diff --git a/toxygen/third_party/qweechat/debug.py b/toxygen/third_party/qweechat/debug.py index a55f8f3..e1f09b3 100644 --- a/toxygen/third_party/qweechat/debug.py +++ b/toxygen/third_party/qweechat/debug.py @@ -22,7 +22,7 @@ """Debug window.""" -from PyQt5 import QtWidgets +from qtpy import QtWidgets from third_party.qweechat.chat import ChatTextEdit from third_party.qweechat.input import InputLineEdit diff --git a/toxygen/third_party/qweechat/input.py b/toxygen/third_party/qweechat/input.py index 739a63f..0055275 100644 --- a/toxygen/third_party/qweechat/input.py +++ b/toxygen/third_party/qweechat/input.py @@ -22,8 +22,8 @@ """Input line for chat and debug window.""" -from PyQt5 import QtCore, QtWidgets -from PyQt5.QtCore import pyqtSignal +from qtpy import QtCore, QtWidgets +from qtpy.QtCore import pyqtSignal Signal = pyqtSignal class InputLineEdit(QtWidgets.QLineEdit): diff --git a/toxygen/third_party/qweechat/network.py b/toxygen/third_party/qweechat/network.py index d17d330..a26daed 100644 --- a/toxygen/third_party/qweechat/network.py +++ b/toxygen/third_party/qweechat/network.py @@ -26,8 +26,8 @@ import hashlib import secrets import struct -from PyQt5 import QtCore, QtNetwork -from PyQt5.QtCore import pyqtSignal +from qtpy import QtCore, QtNetwork +from qtpy.QtCore import pyqtSignal Signal = pyqtSignal from third_party.qweechat import config diff --git a/toxygen/third_party/qweechat/preferences.py b/toxygen/third_party/qweechat/preferences.py index fc415da..64315cf 100644 --- a/toxygen/third_party/qweechat/preferences.py +++ b/toxygen/third_party/qweechat/preferences.py @@ -22,7 +22,7 @@ """Preferences dialog box.""" -from PyQt5 import QtCore, QtWidgets as QtGui +from qtpy import QtCore, QtWidgets as QtGui class PreferencesDialog(QtGui.QDialog): diff --git a/toxygen/third_party/qweechat/qweechat.py b/toxygen/third_party/qweechat/qweechat.py index 850cb95..03e1b5e 100644 --- a/toxygen/third_party/qweechat/qweechat.py +++ b/toxygen/third_party/qweechat/qweechat.py @@ -37,7 +37,7 @@ import sys import traceback from pkg_resources import resource_filename -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets from third_party.qweechat import config from third_party.qweechat.about import AboutDialog diff --git a/toxygen/ui/av_widgets.py b/toxygen/ui/av_widgets.py index deacd37..2d90431 100644 --- a/toxygen/ui/av_widgets.py +++ b/toxygen/ui/av_widgets.py @@ -1,6 +1,6 @@ import threading -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets import wave from ui import widgets diff --git a/toxygen/ui/contact_items.py b/toxygen/ui/contact_items.py index dc8f560..db66c2a 100644 --- a/toxygen/ui/contact_items.py +++ b/toxygen/ui/contact_items.py @@ -1,5 +1,5 @@ from tox_wrapper.toxcore_enums_and_consts import * -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets from utils.util import * from ui.widgets import DataLabel diff --git a/toxygen/ui/create_profile_screen.py b/toxygen/ui/create_profile_screen.py index 512c141..041d5be 100644 --- a/toxygen/ui/create_profile_screen.py +++ b/toxygen/ui/create_profile_screen.py @@ -1,5 +1,5 @@ from ui.widgets import * -from PyQt5 import uic +from qtpy import uic import utils.util as util import utils.ui as util_ui diff --git a/toxygen/ui/group_bans_widgets.py b/toxygen/ui/group_bans_widgets.py index f1ec3cf..f5e31cf 100644 --- a/toxygen/ui/group_bans_widgets.py +++ b/toxygen/ui/group_bans_widgets.py @@ -1,5 +1,5 @@ from ui.widgets import CenteredWidget -from PyQt5 import uic, QtWidgets, QtCore +from qtpy import uic, QtWidgets, QtCore import utils.util as util import utils.ui as util_ui diff --git a/toxygen/ui/group_invites_widgets.py b/toxygen/ui/group_invites_widgets.py index ff61370..46e7920 100644 --- a/toxygen/ui/group_invites_widgets.py +++ b/toxygen/ui/group_invites_widgets.py @@ -1,4 +1,4 @@ -from PyQt5 import uic, QtWidgets +from qtpy import uic, QtWidgets import utils.util as util from ui.widgets import * diff --git a/toxygen/ui/group_settings_widgets.py b/toxygen/ui/group_settings_widgets.py index 45b0ad6..5fd04d4 100644 --- a/toxygen/ui/group_settings_widgets.py +++ b/toxygen/ui/group_settings_widgets.py @@ -1,5 +1,5 @@ from ui.widgets import CenteredWidget -from PyQt5 import uic +from qtpy import uic import utils.util as util import utils.ui as util_ui diff --git a/toxygen/ui/groups_widgets.py b/toxygen/ui/groups_widgets.py index e2d8486..29319b3 100644 --- a/toxygen/ui/groups_widgets.py +++ b/toxygen/ui/groups_widgets.py @@ -1,4 +1,4 @@ -from PyQt5 import uic +from qtpy import uic import utils.util as util from ui.widgets import * from tox_wrapper.toxcore_enums_and_consts import * diff --git a/toxygen/ui/login_screen.py b/toxygen/ui/login_screen.py index 35e33b5..788aea4 100644 --- a/toxygen/ui/login_screen.py +++ b/toxygen/ui/login_screen.py @@ -1,5 +1,5 @@ from ui.widgets import * -from PyQt5 import uic +from qtpy import uic import utils.util as util import utils.ui as util_ui import os.path diff --git a/toxygen/ui/main_screen.py b/toxygen/ui/main_screen.py index 53db77b..30de83c 100644 --- a/toxygen/ui/main_screen.py +++ b/toxygen/ui/main_screen.py @@ -1,8 +1,8 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- import os -from PyQt5 import uic -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import uic +from qtpy import QtCore, QtGui, QtWidgets from qtpy.QtGui import (QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QFontMetrics) from ui.contact_items import * @@ -146,8 +146,9 @@ class LogDialog(QtWidgets.QDialog, QtWidgets.QPlainTextEdit): def test(self): # FixMe: 65:8: E1101: Instance of 'QTextEditLogger' has no 'selectAll' member (no-member) # :66:8: E1101: Instance of 'QTextEditLogger' has no 'copy' member (no-member) - self._logTextBox.selectAll() - self._logTextBox.copy() + if hasattr(self._logTextBox, 'selectAll'): + self._logTextBox.selectAll() + self._logTextBox.copy() class MainWindow(QtWidgets.QMainWindow): diff --git a/toxygen/ui/main_screen_widgets.py b/toxygen/ui/main_screen_widgets.py index c6749e5..c64cc8c 100644 --- a/toxygen/ui/main_screen_widgets.py +++ b/toxygen/ui/main_screen_widgets.py @@ -3,7 +3,7 @@ import urllib import re -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets from ui.widgets import RubberBandWindow, create_menu, QRightClickButton, CenteredWidget, LineEdit import utils.util as util diff --git a/toxygen/ui/menu.py b/toxygen/ui/menu.py index 269bf18..3c3e3b4 100644 --- a/toxygen/ui/menu.py +++ b/toxygen/ui/menu.py @@ -1,5 +1,5 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- -from PyQt5 import QtCore, QtGui, QtWidgets, uic +from qtpy import QtCore, QtGui, QtWidgets, uic from user_data.settings import * diff --git a/toxygen/ui/messages_widgets.py b/toxygen/ui/messages_widgets.py index 72a648d..a89b7ff 100644 --- a/toxygen/ui/messages_widgets.py +++ b/toxygen/ui/messages_widgets.py @@ -7,7 +7,7 @@ import re from ui.widgets import * from messenger.messages import MESSAGE_AUTHOR from file_transfers.file_transfers import * -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets class MessageBrowser(QtWidgets.QTextBrowser): diff --git a/toxygen/ui/password_screen.py b/toxygen/ui/password_screen.py index 1e38964..f4bd856 100644 --- a/toxygen/ui/password_screen.py +++ b/toxygen/ui/password_screen.py @@ -1,5 +1,5 @@ from ui.widgets import CenteredWidget, LineEdit, DialogWithResult -from PyQt5 import QtCore, QtWidgets +from qtpy import QtCore, QtWidgets import utils.ui as util_ui global LOG diff --git a/toxygen/ui/peer_screen.py b/toxygen/ui/peer_screen.py index 4ad0954..30986b6 100644 --- a/toxygen/ui/peer_screen.py +++ b/toxygen/ui/peer_screen.py @@ -1,5 +1,5 @@ from ui.widgets import CenteredWidget -from PyQt5 import uic +from qtpy import uic import utils.util as util import utils.ui as util_ui from ui.contact_items import * diff --git a/toxygen/ui/profile_settings_screen.py b/toxygen/ui/profile_settings_screen.py index 8e20211..342f7c3 100644 --- a/toxygen/ui/profile_settings_screen.py +++ b/toxygen/ui/profile_settings_screen.py @@ -2,7 +2,7 @@ from ui.widgets import CenteredWidget import utils.ui as util_ui from utils.util import join_path, get_images_directory, get_views_path from user_data.settings import Settings -from PyQt5 import QtGui, QtCore, uic +from qtpy import QtGui, QtCore, uic class ProfileSettings(CenteredWidget): diff --git a/toxygen/ui/self_peer_screen.py b/toxygen/ui/self_peer_screen.py index cf252d3..69f148c 100644 --- a/toxygen/ui/self_peer_screen.py +++ b/toxygen/ui/self_peer_screen.py @@ -1,5 +1,5 @@ from ui.widgets import CenteredWidget, LineEdit -from PyQt5 import uic +from qtpy import uic import utils.util as util import utils.ui as util_ui from ui.contact_items import * diff --git a/toxygen/ui/tray.py b/toxygen/ui/tray.py index 3bfc7f3..cbd4c5a 100644 --- a/toxygen/ui/tray.py +++ b/toxygen/ui/tray.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets, QtGui, QtCore +from qtpy import QtWidgets, QtGui, QtCore from utils.ui import tr from utils.util import * from ui.password_screen import UnlockAppScreen diff --git a/toxygen/ui/widgets.py b/toxygen/ui/widgets.py index 8789ad1..7b788b3 100644 --- a/toxygen/ui/widgets.py +++ b/toxygen/ui/widgets.py @@ -1,5 +1,5 @@ # -*- mode: python; indent-tabs-mode: nil; py-indent-offset: 4; coding: utf-8 -*- -from PyQt5 import QtCore, QtGui, QtWidgets +from qtpy import QtCore, QtGui, QtWidgets import utils.ui as util_ui import logging diff --git a/toxygen/updater/updater.py b/toxygen/updater/updater.py index 2311282..db4f80f 100644 --- a/toxygen/updater/updater.py +++ b/toxygen/updater/updater.py @@ -4,7 +4,7 @@ import utils.ui as util_ui import os import platform import urllib -from PyQt5 import QtNetwork, QtCore +from qtpy import QtNetwork, QtCore import subprocess global LOG diff --git a/toxygen/user_data/settings.py b/toxygen/user_data/settings.py index 644d0f2..eccfa2c 100644 --- a/toxygen/user_data/settings.py +++ b/toxygen/user_data/settings.py @@ -10,6 +10,7 @@ from common.event import Event import utils.ui as util_ui import utils.util as util_utils import user_data +from toxygen_wrapper.tests import support_testing as ts global LOG import logging @@ -259,7 +260,9 @@ class Settings(dict): # Static methods @staticmethod - def get_auto_profile(appdir): + def get_auto_profile(appdir=None): + if appdir is None: + appdir = ts.get_user_config_path() # self._path = p = os.path.join(appdir, 'toxygen.json') if not os.path.isfile(p): @@ -299,7 +302,8 @@ class Settings(dict): @staticmethod def reset_auto_profile(): - p = os.path.join(os.path.dirname(app._path), 'toxygen.json') + appdir = ts.get_user_config_path() + p = os.path.join(appdir, 'toxygen.json') if os.path.isfile(p): with open(p) as fl: data = fl.read() diff --git a/toxygen/utils/ui.py b/toxygen/utils/ui.py index d2d7122..add4c09 100644 --- a/toxygen/utils/ui.py +++ b/toxygen/utils/ui.py @@ -1,4 +1,4 @@ -from PyQt5 import QtWidgets +from qtpy import QtWidgets import utils.util as util