diff --git a/README.md b/README.md index 69f864e..0195f94 100644 --- a/README.md +++ b/README.md @@ -378,8 +378,8 @@ Tests are automatically run at each commit to GitHub via Travis-CI. You can run ```bash $ git clone https://github.com/pyblish/pyblish-qml.git $ cd pyblish-qml -$ docker build -t pyblish/pyblish-qml . -$ docker run --rm -v $(pwd):/pyblish-qml pyblish/pyblish-qml +$ . build_docker.sh # Only needed once +$ . test_docker.sh # Doctest: pyblish_qml.models.Item ... ok # Doctest: pyblish_qml.util.ItemList ... ok # Reset works ... ok diff --git a/build_docker.sh b/build_docker.sh new file mode 100644 index 0000000..5741aea --- /dev/null +++ b/build_docker.sh @@ -0,0 +1,2 @@ +# Source this script +docker build -t pyblish/pyblish-qml . \ No newline at end of file diff --git a/pyblish_qml/host.py b/pyblish_qml/host.py index 84e397d..7575217 100644 --- a/pyblish_qml/host.py +++ b/pyblish_qml/host.py @@ -197,9 +197,24 @@ def install_host(): break +def _on_application_quit(): + """Automatically kill QML on host exit""" + + try: + _state["currentServer"].popen.kill() + + except KeyError: + # No server started + pass + + except OSError: + # Already dead + pass + + def _install_maya(): """Helper function to Autodesk Maya support""" - from maya import cmds, utils + from maya import utils def threaded_wrapper(func, *args, **kwargs): return utils.executeInMainThreadWithResult( @@ -208,22 +223,8 @@ def threaded_wrapper(func, *args, **kwargs): sys.stdout.write("Setting up Pyblish QML in Maya\n") register_dispatch_wrapper(threaded_wrapper) - def on_application_quit(): - try: - _state["currentServer"].popen.kill() - - except KeyError: - # No server started - pass - - except OSError: - # Already dead - pass - - cmds.scriptJob( - event=["quitApplication", on_application_quit], - protected=True - ) + app = QtWidgets.QApplication.instance() + app.aboutToQuit.connect(_on_application_quit) # Configure GUI settings.ContextLabel = "Maya" @@ -241,6 +242,9 @@ def threaded_wrapper(func, *args, **kwargs): sys.stdout.write("Setting up Pyblish QML in Houdini\n") register_dispatch_wrapper(threaded_wrapper) + app = QtWidgets.QApplication.instance() + app.aboutToQuit.connect(_on_application_quit) + settings.ContextLabel = "Houdini" settings.WindowTitle = "Pyblish (Houdini)" @@ -259,6 +263,9 @@ def threaded_wrapper(func, *args, **kwargs): sys.stdout.write("Setting up Pyblish QML in Nuke\n") register_dispatch_wrapper(threaded_wrapper) + app = QtWidgets.QApplication.instance() + app.aboutToQuit.connect(_on_application_quit) + settings.ContextLabel = "Nuke" settings.WindowTitle = "Pyblish (Nuke)" @@ -278,6 +285,9 @@ def threaded_wrapper(func, *args, **kwargs): sys.stdout.write("Setting up Pyblish QML in Hiero\n") register_dispatch_wrapper(threaded_wrapper) + app = QtWidgets.QApplication.instance() + app.aboutToQuit.connect(_on_application_quit) + settings.ContextLabel = "Hiero" settings.WindowTitle = "Pyblish (Hiero)" diff --git a/pyblish_qml/version.py b/pyblish_qml/version.py index 2fbda5a..35161c9 100644 --- a/pyblish_qml/version.py +++ b/pyblish_qml/version.py @@ -1,7 +1,7 @@ VERSION_MAJOR = 1 VERSION_MINOR = 0 -VERSION_PATCH = 3 +VERSION_PATCH = 4 version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) version = '%i.%i.%i' % version_info diff --git a/test_docker.sh b/test_docker.sh new file mode 100644 index 0000000..2e1f416 --- /dev/null +++ b/test_docker.sh @@ -0,0 +1,2 @@ +# Source this script +docker run --rm -v $(pwd):/pyblish-qml pyblish/pyblish-qml \ No newline at end of file