- prepared for send and connect (Zwischenstand)
This commit is contained in:
+9
-1
@@ -3,6 +3,9 @@ from PyQt5 import QtWidgets
|
||||
import sys
|
||||
from ws.client.ws_client import WsClient
|
||||
from ws.message import MessageDispatcher
|
||||
from queue import Queue
|
||||
import asyncio
|
||||
from ws.connection import IConnection
|
||||
|
||||
|
||||
class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
@@ -21,6 +24,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.setupUi(self)
|
||||
self.actionStart.triggered.connect(self.connect)
|
||||
self.actionStop.triggered.connect(self.disconnect)
|
||||
self.send_data = Queue()
|
||||
|
||||
def connect(self):
|
||||
self.ws_client.connect(uri="ws://localhost:8765")
|
||||
@@ -49,7 +53,11 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
pass
|
||||
|
||||
async def on_send(self):
|
||||
return None
|
||||
try:
|
||||
data = await asyncio.get_event_loop().run_in_executor(None, self.send_data.get, True, 1)
|
||||
return data
|
||||
except:
|
||||
return None
|
||||
|
||||
def closeEvent(self, event):
|
||||
print("Exitting gracefully!")
|
||||
|
||||
Reference in New Issue
Block a user