-
Notifications
You must be signed in to change notification settings - Fork 0
/
adding_localkeyboard_to_main.txt
47 lines (41 loc) · 1.67 KB
/
adding_localkeyboard_to_main.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
add the import:
from lclkbd import *
modify the __init__ for main.py (lines marked with **)
def __init__(self):
self.user_ui=True
self.start_tcp=False
self.TCP_Server=Server()
self.parseOpt()
** self.localKb = localKeyboard()
if self.user_ui:
self.app = QApplication(sys.argv)
super(mywindow,self).__init__()
self.setupUi(self)
self.m_DragPosition=self.pos()
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
self.setMouseTracking(True)
self.Button_Server.setText("On")
self.on_pushButton()
self.Button_Server.clicked.connect(self.on_pushButton)
self.pushButton_Close.clicked.connect(self.close)
self.pushButton_Min.clicked.connect(self.windowMinimumed)
if self.start_tcp:
self.TCP_Server.StartTcpServer()
self.ReadData=Thread(target=self.TCP_Server.readdata)
self.SendVideo=Thread(target=self.TCP_Server.sendvideo)
self.power=Thread(target=self.TCP_Server.Power)
** self.ReadLocalKb=Thread(target=self.localKb.read_keys_loop)
self.SendVideo.start()
self.ReadData.start()
self.power.start()
** self.ReadLocalKb.start()
if self.user_ui:
self.label.setText("Server On")
self.Button_Server.setText("Off")
add one line to def close
def close(self):
try:
stop_thread(self.SendVideo)
stop_thread(self.ReadData)
stop_thread(self.power)
** stop_thread(self.ReadLocalKb)