update 更新界面更新逻辑,子线程触发代理交于主线程更新
This commit is contained in:
23
main.py
23
main.py
@ -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,13 +1368,14 @@ 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_Position()
|
||||
self.updateUI_label_detection()
|
||||
self.updateUI_label_status()
|
||||
self.updateUI_frame_sign(self.feeding.feedStatus)
|
||||
self.updateUI_IOPanel()
|
||||
|
||||
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))
|
||||
@ -1972,7 +1976,10 @@ if __name__ == "__main__":
|
||||
app = MyApplication(sys.argv)
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
sys.excepthook = handle_exception # 你的 PySide 应用程序代码 pass
|
||||
sys.exit(app.exec())
|
||||
sys.excepthook = handle_exception
|
||||
try :
|
||||
sys.exit(app.exec())
|
||||
except Exception as e:
|
||||
log.log_message(logging.ERROR, e)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user