Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #776 from quadproduction/enhancement/update_zxp_on…
Browse files Browse the repository at this point in the history
…_new_version

Enhancement/update zxp on new version
  • Loading branch information
ccaillot authored Aug 28, 2024
2 parents fc0093a + 518c66b commit 0a5e3fe
Show file tree
Hide file tree
Showing 37 changed files with 597 additions and 152 deletions.
38 changes: 28 additions & 10 deletions igniter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
def _get_qt_app():
from qtpy import QtWidgets, QtCore

is_event_loop_running = True

app = QtWidgets.QApplication.instance()
if app is not None:
return app
return app, is_event_loop_running

for attr_name in (
"AA_EnableHighDpiScaling",
Expand All @@ -39,7 +41,10 @@ def _get_qt_app():
QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
)

return QtWidgets.QApplication(sys.argv)
# Since it's a new QApplication the event loop isn't running yet
is_event_loop_running = False

return QtWidgets.QApplication(sys.argv), is_event_loop_running


def open_dialog():
Expand All @@ -49,29 +54,39 @@ def open_dialog():
sys.exit(1)
from .install_dialog import InstallDialog

app = _get_qt_app()
app, is_event_loop_running = _get_qt_app()

d = InstallDialog()
d.open()

app.exec_()
if not is_event_loop_running:
app.exec_()
else:
d.exec_()

return d.result()


def open_update_window(openpype_version):
def open_update_window(openpype_version, zxp_hosts=None):
"""Open update window."""
if zxp_hosts is None:
zxp_hosts = []
if os.getenv("OPENPYPE_HEADLESS_MODE"):
print("!!! Can't open dialog in headless mode. Exiting.")
sys.exit(1)

from .update_window import UpdateWindow

app = _get_qt_app()
app, is_event_loop_running = _get_qt_app()

d = UpdateWindow(version=openpype_version)
d = UpdateWindow(version=openpype_version, zxp_hosts=zxp_hosts)
d.open()

app.exec_()
if not is_event_loop_running:
app.exec_()
else:
d.exec_()

version_path = d.get_version_path()
return version_path

Expand All @@ -84,12 +99,15 @@ def show_message_dialog(title, message):

from .message_dialog import MessageDialog

app = _get_qt_app()
app, is_event_loop_running = _get_qt_app()

dialog = MessageDialog(title, message)
dialog.open()

app.exec_()
if not is_event_loop_running:
app.exec_()
else:
dialog.exec_()


__all__ = [
Expand Down
Loading

0 comments on commit 0a5e3fe

Please sign in to comment.