Bug 394448 - Not able to change data file (ASCII), message: "The file could not be loaded or contains no data."
Summary: Not able to change data file (ASCII), message: "The file could not be loaded ...
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: datasources (show other bugs)
Version: 2.0.8
Platform: Compiled Sources Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2018-05-19 16:10 UTC by manumail
Modified: 2018-11-23 13:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description manumail 2018-05-19 16:10:13 UTC
What I did:
1. Load a small ASCII data file with the data wizard, and create a plot
2. Save to new .kst file and close kst
3. Start kst and open this .kst file again
4. Go to change data file dialog and select a different ASCII file, click ok
5. Go to change data file dialog again, select the ASCII file from step 1.

What I expected: The data file from step 1 should be accepted and plotted, because the file is ok and still in its location.

What happened: The file is not accepted, the program returns: "The file could not be loaded or contains no data."

I downloaded the latest source code and traced the message back to method ChangeFileDialog::apply(), where the message box is created upon !_dataSource->isValid().

The _isValid attribute is false, because it is set to false by call to method reset() in AsciiSource::parseProperties. This method is called when the .kst file is loaded, after creation of the AsciiSource.

I removed the call to reset() and the problem dissapeared. I did not create a patch because I'm not sure about side effects.
Comment 1 Netterfield 2018-11-23 13:24:28 UTC
Git commit 6435d09b739f81524f280e08f2e17634799db4ae by Barth Netterfield.
Committed on 16/11/2018 at 21:56.
Pushed by netterfield into branch 'master'.

Don't invalidate ascii files when you reset them.
Apply fix suggested by reporter.  Ascii files don't actually ever
check to see if an ascii file is valid so there is no point
in invalidating it.

M  +1    -1    src/datasources/ascii/asciisource.cpp

https://commits.kde.org/kst-plot/6435d09b739f81524f280e08f2e17634799db4ae