Skip to content

Commit

Permalink
Merge pull request #47 from mottosso/master
Browse files Browse the repository at this point in the history
Adding event handler in case QML source files are loaded remotely.
  • Loading branch information
mottosso committed Feb 19, 2015
2 parents 09c1ab7 + 30b83ec commit 9e41bfb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyblish_qml/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def run_production_app(host, port):

engine = QtQml.QQmlApplicationEngine()
engine.addImportPath(qml_import_dir)
engine.objectCreated.connect(object_created_handler)

ctrl = Controller(host, prefix="/pyblish/v1")
ctx = engine.rootContext()
Expand All @@ -312,13 +313,18 @@ def run_production_app(host, port):
with util.Timer("Spent %.2f ms building the GUI.."):
engine.load(app_path)

window = engine.rootObjects()[0]
window.show()

print "Running production app on port: %s" % port
sys.exit(app.exec_())


def object_created_handler(obj, url):
"""Show the Window as soon as it has been created"""
if obj is not None:
obj.show()
else:
sys.exit()


if __name__ == '__main__':
import argparse

Expand Down

0 comments on commit 9e41bfb

Please sign in to comment.