7 Module implementing a websocket class to be connect to the MicroPython webrepl |
7 Module implementing a websocket class to be connect to the MicroPython webrepl |
8 interface. |
8 interface. |
9 """ |
9 """ |
10 |
10 |
11 from PyQt6.QtCore import ( |
11 from PyQt6.QtCore import ( |
12 QCoreApplication, QEventLoop, QMutex, QTime, QTimer, QUrl, pyqtSignal, pyqtSlot |
12 QCoreApplication, |
|
13 QEventLoop, |
|
14 QMutex, |
|
15 QTime, |
|
16 QTimer, |
|
17 QUrl, |
|
18 pyqtSignal, |
|
19 pyqtSlot, |
13 ) |
20 ) |
14 from PyQt6.QtNetwork import QAbstractSocket |
21 from PyQt6.QtNetwork import QAbstractSocket |
15 from PyQt6.QtWebSockets import QWebSocket |
22 from PyQt6.QtWebSockets import QWebSocket |
16 |
23 |
17 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
24 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
86 self.__timedOut = False |
93 self.__timedOut = False |
87 timer = QTimer() |
94 timer = QTimer() |
88 timer.setSingleShot(True) |
95 timer.setSingleShot(True) |
89 timer.timeout.connect(timeout) |
96 timer.timeout.connect(timeout) |
90 timer.start(self.__timeout) |
97 timer.start(self.__timeout) |
91 |
98 |
92 loop.exec() |
99 loop.exec() |
93 timer.stop() |
100 timer.stop() |
94 if self.state() == QAbstractSocket.SocketState.ConnectedState: |
101 if self.state() == QAbstractSocket.SocketState.ConnectedState: |
95 self.__connected = True |
102 self.__connected = True |
96 return True |
103 return True |