update 完成UI可视化界面生成

This commit is contained in:
FrankCV2048
2024-12-01 22:58:09 +08:00
parent e856bb0f0a
commit 157e7edce5
8 changed files with 607 additions and 165 deletions

View File

@ -1,66 +1,80 @@
[FeedLine1]
id = 1
name = 反应釜1
safeposition_x = 7.0
safeposition_y = 50.0
safeposition_z = 1.0
safeposition_u = 12.0
safeposition_v = 0.0
safeposition_w = 1.0
brokenposition1_x = 7.0
brokenposition1_y = 50.0
brokenposition1_z = 1.0
brokenposition1_u = 12.0
brokenposition1_v = 0.0
brokenposition1_w = 1.0
brokenposition2_x = 7.0
brokenposition2_y = 50.0
brokenposition2_z = 1.0
brokenposition2_u = 12.0
brokenposition2_v = 0.0
brokenposition2_w = 1.0
shakeposition_x = 7.0
shakeposition_y = 50.0
shakeposition_z = 1.0
shakeposition_u = 12.0
shakeposition_v = 0.0
shakeposition_w = 1.0
dropbagposition_x = 7.0
dropbagposition_y = 50.0
dropbagposition_z = 1.0
dropbagposition_u = 12.0
dropbagposition_v = 0.0
dropbagposition_w = 1.0
[FeedLine2]
id = 2
name = 反应釜2
safeposition_x = 715.778259
safeposition_y = 5.285664
safeposition_z = 843.42157
safeposition_u = -171.674973
safeposition_v = 86.072197
safeposition_w = -171.633331
brokenposition1_x = 0.0
brokenposition1_y = 0.0
brokenposition1_z = 0.0
brokenposition1_u = 0.0
brokenposition1_v = 0.0
brokenposition1_w = 0.0
brokenposition2_x = 0.0
brokenposition2_y = 0.0
brokenposition2_z = 0.0
brokenposition2_u = 0.0
brokenposition2_v = 0.0
brokenposition2_w = 0.0
shakeposition_x = 0.0
shakeposition_y = 0.0
shakeposition_z = 0.0
shakeposition_u = 0.0
shakeposition_v = 0.0
shakeposition_w = 0.0
dropbagposition_x = 0.0
dropbagposition_y = 0.0
dropbagposition_z = 0.0
dropbagposition_u = 0.0
dropbagposition_v = 0.0
dropbagposition_w = 0.0
[Position1]
id = 1
order = 1
lineid = 1
status = 0
x = 0
y = 0
z = 0
u = 0
v = 0
w = 0
[Position2]
id = 2
order = 2
lineid = 1
status = 0
x = 0
y = 0
z = 0
u = 0
v = 0
w = 0
[FeedLine3]
id = 3
name = 线3阿斯顿发斯蒂芬
[Position3]
x = 0.0
y = 0.0
z = 0.0
u = 0.0
v = 0.0
w = 0.0
id = 3
order = 5
lineid = 3
status = 3
[FeedLine4]
id = 4
name = 线4阿斯顿发斯蒂芬
[Position4]
x = 0.0
y = 0.0
z = 0.0
u = 0.0
v = 0.0
w = 0.0
id = 4
order = 5
lineid = 4
status = 3
[FeedLine5]
id = 5
name = 线5
[Position5]
x = 0.0
y = 0.0
z = 0.0
u = 0.0
v = 0.0
w = 0.0
id = 5
order = 5
lineid = 5
status = 3

View File

@ -9,7 +9,10 @@ speed = 10
shake_speed = 20
debug_speed=10
feedLine_set_section = 'FeedLine'
position_set_section = 'Position'
feedLine_set_file = f'.{os.sep}Config{os.sep}feedLine.ini'
MAX_Position_num = 1000
MAX_Line_num = 10
set_ini = 'Seting.ini'
movie_moving = './Image/transport.gif'
mode_array = ["", "⼿动模式", "⾃动模式", "停⽌模式", "", "", "","⾃动运⾏中", "单步", "单循环"]

View File

