Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to skip malformed lines in CSV #1024

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions plotjuggler_plugins/DataLoadCSV/dataload_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ bool DataLoadCSV::readDataFromFile(FileLoadInfo* info, PlotDataMapRef& plot_data
msgBox.setWindowTitle(tr("Error reading file"));
msgBox.setText(tr("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 + 2)
.arg(string_items.size())
.arg(column_names.size()));
Expand All @@ -648,13 +648,21 @@ bool DataLoadCSV::readDataFromFile(FileLoadInfo* info, PlotDataMapRef& plot_data
.arg(column_names.size())
.arg(string_items.size()));

QPushButton* abortButton = msgBox.addButton(QMessageBox::Ok);
QPushButton* abortButton = msgBox.addButton(QMessageBox::Abort);
QPushButton* ignoreButton = msgBox.addButton(QMessageBox::Ignore);

msgBox.setIcon(QMessageBox::Warning);

msgBox.exec();

return false;
if (msgBox.clickedButton() == ignoreButton)
{
continue;
}
else
{
return false;
}
}

double timestamp = linecount;
Expand Down