Skip to content

Commit

Permalink
Merge pull request #230 from mottosso/fix120
Browse files Browse the repository at this point in the history
Fix #120
  • Loading branch information
mottosso authored Mar 2, 2017
2 parents 60b7bad + 1550e97 commit 9489329
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Source this script
docker build -t pyblish/pyblish-qml .
44 changes: 27 additions & 17 deletions pyblish_qml/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"
Expand All @@ -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)"

Expand All @@ -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)"

Expand All @@ -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)"

Expand Down
2 changes: 1 addition & 1 deletion pyblish_qml/version.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions test_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Source this script
docker run --rm -v $(pwd):/pyblish-qml pyblish/pyblish-qml

0 comments on commit 9489329

Please sign in to comment.