@ -4771,6 +4771,9 @@ font: 10pt "楷体";
</property>
<item>
<widget class="QFrame" name="frame_16">
<property name="styleSheet">
<string notr="true">color: rgb(255, 255, 255);</string>
</property>
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
@ -4778,21 +4781,6 @@ font: 10pt &quot;楷体&quot;;
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_savePosition">
<property name="styleSheet">
@ -4805,7 +4793,52 @@ background-color: rgb(0, 85, 0);</string>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget_positions"/>
<widget class="QLabel" name="label_table_line_title">
<property name="text">
<string>生产线</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget_lines">
<property name="styleSheet">
<string notr="true"> QHeaderView::section {
background-color: #2C2C2C; /* 表头背景色 */
color: white; /* 表头字体颜色 */
font-size: 14px; /* 字体大小 */
font-weight: bold; /* 字体加粗 */
border: 1px solid black; /* 边框颜色 */
padding: 4px; /* 内边距 */
}</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_table_line_position_title">
<property name="text">
<string>TextLabel</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QTableWidget" name="tableWidget_line_positions">
<property name="styleSheet">
<string notr="true"> QHeaderView::section {
background-color: #2C2C2C; /* 表头背景色 */
color: white; /* 表头字体颜色 */
font-size: 14px; /* 字体大小 */
font-weight: bold; /* 字体加粗 */
border: 1px solid black; /* 边框颜色 */
padding: 4px; /* 内边距 */
}</string>
</property>
</widget>
</item>
</layout>
</widget>

85
Model/FeedModel.py Normal file
View File

@ -0,0 +1,85 @@
import configparser
import Constant
from Model.Position import Real_Position
class LineModel:
def __init__(self,index=999):
self.id = index
self.name = '未定义'
self.positions = []
self.section = f'{Constant.feedLine_set_section}{index}'
def read_line_model(self,config_reader,index:int):
self.section = f'FeedLine{index}'
self.id = config_reader.getint(self.section, 'id')
self.name = config_reader.get(self.section, 'name')
for i in range(1, Constant.MAX_Position_num):
if config_reader.has_section(f'{Constant.position_set_section}{i}'):
position = PositionModel()
position.read_position_model(config_reader,i)
if position.lineId == self.id:
self.positions.append(position)
self.positions = sorted(self.positions, key=lambda x: x.order)
def save_line_model(self,config_reader):
if not config_reader.has_section(self.section):
config_reader.add_section(self.section)
config_reader.set(self.section, 'id', str(self.id))
config_reader.set(self.section, 'name', self.name)
for i in range(len(self.positions)):
self.positions[i].save_position_model(config_reader)
class PositionModel:
def __init__(self,index=99):
self.X = 0.0
self.Y = 0.0
self.Z = 0.0
self.U = 0.0
self.V = 0.0
self.W = 0.0
self.id = index
self.order = 0
self.lineId = 0
self.status = 0
self.section = f'Position{index}'
pass
def read_position_model(self,config_reader,index:int):
self.section = f'Position{index}'
self.X = config_reader.getfloat(self.section, 'X')
self.Y = config_reader.getfloat(self.section, 'Y')
self.Z = config_reader.getfloat(self.section, 'Z')
self.U = config_reader.getfloat(self.section, 'U')
self.V = config_reader.getfloat(self.section, 'V')
self.W = config_reader.getfloat(self.section, 'W')
self.id = config_reader.getint(self.section, 'id')
self.order = config_reader.getint(self.section, 'order')
self.lineId = config_reader.getint(self.section, 'lineId')
self.status = config_reader.getint(self.section, 'status')
def get_position(self):
real_pos = Real_Position()
real_pos.init_position(self.X, self.Y, self.Z, self.U, self.V, self.W)
return real_pos
def save_position_model(self,config_reader):
if not config_reader.has_section(self.section):
config_reader.add_section(self.section)
config_reader.set(self.section, 'X', str(self.X))
config_reader.set(self.section, 'Y', str(self.Y))
config_reader.set(self.section, 'Z', str(self.Z))
config_reader.set(self.section, 'U', str(self.U))
config_reader.set(self.section, 'V', str(self.V))
config_reader.set(self.section, 'W', str(self.W))
config_reader.set(self.section, 'id', str(self.id))
config_reader.set(self.section, 'order', str(self.order))
config_reader.set(self.section, 'lineId', str(self.lineId))
config_reader.set(self.section, 'status', str(self.status))

View File

