0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix: motor_example.py export .csv logic fixed

This commit is contained in:
wyzula-jan
2023-09-22 14:17:22 +02:00
parent ed3f656d5e
commit 85841cdf1f

View File

@ -905,9 +905,11 @@ class MotorApp(QWidget):
with open(filePath, mode="w", newline="") as file:
writer = csv.writer(file)
col_offset = 2 if self.comboBox_mode.currentIndex() == 0 else 3
# Write the header
header = []
for col in range(2, table.columnCount()):
for col in range(col_offset, table.columnCount()):
header_item = table.horizontalHeaderItem(col)
header.append(header_item.text() if header_item else "")
writer.writerow(header)
@ -915,7 +917,7 @@ class MotorApp(QWidget):
# Write the content
for row in range(table.rowCount()):
row_data = []
for col in range(2, table.columnCount()):
for col in range(col_offset, table.columnCount()):
item = table.item(row, col)
row_data.append(item.text() if item else "")
writer.writerow(row_data)