Bug 1183 - When saving a file, make the session refer to it
Summary: When saving a file, make the session refer to it
Status: RESOLVED FIXED
Alias: None
Product: PulseView
Classification: Unclassified
Component: UI (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: PulseView 0.6.0
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-27 23:52 CEST by Soeren Apel
Modified: 2020-06-26 00:22 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Soeren Apel 2018-04-27 23:52:32 CEST
Example:

1) Open PV
2) Import a file
3) Save data as .sr
4) Close PV

Expected result:
PV restores the session, using the data from the saved .sr

Actual result:
The session is restored but empty since it attempts to restore from the imported file (which PV currently can't do)
Comment 1 Uwe Hermann 2018-04-28 17:27:22 CEST
Hm, not sure about the expected behaviour. I'd expect the latter, it should restore from the original input file (not from any saved .sr or other files).

This is further complicated anyway, since you can save multiple times to different .sr filenames, you can save different chunks of the data to different .sr files, you can (later) export different chunks or the full data to other formats like CSV etc. etc.

I'd only restore one of those if the user actually intentionally loaded one of the saved files into a session window.
Comment 2 Soeren Apel 2018-04-28 18:18:28 CEST
Well, think of it this way:

If you open a file, use "save as" and then save again - which file do you expect to be written to? The file you opened or the file you created using "save as"?

I'm used to software using the last-saved file, meaning the newly created file in this case. To prevent that, several software packages offer a "save copy as" option (e.g. gimp).

The mechanism described in this bug report would only apply to a complete save, not a partial one.
Comment 3 Soeren Apel 2020-06-25 21:39:40 CEST
Currently, Session::save_settings() sets the session's file name to the one associated with the currently loaded device. This means that if an InputFile device is loaded, we can't easily switch that to a SessionFile device without triggering a complete reset and reload of the data.
Comment 4 Soeren Apel 2020-06-26 00:22:22 CEST
Workaround added in 73d5a9bbc2f32ed84077ca4e75a125a6b0fc1921, will do for now.