(self, *args, **kwargs)
| 25 | ) |
| 26 | |
| 27 | def __init__(self, *args, **kwargs): |
| 28 | super(WindowSlave, self).__init__(*args, **kwargs) |
| 29 | # 监听剪切板 |
| 30 | clipboard = QApplication.clipboard() |
| 31 | clipboard.dataChanged.connect(self.on_data_changed) |
| 32 | # 加入Master节点 |
| 33 | node = QRemoteObjectNode(parent=self) |
| 34 | node.connectToNode(QUrl('tcp://{}:{}'.format(sys.argv[1], sys.argv[2]))) |
| 35 | # 获取WindowMaster对象 |
| 36 | self.windowMaster = node.acquireDynamic('WindowMaster') |
| 37 | # 初始化成功后才能去绑定信号等 |
| 38 | self.windowMaster.initialized.connect(self.onInitialized) |
| 39 | # 状态改变 https://doc.qt.io/qt-5/qremoteobjectreplica.html#State-enum |
| 40 | self.windowMaster.stateChanged.connect(self.onStateChanged) |
| 41 | |
| 42 | def onStateChanged(self, newState, oldState): |
| 43 | if newState == QRemoteObjectReplica.Suspect: |
nothing calls this directly
no outgoing calls
no test coverage detected