源码
This commit is contained in:
28
main.py
28
main.py
@ -25,7 +25,7 @@ from datetime import datetime
|
||||
from click import clear
|
||||
|
||||
import Util.util_pic
|
||||
from Model.FeedModel import LineModel, PositionModel, DropLineModel, DropPositionModel
|
||||
from Model.FeedModel import LineModel, PositionModel
|
||||
from Util.util_ini import writeFeedLine_to_ini
|
||||
import Constant
|
||||
from CU.Command import FeedCommand
|
||||
@ -70,12 +70,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.init_qss()
|
||||
self.init_UI()
|
||||
self.init_Run()
|
||||
# self.init_drop_bags()
|
||||
self.init_robot_info()
|
||||
self.init_IOPanel()
|
||||
self.start_Runing()
|
||||
self.init_log()
|
||||
self.init_DropLine()
|
||||
self.init_FeedLine()
|
||||
self.init_table_lines()
|
||||
self.init_table_position()
|
||||
@ -661,7 +659,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.command_position_quene = Queue()
|
||||
self.status_address = DataAddress()
|
||||
self.feedLine_dict = {}
|
||||
self.dropLine_dict = {}
|
||||
self.command_quene = Queue()
|
||||
self.main_threading = None
|
||||
self.detection_person = None # DetectionPerson()
|
||||
@ -736,17 +733,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
return Error_Code.SYS_NETERROR
|
||||
|
||||
def init_DropLine(self):
|
||||
configReader = configparser.ConfigParser()
|
||||
configReader.read(Constant.drop_points_file, encoding='utf-8')
|
||||
for i in range(1, Constant.MAX_Drop_num):
|
||||
line_str = f'{Constant.dropLine_set_section}{i}'
|
||||
if configReader.has_section(line_str):
|
||||
drop_points = DropLineModel()
|
||||
drop_points.read_line_model(config_reader=configReader, index=i)
|
||||
self.dropLine_dict[f'{Constant.dropLine_set_section}{i}'] = drop_points
|
||||
self.updateUI_Select_Line()
|
||||
|
||||
def init_seting_frame(self):
|
||||
|
||||
rows = len(self.feedLine_dict.keys()) + 1
|
||||
@ -985,10 +971,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
num = self.horizontalSlider_feedingNum.maximum()
|
||||
line_head = self.comboBox_lineIndex.currentData()
|
||||
#通过投料line查询丢包line
|
||||
drop_line_id = self.feedLine_dict[line_head].dropline_id
|
||||
drop_head = f'DropLine{drop_line_id}'
|
||||
self.command_quene.put(FeedCommand(FeedingConfig(num, FeedLine(self.feedLine_dict[line_head].id,self.feedLine_dict[line_head].name,self.feedLine_dict[line_head].positions, self.dropLine_dict[drop_head]), self.feeding.robotClient.photo_locs[:])))
|
||||
self.command_quene.put(FeedCommand(FeedingConfig(num, FeedLine(self.feedLine_dict[line_head].id,self.feedLine_dict[line_head].name,self.feedLine_dict[line_head].positions), self.feeding.robotClient.photo_locs[:])))
|
||||
# self.stackedWidget_num.setCurrentIndex(1)
|
||||
self.set_run_status_button(True)
|
||||
self.feeding.pause = False
|
||||
@ -1440,10 +1423,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
if self.sensor_thread.is_alive():
|
||||
self.sensor_thread.join(timeout=1)
|
||||
print("🛑 传感器监控线程已关闭(暂停/完成/回退)")
|
||||
self.relay_controller.close(conveyor2=True)
|
||||
except Exception as e:
|
||||
log.log_message(logging.ERROR, f"关闭传感器线程异常: {e}")
|
||||
finally:
|
||||
self.sensor_thread = None
|
||||
|
||||
# 如果你也有 handle_sensor2 线程,也可以在这里关闭
|
||||
|
||||
# 处理命令队列
|
||||
@ -1583,13 +1568,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
def log_message(self,level,message):
|
||||
log.log_message(level,message)
|
||||
|
||||
def updateUI_Select_Line(self) -> None:
|
||||
def updateUI_Select_Line(self):
|
||||
self.comboBox_lineIndex.clear()
|
||||
for key, value in self.feedLine_dict.items():
|
||||
self.comboBox_lineIndex.addItem(value.name, key)
|
||||
for key, value in self.dropLine_dict.items():
|
||||
self.comboBox_lineIndex.addItem(value.name, key)
|
||||
|
||||
def updateUI_label_status(self):
|
||||
if self.robotClient.status_model.isMoving==1:
|
||||
self.label_move_sign.show()
|
||||
|
||||
Reference in New Issue
Block a user