1
0
forked from IPKM/nmreval

asciireader.py avoid IndexError if file has no header

This commit is contained in:
Dominik Demuth 2023-02-25 19:16:14 +01:00
parent 5577adabec
commit b73d6f08b8

View File

@ -113,7 +113,7 @@ class QAsciiReader(QtWidgets.QDialog, Ui_ascii_reader):
@QtCore.pyqtSlot(int, name='on_line_spinBox_valueChanged') @QtCore.pyqtSlot(int, name='on_line_spinBox_valueChanged')
def set_column_names(self, _): def set_column_names(self, _):
self.ascii_table.setHorizontalHeaderLabels(map(str, range(1, self.ascii_table.columnCount() + 1))) self.ascii_table.setHorizontalHeaderLabels(map(str, range(1, self.ascii_table.columnCount() + 1)))
if self.column_checkBox.isChecked(): if self.column_checkBox.isChecked() and self.line_spinBox.isEnabled():
header_line = self.reader.header[self.line_spinBox.value()-1] header_line = self.reader.header[self.line_spinBox.value()-1]
self.ascii_table.setHorizontalHeaderLabels(header_line.split()) self.ascii_table.setHorizontalHeaderLabels(header_line.split())