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