@ -1,6 +0,0 @@
class Robot:
def __init__(self):
pass
def get_origin_position(self):
return Real_Position(0,0,0,0,0,0)

View File

@ -9173,3 +9173,93 @@ Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCamer
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:28:17:0938 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(13356) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:28:17:0949 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(13356) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:28:17:0956 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(13356) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:30:01:0426 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(17844) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:30:01:0430 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(17844) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:30:01:0432 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17844) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:50:06:0613 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(23636) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:50:06:0615 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(23636) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:06:0616 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(23636) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:50:38:0396 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(9324) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:50:38:0398 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(9324) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:50:38:0399 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(9324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:51:39:0081 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(21996) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:51:39:0082 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(21996) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:51:39:0084 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(21996) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:52:12:0228 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(5328) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:52:12:0230 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(5328) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:52:12:0232 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(5328) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 11:53:10:0988 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(24496) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 11:53:10:0991 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(24496) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 11:53:10:0993 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(24496) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 21:06:27:0636 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(19852) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 21:06:27:0644 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(19852) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 21:06:27:0653 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(19852) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Error 2024-12-01 21:07:35:0390 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(6744) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
Warning 2024-12-01 21:07:35:0392 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(6744) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
Warning 2024-12-01 21:07:35:0393 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(6744) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]

345
main.py
View File

