Skip to content

Commit 8c0a7aa

Browse files
authored
Merge pull request #347 from davidlatwe/Fix#335
Fix#335
2 parents 058fe75 + 1271556 commit 8c0a7aa

5 files changed

Lines changed: 32 additions & 7 deletions

File tree

pyblish_qml/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
)
66

77

8-
def show(parent=None, targets=None, modal=None, foster=None, auto_publish=False, auto_validate=False):
8+
def show(parent=None,
9+
targets=None,
10+
modal=None,
11+
foster=None,
12+
auto_publish=False,
13+
auto_validate=False):
914
from . import host
1015

1116
if foster is not None:

pyblish_qml/app.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ class Application(QtGui.QGuiApplication):
7070
published = QtCore.pyqtSignal()
7171
validated = QtCore.pyqtSignal()
7272

73+
targeted = QtCore.pyqtSignal(QtCore.QVariant)
74+
7375
risen = QtCore.pyqtSignal()
7476
inFocused = QtCore.pyqtSignal()
7577
outFocused = QtCore.pyqtSignal()
@@ -105,6 +107,8 @@ def __init__(self, source, targets=[]):
105107
self.published.connect(self.publish)
106108
self.validated.connect(self.validate)
107109

110+
self.targeted.connect(self.target)
111+
108112
self.risen.connect(self.rise)
109113
self.inFocused.connect(self.inFocus)
110114
self.outFocused.connect(self.outFocus)
@@ -182,8 +186,10 @@ def show(self, client_settings=None):
182186
util.timer_end("ready", "Awaited statemachine for %.2f ms")
183187

184188
if client_settings:
185-
self.controller.data['autoValidate'] = client_settings.get('autoValidate', False)
186-
self.controller.data['autoPublish'] = client_settings.get('autoPublish', False)
189+
auto_validate = client_settings.get('autoValidate', False)
190+
auto_publish = client_settings.get('autoPublish', False)
191+
self.controller.data['autoValidate'] = auto_validate
192+
self.controller.data['autoPublish'] = auto_publish
187193

188194
self.controller.show.emit()
189195

@@ -223,6 +229,9 @@ def validate(self):
223229
"""Fire up the validation sequance"""
224230
self.controller.validate()
225231

232+
def target(self, targets):
233+
self.controller.targets = targets
234+
226235
def listen(self):
227236
"""Listen on incoming messages from host
228237
@@ -249,6 +258,8 @@ def _listen():
249258
"publish": "published",
250259
"validate": "validated",
251260

261+
"target": "targeted",
262+
252263
"rise": "risen",
253264
"inFocus": "inFocused",
254265
"outFocus": "outFocused",

pyblish_qml/host.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ def uninstall():
7676
sys.stdout.write("Pyblish QML shutdown successful.\n")
7777

7878

79-
def show(parent=None, targets=[], modal=None, auto_publish=False, auto_validate=False):
79+
def show(parent=None,
80+
targets=[],
81+
modal=None,
82+
auto_publish=False,
83+
auto_validate=False):
8084
"""Attempt to show GUI
8185
8286
Requires install() to have been run first, and
@@ -106,6 +110,8 @@ def show(parent=None, targets=[], modal=None, auto_publish=False, auto_validate=
106110
proxy = ipc.server.Proxy(server)
107111

108112
try:
113+
# Update target
114+
proxy.target(targets)
109115
proxy.show(show_settings)
110116
return server
111117

@@ -144,7 +150,7 @@ def proxy_call_wrapper(*args, **kwargs):
144150
# get existing GUI
145151
if _state.get("currentServer"):
146152
server = _state["currentServer"]
147-
proxy = Proxy(server)
153+
proxy = ipc.server.Proxy(server)
148154
try:
149155
return func(proxy, *args, **kwargs)
150156
except IOError:
@@ -163,7 +169,7 @@ def validate(proxy):
163169
proxy.validate()
164170

165171

166-
@proxy_call
172+
@proxy_call
167173
def hide(proxy):
168174
proxy.hide()
169175

pyblish_qml/ipc/server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ def publish(self):
7777
def validate(self):
7878
self._dispatch("validate")
7979

80+
def target(self, targets):
81+
self._dispatch("target", args=[targets])
82+
8083
def _dispatch(self, func, args=None):
8184
data = json.dumps(
8285
{

pyblish_qml/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
VERSION_MAJOR = 1
33
VERSION_MINOR = 10
4-
VERSION_PATCH = 4
4+
VERSION_PATCH = 5
55

66
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
77
version = '%i.%i.%i' % version_info

0 commit comments

Comments
 (0)