Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set QT_API to pyside6 or pyside2 for deadline-cli #284

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/deadline/client/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def gui_context_for_cli():
app.exec()
"""
import importlib
import os
from os.path import basename, dirname, join, normpath
import shlex
import shutil
Expand All @@ -69,8 +70,9 @@ def gui_context_for_cli():

import click

has_pyside = importlib.util.find_spec("PySide6") or importlib.util.find_spec("PySide2")
if not has_pyside:
has_pyside6 = importlib.util.find_spec("PySide6")
epmog marked this conversation as resolved.
Show resolved Hide resolved
has_pyside2 = importlib.util.find_spec("PySide2")
if not (has_pyside6 or has_pyside2):
message = "Optional GUI components for deadline are unavailable. Would you like to install PySide?"
will_install_gui = click.confirm(message, default=False)
if not will_install_gui:
Expand Down Expand Up @@ -120,6 +122,12 @@ def gui_context_for_cli():
# time consider local editables `pip install .[gui]`
subprocess.run([sys.executable, "-m", "pip", "install", pyside6_pypi])

# set QT_API to inform qtpy which dependencies to look for.
# default to pyside6 and fallback to pyside2.
# Does not work with PyQt5 which is qtpy default
os.environ["QT_API"] = "pyside6"
if has_pyside2:
os.environ["QT_API"] = "pyside2"
try:
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QApplication, QMessageBox
Expand Down