MCPcopy Create free account
hub / github.com/PyQt5/PyQt / __init__

Method __init__

QtRemoteObjects/SyncUi/ClipboardSlave.py:27–40  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected