update 更新界面更新逻辑,子线程触发代理交于主线程更新

This commit is contained in:
FrankCV2048
2024-12-15 19:54:44 +08:00
parent ccf177273d
commit 2c6539ef51
3 changed files with 24 additions and 17 deletions

View File

@ -1,6 +1,6 @@
import os
Debug = False
Debug = True
IO_EmergencyPoint = 3
bag_height = 10 # 一袋的高度
position_accuracy = 0.1

View File

@ -1,7 +1,7 @@
[Main]
[Robot_Feed]
ipaddress = 192.168.20.4
ipaddress = 127.0.0.1
port = 502
j1_min = -150
j1_max = +150
@ -47,7 +47,7 @@ photo_v5 = 0.0
photo_w5 = 1.0
linecount = 2
remain_linename = 1
remain_count = 12
remain_count = 574
io_take_addr = 8
io_zip_addr = 11
io_shake_addr = 12
@ -62,12 +62,12 @@ feed_speed = 10
reset_speed = 35
[Origin]
x = 1927.155273
y = 570.19989
z = 1299.689941
u = 6.975893
v = -9.897896
w = -135.095978
x = 7.0
y = 50.0
z = 1.0
u = 12.0
v = 0.0
w = 1.0
[Camera_Feed]
ipaddress = 127.0.0.1

13
main.py
View File

@ -1,6 +1,7 @@
import configparser
import json
import logging
import os
import queue
import sys
import threading
@ -47,6 +48,7 @@ from view.ResetView import StopDialog
class MainWindow(QMainWindow, Ui_MainWindow):
updateUI_seting = Signal()
def __init__(self):
super(MainWindow, self).__init__()
self.setupUi(self)
@ -642,6 +644,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.last_time = time.time()
self.remain_lineName = self.configReader.get('Robot_Feed', 'remain_lineName')
self.remain_Count = int(self.configReader.get('Robot_Feed', 'remain_Count'))
self.updateUI_seting.connect(self.update_seting_frame)
try:
self.robotClient.CreatConnect()
except:
@ -1365,14 +1368,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.label_date.setText(datetime.now().strftime("%Y-%m-%d"))
self.label_time.setText(datetime.now().strftime("%H:%M:%S"))
self.updateUI_seting.emit()
def update_seting_frame(self):
self.updateUI_Position()
self.updateUI_label_detection()
self.updateUI_label_status()
self.updateUI_frame_sign(self.feeding.feedStatus)
self.updateUI_IOPanel()
def updateRobotSeting(self):
self.lineEdit_origin_x.setText(str(self.robotClient.origin_position.X))
self.lineEdit_origin_y.setText(str(self.robotClient.origin_position.Y))
@ -1972,7 +1976,10 @@ if __name__ == "__main__":
app = MyApplication(sys.argv)
window = MainWindow()
window.show()
sys.excepthook = handle_exception # 你的 PySide 应用程序代码 pass
sys.excepthook = handle_exception
try :
sys.exit(app.exec())
except Exception as e:
log.log_message(logging.ERROR, e)