`js` to the web app. The web app may access the data from the plugin by using
the `js.get()` function. The web app may return data to the plugin by calling
the `run` function of the exposed `js` object with the return data as the
-argument.
+argument. The web app window may be closed by calling the `close` function of
+the `js` object.
Template Development
--------------------
self.channel.registerObject("js", self.js)
self.webview.page().setWebChannel(self.channel)
self.js.done.connect(lambda: self.done.emit())
+ self.js.hide.connect(lambda: self.close())
class JS(QObject):
done=pyqtSignal()
+ hide=pyqtSignal()
def __init__(self, module, prescription, data):
super().__init__()
def get(self):
return self.data
+ @pyqtSlot()
+ def close(self):
+ self.hide.emit()
+
class Worker(QThread):
pluginComplete=pyqtSignal(str, int)