diff --git a/Config/FeedLine.ini b/Config/FeedLine.ini index 860cd5f..4b4bceb 100644 --- a/Config/FeedLine.ini +++ b/Config/FeedLine.ini @@ -2,25 +2,8 @@ id = 1 name = 反应釜1 -[FeedLine2] -id = 2 -name = 反应釜2 - -[Position1] -x = 711.544373 -y = 2058.108887 -z = 1652.191772 -u = 3.285049 -v = 25.047607 -w = -102.662521 -id = 1 -order = 1 -lineid = 1 -status = 2 -linetype = 0 - [Position2] -x = 11000.0 +x = 421.397 y = 2095.76 z = 1403.803 u = 2.787 @@ -32,133 +15,59 @@ lineid = 1 status = 3 linetype = 2 +[FeedLine2] +id = 2 +name = 未定义 + [Position3] -x = 116.779472 -y = 1554.860718 -z = 598.915833 -u = 4.423964 -v = 15.661633 -w = -80.555466 +x = 0.0 +y = 0.0 +z = 0.0 +u = 0.0 +v = 0.0 +w = 0.0 id = 3 -order = 2 +order = 0 +lineid = 2 +status = 3 +linetype = 0 + +[Position5] +x = 0.0 +y = 0.0 +z = 0.0 +u = 0.0 +v = 0.0 +w = 0.0 +id = 5 +order = 1 lineid = 1 status = 4 linetype = 0 [Position4] -x = 230.750946 -y = 1330.444702 -z = 339.72052 -u = 2.843005 -v = 6.159603 -w = -85.733009 +x = 0.0 +y = 0.0 +z = 0.0 +u = 0.0 +v = 0.0 +w = 0.0 id = 4 -order = 4 +order = 2 lineid = 1 -status = 3 +status = 2 linetype = 0 -[Position5] -x = 116.779472 -y = 1554.860718 -z = 598.915833 -u = 4.423964 -v = 15.661633 -w = -80.555466 -id = 5 +[Position1] +x = 0.0 +y = 0.0 +z = 0.0 +u = 0.0 +v = 0.0 +w = 0.0 +id = 1 order = 3 lineid = 1 status = 5 linetype = 0 -[Position6] -x = 230.750946 -y = 1330.444702 -z = 339.72052 -u = 2.843005 -v = 6.159603 -w = -85.733009 -id = 6 -order = 5 -lineid = 1 -status = 3 -linetype = 0 - -[Position7] -x = 116.779472 -y = 1554.860718 -z = 598.915833 -u = 4.423964 -v = 15.661633 -w = -80.555466 -id = 7 -order = 6 -lineid = 1 -status = 6 -linetype = 0 - -[Position8] -x = 230.750946 -y = 1330.444702 -z = 339.72052 -u = 2.843005 -v = 6.159603 -w = -85.733009 -id = 8 -order = 7 -lineid = 1 -status = 7 -linetype = 0 - -[Position9] -x = 116.779472 -y = 1554.860718 -z = 598.915833 -u = 4.423964 -v = 15.661633 -w = -80.555466 -id = 9 -order = 8 -lineid = 1 -status = 8 -linetype = 0 - -[Position10] -x = 230.750946 -y = 1330.444702 -z = 339.72052 -u = 2.843005 -v = 6.159603 -w = -85.733009 -id = 10 -order = 9 -lineid = 1 -status = 3 -linetype = 0 - -[Position11] -x = 116.779472 -y = 1554.860718 -z = 598.915833 -u = 4.423964 -v = 15.661633 -w = -80.555466 -id = 11 -order = 10 -lineid = 1 -status = 9 -linetype = 0 - -[Position12] -x = 230.750946 -y = 1330.444702 -z = 339.72052 -u = 2.843005 -v = 6.159603 -w = -85.733009 -id = 12 -order = 11 -lineid = 1 -status = 3 -linetype = 0 - diff --git a/Seting.ini b/Seting.ini index 716ee20..b08d5a7 100644 --- a/Seting.ini +++ b/Seting.ini @@ -47,7 +47,7 @@ photo_v5 = 0.0 photo_w5 = 1.0 linecount = 2 remain_linename = 1 -remain_count = 1 +remain_count = 0 io_take_addr = 3 io_zip_addr = 2 io_shake_addr = 10 diff --git a/main.py b/main.py index 8ca36f9..e3bd17a 100644 --- a/main.py +++ b/main.py @@ -357,7 +357,22 @@ class MainWindow(QMainWindow, Ui_MainWindow): return if self.tableWidget_line_positions.currentRow()==-1: return + section = self.tableWidget_line_positions.item(self.tableWidget_line_positions.currentRow(),0).text() + + id = int(self.tableWidget_line_positions.item(self.tableWidget_line_positions.currentRow(), 9).text()) + line_model = self.feedLine_dict.get(self.selected_line_section) + for pos_model in line_model.positions: + if pos_model.id == id: + line_model.positions.remove(pos_model) + break self.tableWidget_line_positions.removeRow(self.tableWidget_line_positions.currentRow()) + + config_writer = configparser.ConfigParser() + config_writer.read(Constant.feedLine_set_file, encoding = 'utf-8') + config_writer.remove_section(section) + config_writer.write(open(Constant.feedLine_set_file,'w',encoding='utf-8')) + + self.table_position_changed = True def add_new_position(self):# 选中添加 @@ -381,14 +396,15 @@ class MainWindow(QMainWindow, Ui_MainWindow): else: row_i = self.tableWidget_line_positions.currentRow() - self.tableWidget_line_positions.insertRow(row_i) + # self.tableWidget_line_positions.setRowCount(self.tableWidget_line_positions.rowCount()+1) + self.tableWidget_line_positions.insertRow(row_i+1) position_model.order = 0 position_model.status = 1 line_model = self.feedLine_dict.get(self.selected_line_section) line_id = line_model.id position_model.lineId = line_id - self.set_positionModel_to_tabel(row_i,position_model) + self.set_positionModel_to_tabel(row_i+1,position_model) self.table_line_changed = True def tabel_get_position(self,row_i): @@ -720,12 +736,13 @@ class MainWindow(QMainWindow, Ui_MainWindow): def init_FeedLine(self): # line_count = self.configReader.get('Robot_Feed', 'LineCount', fallback=0) - self.configReader.read(Constant.feedLine_set_file, encoding='utf-8') + configReader = configparser.ConfigParser() + configReader.read(Constant.feedLine_set_file, encoding='utf-8') for i in range(1,Constant.MAX_Line_num): line_str = f'{Constant.feedLine_set_section}{i}' - if self.configReader.has_section(line_str): + if configReader.has_section(line_str): feed_line = LineModel() - feed_line.read_line_model(config_reader=self.configReader,index=i) + feed_line.read_line_model(config_reader=configReader,index=i) self.feedLine_dict[f'{Constant.feedLine_set_section}{i}'] = feed_line self.updateUI_Select_Line() pass diff --git a/test6.py b/test6.py index dbf6201..e69de29 100644 --- a/test6.py +++ b/test6.py @@ -1,49 +0,0 @@ - -import configparser -import json -import logging -import queue -import sys -from multiprocessing import Process - -from PyQt5.uic.properties import QtWidgets -from PySide6.QtCore import QThread, Signal, Slot, QObject, QEvent -from PySide6.QtGui import QIntValidator, QStandardItemModel, QStandardItem, Qt, QMovie -from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QHeaderView, QTableWidget, \ - QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox -from datetime import datetime - -import Util.util_pic -from Util.util_ini import writeFeedLine_to_ini -import Constant -from CU.Command import FeedCommand -from CU.Feeding import FeedLine, FeedingConfig, Feeding, FeedStatus -from Util.util_log import QTextEditLogger -from Vision.camera_coordinate_dete import Detection - -from COM.COM_Robot import RobotClient -from Expection import Error_Code -from queue import Queue -from Model.RobotModel import * -import time -from queue import Queue -from Model.Position import Real_Position, Detection_Position -from threading import Thread -from CU.Command import Status -from Util.util_log import log -from ui_MainWin import Ui_MainWindow - -class MainWindow1(QMainWindow, Ui_MainWindow): - def __init__(self): - super(MainWindow1, self).__init__() - self.setupUi(self) - - - -if __name__ == "__main__": - app = QApplication(sys.argv) - window = MainWindow1() - window.show() - sys.exit(app.exec()) - -