| 1 | # vim: set expandtab shiftwidth=4 softtabstop=4:
|
|---|
| 2 |
|
|---|
| 3 | from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
|
|---|
| 4 |
|
|---|
| 5 | class Dialog(QObject):
|
|---|
| 6 |
|
|---|
| 7 | _sendText = pyqtSignal(str, name="sendText")
|
|---|
| 8 |
|
|---|
| 9 | def sendText(self, text):
|
|---|
| 10 | self._sendText.emit(text)
|
|---|
| 11 |
|
|---|
| 12 | @pyqtSlot(str)
|
|---|
| 13 | def receiveText(self, text):
|
|---|
| 14 | print("receiveText", text)
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 | def setup_channel():
|
|---|
| 18 | from PyQt5.QtWebChannel import QWebChannel
|
|---|
| 19 | channel = QWebChannel()
|
|---|
| 20 | dialog = Dialog()
|
|---|
| 21 | channel.registerObject("dialog", dialog)
|
|---|
| 22 | from chimerax.help_viewer.tool import HelpUI
|
|---|
| 23 | HelpUI.get_viewer(session).help_window.page().setWebChannel(channel)
|
|---|
| 24 | return dialog, channel
|
|---|
| 25 |
|
|---|
| 26 | print(setup_channel())
|
|---|