From a5bbd1bdc7bb5e680fb97ca7504274aff5d2858c Mon Sep 17 00:00:00 2001 From: Etoh Date: Sun, 17 Sep 2023 15:14:13 +0100 Subject: [PATCH] Avoid GraphicalUI if Windows Console --- syncplay/ui/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/syncplay/ui/__init__.py b/syncplay/ui/__init__.py index 562ad43e..12ab82fc 100755 --- a/syncplay/ui/__init__.py +++ b/syncplay/ui/__init__.py @@ -1,19 +1,21 @@ import os +from syncplay.utils import isWindowsConsole if "QT_PREFERRED_BINDING" not in os.environ: os.environ["QT_PREFERRED_BINDING"] = os.pathsep.join( ["PySide6", "PySide2", "PySide", "PyQt5", "PyQt4"] ) -try: - from syncplay.ui.gui import MainWindow as GraphicalUI -except ImportError: - pass +if not isWindowsConsole: + try: + from syncplay.ui.gui import MainWindow as GraphicalUI + except ImportError: + pass from syncplay.ui.consoleUI import ConsoleUI def getUi(graphical=True, passedBar=None): - if graphical: + if graphical and not isWindowsConsole: ui = GraphicalUI(passedBar=passedBar) else: ui = ConsoleUI()