@ -10,14 +10,15 @@ import PySide6
from PyQt5.uic.properties import QtWidgets
from PySide6 import QtCore
from PySide6.QtCore import QThread, Signal, Slot, QObject, QEvent, QTimer
from PySide6.QtGui import QIntValidator, QStandardItemModel, QStandardItem, Qt, QMovie, QIcon
from PySide6.QtGui import QIntValidator, QStandardItemModel, QStandardItem, Qt, QMovie, QIcon, QCursor, QColor
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QHeaderView, QTableWidget, \
QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox
QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox, QMenu
from datetime import datetime
from click import clear
import Util.util_pic
from Model.FeedModel import LineModel, PositionModel
from Util.util_ini import writeFeedLine_to_ini
import Constant
from CU.Command import FeedCommand
@ -49,13 +50,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.init_UI()
self.init_Run()
self.init_robot_info()
self.init_FeedLine()
self.init_IOPanel()
self.start_Runing()
self.init_log()
self.init_table_positions()
self.init_FeedLine()
self.init_table_lines()
self.init_table_position()
self.table_line_changed = False
self.table_position_changed = False
self.selected_line_section = ''
def init_IOPanel(self):
self.dirt_io_points = {}
@ -157,34 +161,262 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.widget_y32.clicked.connect(self.send_IO_Point_OpenOrClose)
self.widget_y32.index=32
# region 战线,点位表格初始化
def init_table_lines(self):
self.tableWidget_lines.setColumnCount(4)
def init_table_positions(self):
self.tableWidget_positions.setRowCount(9)
self.tableWidget_positions.setColumnCount(2)
self.tableWidget_positions.setHorizontalHeaderLabels(["名字", "删除点位"])
self.tableWidget_positions.setSelectionBehavior(QTableWidget.SelectRows)
self.tableWidget_positions.setAutoScroll(True)
self.tableWidget_lines.horizontalHeader().setStyleSheet(f"background-color: {QColor(44,44,44).name()};")
self.tableWidget_lines.verticalHeader().setStyleSheet(f"background-color: {QColor(44,44,44).name()};")
self.tableWidget_lines.verticalHeader().hide()
self.tableWidget_lines.setHorizontalHeaderLabels(["节名", "线名", "id", "操作"])
self.tableWidget_lines.setSelectionBehavior(QTableWidget.SelectRows)
self.tableWidget_lines.setAutoScroll(True)
self.tableWidget_lines. setColumnHidden(0,True)
self.tableWidget_lines. setColumnHidden(2,True)
# 自动调整列宽
header = self.tableWidget_positions.horizontalHeader()
# 让第一列宽度根据内容自动调整
header = self.tableWidget_lines.horizontalHeader()
header.setSectionResizeMode(0, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
# 第二列宽度根据内容自动调整
header.setSectionResizeMode(1, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
header.setSectionResizeMode(2, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
self.tableWidget_lines.setContextMenuPolicy(PySide6.QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
self.tableWidget_lines.customContextMenuRequested.connect(self.show_lines_context_menu)
self.tableWidget_lines.cellChanged.connect(self.send_table_lines_cell_changed)
self.init_table_lines_data()
for row in range(5):
combo = QComboBox()
combo.addItems(["位置 A", "位置 B", "位置 C"])
self.tableWidget_positions.setCellWidget(row, 0, combo)
self.pushButton_savePosition.clicked.connect(self.send_save_lines_data)
for row in range(5):
get_button = QPushButton("获取位置")
# get_button.clicked.connect(self.get_location)
self.tableWidget_positions.setCellWidget(row, 1, get_button)
def send_table_lines_cell_changed(self):
self.table_line_changed = True
def send_save_lines_data(self):
if self.table_position_changed or self.table_line_changed:
section = self.selected_line_section
for row_i in range(self.tableWidget_lines.rowCount()):
if self.tableWidget_lines.item(row_i, 0).text() == section:
line_model = LineModel()
line_model.section = section
line_model.name = self.tableWidget_lines.item(row_i, 1).text()
line_model.id = int(self.tableWidget_lines.item(row_i, 2).text())
line_model.positions = self.get_table_positions()
if len(self.get_table_positions()) != 0 and line_model.id != self.get_table_positions()[0].id:
return
if len(self.get_table_positions())==0:
return
config_reader = configparser.ConfigParser()
config_reader.read(Constant.feedLine_set_file, encoding='utf-8')
line_model.save_line_model(config_reader)
config_reader.write(open(Constant.feedLine_set_file, 'w', encoding='utf-8'))
break
self.init_FeedLine()
self.init_table_lines_data()
self.table_line_changed = False
self.table_position_changed = False
def get_table_positions(self):
position_models = []
for row_i in range(self.tableWidget_line_positions.rowCount()):
section = self.tableWidget_line_positions.item(row_i, 0).text()
position_model = PositionModel(index=row_i)
position_model.section = section
position_model.X = float(self.tableWidget_line_positions.item(row_i, 1).text())
position_model.Y = float(self.tableWidget_line_positions.item(row_i, 2).text())
position_model.Z = float(self.tableWidget_line_positions.item(row_i, 3).text())
position_model.U = float(self.tableWidget_line_positions.item(row_i, 4).text())
position_model.V = float(self.tableWidget_line_positions.item(row_i, 5).text())
position_model.W = float(self.tableWidget_line_positions.item(row_i, 6).text())
widget = self.tableWidget_line_positions.cellWidget(row_i, 7)
position_model.status = widget.currentData()
position_model.id = int(self.tableWidget_line_positions.item(row_i, 8).text())
position_model.order = row_i
position_model.lineId = int(self.tableWidget_line_positions.item(row_i, 10).text())
position_models.append(position_model)
return position_models
def init_table_lines_data(self):
# self.tableWidget_lines.setItem(0, 0, QTableWidgetItem("线1"))
# self.tableWidget_lines.setItem(1, 0, QTableWidgetItem("线2"))
# self.tableWidget_lines.setItem()
self.tableWidget_lines.setRowCount(0)
for key,value in self.feedLine_dict.items():
self.tableWidget_lines.insertRow(self.tableWidget_lines.rowCount())
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 0, QTableWidgetItem(key))
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 1, QTableWidgetItem(value.name))
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 2, QTableWidgetItem(value.id))
show_pos_btn = QPushButton("显示路径")
show_pos_btn.clicked.connect(
lambda _, index=self.tableWidget_lines.rowCount()-1: self.show_lines_pos_data(index))
self.tableWidget_lines.setCellWidget(self.tableWidget_lines.rowCount() - 1, 3, show_pos_btn)
self.tableWidget_line_positions.setRowCount(0)
self.selected_line_section = ''
def show_lines_context_menu(self):
menu = QMenu(self)
action_add = menu.addAction("添加投料线")
action_del = menu.addAction("删除投料线")
action = menu.exec(QCursor.pos())
if action == action_add:
self.add_new_line()
elif action == action_del:
self.del_line()
def del_line(self):
if self.tableWidget_lines.rowCount()==0:
return
if self.tableWidget_lines.currentRow()==-1:
return
self.tableWidget_lines.removeRow(self.tableWidget_lines.currentRow())
self.table_line_changed = True
def add_new_line(self):
add_section = f'{Constant.feedLine_set_section}{1}'
for i in range(1,Constant.MAX_Line_num):
if not self.feedLine_dict.get(f"{Constant.feedLine_set_section}{i}"):
add_section = f"{Constant.feedLine_set_section}{i}"
break
self.tableWidget_lines.insertRow(self.tableWidget_lines.rowCount())
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 0, QTableWidgetItem(add_section))
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 1, QTableWidgetItem("线" + str(self.tableWidget_lines.rowCount())))
self.tableWidget_lines.setItem(self.tableWidget_lines.rowCount()-1, 2, QTableWidgetItem(str(i)))
show_pos_btn = QPushButton("显示路径")
show_pos_btn.clicked.connect(lambda _, index=self.tableWidget_lines.rowCount()-1: self.show_lines_pos_data(index))
self.tableWidget_lines.setCellWidget(self.tableWidget_lines.rowCount()-1, 3,show_pos_btn)
self.table_position_changed = True
self.feedLine_dict[add_section] = LineModel(i)
def show_lines_pos_data(self,line_index):
if self.selected_line_section!='' and self.selected_line_section != self.tableWidget_lines.item(line_index,0).text():
if self.table_position_changed or self.table_line_changed:
msgBox = QMessageBox()
msgBox.setText("已修改的数据,是否保存?")
msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
result = msgBox.exec()
if result == QMessageBox.StandardButton.Ok:
self.send_save_lines_data()
else:
# 重新初始化·
self.init_table_lines_data()
line_name = self.tableWidget_lines.item(line_index,0).text()
line_model = self.feedLine_dict.get(line_name)
self.init_table_positions_data(line_model.positions)
self.selected_line_section = line_name
self.label_table_line_position_title.setText(line_model.name)
def init_table_position(self):
#self.tableWidget_line_positions.setRowCount(5)
self.tableWidget_line_positions.setColumnCount(12)
self.tableWidget_line_positions.setHorizontalHeaderLabels(["节段","X","Y","Z","U","V","W","类型","序号","排序","线号","操作2"])
self.tableWidget_line_positions.setSelectionBehavior(QTableWidget.SelectRows)
self.tableWidget_line_positions.setColumnHidden(0, True)
self.tableWidget_line_positions.setColumnHidden(8,True)
self.tableWidget_line_positions.setColumnHidden(9, True)
self.tableWidget_line_positions.setColumnHidden(10, True)
self.tableWidget_line_positions.setAutoScroll(True)
self.tableWidget_line_positions.verticalHeader().hide()
# 自动调整列宽
header = self.tableWidget_line_positions.horizontalHeader()
header.setSectionResizeMode(0, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
self.tableWidget_line_positions.setHorizontalScrollBarPolicy(PySide6.QtCore.Qt.ScrollBarPolicy.ScrollBarAsNeeded)
for i in range(12):
header.setSectionResizeMode(i, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
self.tableWidget_line_positions.setContextMenuPolicy(PySide6.QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
self.tableWidget_line_positions.customContextMenuRequested.connect(self.show_positions_context_menu)
def init_table_positions_data(self,position_list):
for index,position_model in enumerate(position_list):
self.tableWidget_line_positions.insertRow(self.tableWidget_line_positions.rowCount())
self.set_positionModel_to_tabel(index,position_model)
def show_positions_context_menu(self):
menu = QMenu(self)
action_add = menu.addAction("添加位置节点")
action_del = menu.addAction("删除位置节点")
action = menu.exec(QCursor.pos())
if action == action_add:
self.add_new_position()
elif action == action_del:
self.del_position()
def del_position(self):
if self.tableWidget_line_positions.rowCount()==0:
return
if self.tableWidget_line_positions.currentRow()==-1:
return
self.tableWidget_line_positions.removeRow(self.tableWidget_line_positions.currentRow())
self.table_position_changed = True
def add_new_position(self):# 选中添加
config_reader = configparser.ConfigParser()
config_reader.read(Constant.feedLine_set_file, encoding = 'utf-8')
position_model = PositionModel(999)
for i in range(1,Constant.MAX_Position_num):
if not config_reader.has_section(f"{Constant.position_set_section}{i}"):
position_model = PositionModel(i)
break
if self.tableWidget_line_positions.currentRow()==-1:
row_i = self.tableWidget_line_positions.rowCount()
else:
row_i = self.tableWidget_line_positions.currentRow()
self.tableWidget_line_positions.insertRow(row_i)
position_model.order = 0
position_model.status = FeedStatus.FStart
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.table_line_changed = True
def tabel_get_position(self,row_i):
self.set_position_to_tabel(row_i,self.status_address.getRealPosition())
self.table_line_changed = True
def tabel_delete_position(self,row_i):
self.tableWidget_line_positions.removeRow(row_i)
self.table_line_changed = True
def set_positionModel_to_tabel(self,row_i,position_model:PositionModel):
self.tableWidget_line_positions.setItem(row_i,0,QTableWidgetItem(str(position_model.section)))
self.set_position_tabel(row_i,position_model.get_position())
combox = QComboBox()
combox.addItem("初始化点", 1)
combox.addItem("中间点", 3)
combox.addItem("相机/待抓点",4)
combox.addItem("抓取",5)
combox.addItem("破带点1",6)
combox.addItem("破带点2",7)
combox.addItem("震动点",8)
combox.addItem("扔带点",9)
combox.setCurrentIndex(position_model.status)
combox.currentIndexChanged.connect(self.send_table_position_status_changed)
self.tableWidget_line_positions.setCellWidget(row_i, 7, combox)
#self.tableWidget_line_positions.setItem(row_i, 7, QTableWidgetItem(str(position_model.status)))
self.tableWidget_line_positions.setItem(row_i, 8, QTableWidgetItem(str(position_model.id)))
self.tableWidget_line_positions.setItem(row_i, 9, QTableWidgetItem(str(position_model.order)))
self.tableWidget_line_positions.setItem(row_i, 10, QTableWidgetItem(str(position_model.lineId)))
get_pos_btn = QPushButton("获取点位")
get_pos_btn.clicked.connect(
lambda _, index=row_i: self.tabel_get_position(index))
self.tableWidget_line_positions.setCellWidget(row_i, 11, get_pos_btn)
# del_pos_btn = QPushButton("删除点位")
# del_pos_btn.clicked.connect(lambda _, index=row_i: self.tabel_delete_position(index))
# self.tableWidget_line_positions.setCellWidget(row_i, 12, del_pos_btn)
def send_table_position_status_changed(self):
self.table_position_changed = True
def set_position_tabel(self, row_i, position):
self.tableWidget_line_positions.setItem(row_i, 1, QTableWidgetItem(str(position.X)))
self.tableWidget_line_positions.setItem(row_i, 2, QTableWidgetItem(str(position.Y)))
self.tableWidget_line_positions.setItem(row_i, 3, QTableWidgetItem(str(position.Z)))
self.tableWidget_line_positions.setItem(row_i, 4, QTableWidgetItem(str(position.U)))
self.tableWidget_line_positions.setItem(row_i, 5, QTableWidgetItem(str(position.V)))
self.tableWidget_line_positions.setItem(row_i, 6, QTableWidgetItem(str(position.W)))
#endregion
def init_qss(self):
pass
@ -277,13 +509,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def init_Run(self):
self.robotClient = None
self.configReader = configparser.ConfigParser()
self.detection = Detection()
self.detection = None # Detection() #TODO 关闭图像
self.command_position_quene = Queue()
self.status_address = DataAddress()
self.feedLine_dict = {}
self.command_quene = Queue()
self.main_threading = None
self.detection_person = DetectionPerson()
self.detection_person = None #DetectionPerson()
self.configReader.read(Constant.set_ini)
ip = self.configReader.get('Robot_Feed', 'IPAddress')
@ -438,57 +670,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.pushButton_tableFeedSet_save.clicked.connect(self.send_tabelFeedSet_save)
def init_FeedLine(self):
line_count = self.configReader.get('Robot_Feed', 'LineCount', fallback=0)
# line_count = self.configReader.get('Robot_Feed', 'LineCount', fallback=0)
self.configReader.read(Constant.feedLine_set_file, encoding='utf-8')
for i in range(int(line_count)):
line_str = f'FeedLine{i + 1}'
safe_position = Real_Position()
broken_position1 = Real_Position()
broken_position2 = Real_Position()
shake_position = Real_Position()
dropBag_position = Real_Position()
safe_position.X = float(self.configReader.get(line_str, 'SafePosition_x', fallback=0))
safe_position.Y = float(self.configReader.get(line_str, 'SafePosition_y', fallback=0))
safe_position.Z = float(self.configReader.get(line_str, 'SafePosition_z', fallback=0))
safe_position.U = float(self.configReader.get(line_str, 'SafePosition_u', fallback=0))
safe_position.V = float(self.configReader.get(line_str, 'SafePosition_v', fallback=0))
safe_position.W = float(self.configReader.get(line_str, 'SafePosition_w', fallback=0))
broken_position1.X = float(self.configReader.get(line_str, 'BrokenPosition_x', fallback=0))
broken_position1.Y = float(self.configReader.get(line_str, 'BrokenPosition_y', fallback=0))
broken_position1.Z = float(self.configReader.get(line_str, 'BrokenPosition_z', fallback=0))
broken_position1.U = float(self.configReader.get(line_str, 'BrokenPosition_u', fallback=0))
broken_position1.V = float(self.configReader.get(line_str, 'BrokenPosition_v', fallback=0))
broken_position1.W = float(self.configReader.get(line_str, 'BrokenPosition_w', fallback=0))
broken_position2.X = float(self.configReader.get(line_str, 'BrokenPosition2_x', fallback=0))
broken_position2.Y = float(self.configReader.get(line_str, 'BrokenPosition2_y', fallback=0))
broken_position2.Z = float(self.configReader.get(line_str, 'BrokenPosition2_z', fallback=0))
broken_position2.U = float(self.configReader.get(line_str, 'BrokenPosition2_u', fallback=0))
broken_position2.V = float(self.configReader.get(line_str, 'BrokenPosition2_v', fallback=0))
broken_position2.W = float(self.configReader.get(line_str, 'BrokenPosition2_w', fallback=0))
shake_position.X = float(self.configReader.get(line_str, 'ShakePosition_x', fallback=0))
shake_position.Y = float(self.configReader.get(line_str, 'ShakePosition_y', fallback=0))
shake_position.Z = float(self.configReader.get(line_str, 'ShakePosition_z', fallback=0))
shake_position.U = float(self.configReader.get(line_str, 'ShakePosition_u', fallback=0))
shake_position.V = float(self.configReader.get(line_str, 'ShakePosition_v', fallback=0))
shake_position.W = float(self.configReader.get(line_str, 'ShakePosition_w', fallback=0))
dropBag_position.X = float(self.configReader.get(line_str, 'DropBagPosition_x', fallback=0))
dropBag_position.Y = float(self.configReader.get(line_str, 'DropBagPosition_y', fallback=0))
dropBag_position.Z = float(self.configReader.get(line_str, 'DropBagPosition_z', fallback=0))
dropBag_position.U = float(self.configReader.get(line_str, 'DropBagPosition_u', fallback=0))
dropBag_position.V = float(self.configReader.get(line_str, 'DropBagPosition_v', fallback=0))
dropBag_position.W = float(self.configReader.get(line_str, 'DropBagPosition_w', fallback=0))
name = self.configReader.get(line_str, 'Name', fallback='未命名')
self.feedLine_dict[f'{Constant.feedLine_set_section}{i + 1}'] = FeedLine(i+1,name, safe_position,
broken_position1,broken_position2,shake_position ,dropBag_position)
self.init_seting_frame()
for i in range(1,Constant.MAX_Line_num):
line_str = f'{Constant.feedLine_set_section}{i}'
if self.configReader.has_section(line_str):
feed_line = LineModel()
feed_line.read_line_model(config_reader=self.configReader,index=i)
self.feedLine_dict[f'{Constant.feedLine_set_section}{i}'] = feed_line
self.updateUI_Select_Line()
pass

View File

@ -2999,12 +2999,11 @@ class Ui_MainWindow(object):
self.verticalLayout_22.setContentsMargins(0, 0, 0, 0)
self.frame_16 = QFrame(self.page_8)
self.frame_16.setObjectName(u"frame_16")
self.frame_16.setStyleSheet(u"color: rgb(255, 255, 255);")
self.frame_16.setFrameShape(QFrame.Shape.StyledPanel)
self.frame_16.setFrameShadow(QFrame.Shadow.Raised)
self.verticalLayout_23 = QVBoxLayout(self.frame_16)
self.verticalLayout_23.setSpacing(0)
self.verticalLayout_23.setObjectName(u"verticalLayout_23")
self.verticalLayout_23.setContentsMargins(0, 0, 0, 0)
self.pushButton_savePosition = QPushButton(self.frame_16)
self.pushButton_savePosition.setObjectName(u"pushButton_savePosition")
self.pushButton_savePosition.setStyleSheet(u"color: rgb(255, 255, 255);\n"
@ -3012,10 +3011,43 @@ class Ui_MainWindow(object):
self.verticalLayout_23.addWidget(self.pushButton_savePosition)
self.tableWidget_positions = QTableWidget(self.frame_16)
self.tableWidget_positions.setObjectName(u"tableWidget_positions")
self.label_table_line_title = QLabel(self.frame_16)
self.label_table_line_title.setObjectName(u"label_table_line_title")
self.label_table_line_title.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.verticalLayout_23.addWidget(self.tableWidget_positions)
self.verticalLayout_23.addWidget(self.label_table_line_title)
self.tableWidget_lines = QTableWidget(self.frame_16)
self.tableWidget_lines.setObjectName(u"tableWidget_lines")
self.tableWidget_lines.setStyleSheet(u" QHeaderView::section {\n"
" background-color: #2C2C2C; /* \u8868\u5934\u80cc\u666f\u8272 */\n"
" color: white; /* \u8868\u5934\u5b57\u4f53\u989c\u8272 */\n"
" font-size: 14px; /* \u5b57\u4f53\u5927\u5c0f */\n"
" font-weight: bold; /* \u5b57\u4f53\u52a0\u7c97 */\n"
" border: 1px solid black; /* \u8fb9\u6846\u989c\u8272 */\n"
" padding: 4px; /* \u5185\u8fb9\u8ddd */\n"
" }")
self.verticalLayout_23.addWidget(self.tableWidget_lines)
self.label_table_line_position_title = QLabel(self.frame_16)
self.label_table_line_position_title.setObjectName(u"label_table_line_position_title")
self.label_table_line_position_title.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.verticalLayout_23.addWidget(self.label_table_line_position_title)
self.tableWidget_line_positions = QTableWidget(self.frame_16)
self.tableWidget_line_positions.setObjectName(u"tableWidget_line_positions")
self.tableWidget_line_positions.setStyleSheet(u" QHeaderView::section {\n"
" background-color: #2C2C2C; /* \u8868\u5934\u80cc\u666f\u8272 */\n"
" color: white; /* \u8868\u5934\u5b57\u4f53\u989c\u8272 */\n"
" font-size: 14px; /* \u5b57\u4f53\u5927\u5c0f */\n"
" font-weight: bold; /* \u5b57\u4f53\u52a0\u7c97 */\n"
" border: 1px solid black; /* \u8fb9\u6846\u989c\u8272 */\n"
" padding: 4px; /* \u5185\u8fb9\u8ddd */\n"
" }")
self.verticalLayout_23.addWidget(self.tableWidget_line_positions)
self.verticalLayout_22.addWidget(self.frame_16)
@ -3806,6 +3838,8 @@ class Ui_MainWindow(object):
self.lineEdit_manual_adjust_accuracy.setText(QCoreApplication.translate("MainWindow", u"1", None))
self.lineEdit_manual_adjust_accuracy.setPlaceholderText(QCoreApplication.translate("MainWindow", u"0.001-20", None))
self.pushButton_savePosition.setText(QCoreApplication.translate("MainWindow", u"\u4fdd\u5b58", None))
self.label_table_line_title.setText(QCoreApplication.translate("MainWindow", u"\u751f\u4ea7\u7ebf", None))
self.label_table_line_position_title.setText(QCoreApplication.translate("MainWindow", u"TextLabel", None))
self.label_3.setText("")
self.label_date.setText(QCoreApplication.translate("MainWindow", u"2024-08-01", None))
self.label_time.setText(QCoreApplication.translate("MainWindow", u"08:00:00", None))