Skip to content

Commit

Permalink
Merge pull request #347 from davidlatwe/Fix#335
Browse files Browse the repository at this point in the history
Fix#335
  • Loading branch information
davidlatwe authored Oct 22, 2019
2 parents 058fe75 + 1271556 commit 8c0a7aa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
7 changes: 6 additions & 1 deletion pyblish_qml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
)


def show(parent=None, targets=None, modal=None, foster=None, auto_publish=False, auto_validate=False):
def show(parent=None,
targets=None,
modal=None,
foster=None,
auto_publish=False,
auto_validate=False):
from . import host

if foster is not None:
Expand Down
15 changes: 13 additions & 2 deletions pyblish_qml/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class Application(QtGui.QGuiApplication):
published = QtCore.pyqtSignal()
validated = QtCore.pyqtSignal()

targeted = QtCore.pyqtSignal(QtCore.QVariant)

risen = QtCore.pyqtSignal()
inFocused = QtCore.pyqtSignal()
outFocused = QtCore.pyqtSignal()
Expand Down Expand Up @@ -105,6 +107,8 @@ def __init__(self, source, targets=[]):
self.published.connect(self.publish)
self.validated.connect(self.validate)

self.targeted.connect(self.target)

self.risen.connect(self.rise)
self.inFocused.connect(self.inFocus)
self.outFocused.connect(self.outFocus)
Expand Down Expand Up @@ -182,8 +186,10 @@ def show(self, client_settings=None):
util.timer_end("ready", "Awaited statemachine for %.2f ms")

if client_settings:
self.controller.data['autoValidate'] = client_settings.get('autoValidate', False)
self.controller.data['autoPublish'] = client_settings.get('autoPublish', False)
auto_validate = client_settings.get('autoValidate', False)
auto_publish = client_settings.get('autoPublish', False)
self.controller.data['autoValidate'] = auto_validate
self.controller.data['autoPublish'] = auto_publish

self.controller.show.emit()

Expand Down Expand Up @@ -223,6 +229,9 @@ def validate(self):
"""Fire up the validation sequance"""
self.controller.validate()

def target(self, targets):
self.controller.targets = targets

def listen(self):
"""Listen on incoming messages from host
Expand All @@ -249,6 +258,8 @@ def _listen():
"publish": "published",
"validate": "validated",

"target": "targeted",

"rise": "risen",
"inFocus": "inFocused",
"outFocus": "outFocused",
Expand Down
12 changes: 9 additions & 3 deletions pyblish_qml/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ def uninstall():
sys.stdout.write("Pyblish QML shutdown successful.\n")


def show(parent=None, targets=[], modal=None, auto_publish=False, auto_validate=False):
def show(parent=None,
targets=[],
modal=None,
auto_publish=False,
auto_validate=False):
"""Attempt to show GUI
Requires install() to have been run first, and
Expand Down Expand Up @@ -106,6 +110,8 @@ def show(parent=None, targets=[], modal=None, auto_publish=False, auto_validate=
proxy = ipc.server.Proxy(server)

try:
# Update target
proxy.target(targets)
proxy.show(show_settings)
return server

Expand Down Expand Up @@ -144,7 +150,7 @@ def proxy_call_wrapper(*args, **kwargs):
# get existing GUI
if _state.get("currentServer"):
server = _state["currentServer"]
proxy = Proxy(server)
proxy = ipc.server.Proxy(server)
try:
return func(proxy, *args, **kwargs)
except IOError:
Expand All @@ -163,7 +169,7 @@ def validate(proxy):
proxy.validate()


@proxy_call
@proxy_call
def hide(proxy):
proxy.hide()

Expand Down
3 changes: 3 additions & 0 deletions pyblish_qml/ipc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def publish(self):
def validate(self):
self._dispatch("validate")

def target(self, targets):
self._dispatch("target", args=[targets])

def _dispatch(self, func, args=None):
data = json.dumps(
{
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 = 10
VERSION_PATCH = 4
VERSION_PATCH = 5

version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
version = '%i.%i.%i' % version_info
Expand Down

0 comments on commit 8c0a7aa

Please sign in to comment.