Skip to content

Commit

Permalink
Allow user to skip malformed lines in CSV
Browse files Browse the repository at this point in the history
Replace error message and abort action in csv import plugin with a question for the user how to proceed
  • Loading branch information
pkess authored Nov 18, 2024
1 parent d43a46d commit d21e8eb
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions plotjuggler_plugins/DataLoadCSV/dataload_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,24 @@ bool DataLoadCSV::readDataFromFile(FileLoadInfo* info, PlotDataMapRef& plot_data
{
auto err_msg = QString("The number of values at line %1 is %2,\n"
"but the expected number of columns is %3.\n"
"Aborting...")
"Ignore line and proceed or abort?")
.arg(linecount + 1)
.arg(string_items.size())
.arg(column_names.size());

QMessageBox::warning(nullptr, "Error reading file", err_msg);
return false;
QMessageBox::StandardButton reply;
reply = QMessageBox::question(
this, tr("Warning"), err_msg,
QMessageBox::Ignore | QMessageBox::Abort, QMessageBox::NoButton);

if (reply == QMessageBox::Ignore)
{
continue;
}
else
{
return false;
}
}

double t = linecount;
Expand Down

0 comments on commit d21e8eb

Please sign in to comment.