-
Notifications
You must be signed in to change notification settings - Fork 121
Save view settings on exit to view_settings.json #2831
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
Save view settings on exit to view_settings.json #2831
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
after stable to develop is merged the github version test is fixed. the test with the timeout is a common problem on testing we not have figured.
the linters shows some changes needed too
|
@annapurna-gupta This adds support for the restore_view config option. We should probably change the PR title before merging – it currently sounds like something happens when the app closes. |
Yeah, I just changed the title — is it okay now? |
|
do you plan the "storage part" of SideView etc. to become added in this PR too? |
I thought it should only store and restore the top view settings — should it also include side, table, or linear views? |
Yes, we need this for all views. |
|
Here’s another idea: Comparing this to the tutorial mode , where I use the objectName to generate images that I can then uniquely associate with data, could we perhaps store the names? Later those can then re-associate data with them. |
|
please update your develop branch on github and then rebase to develop. or rebase to develop on your remote, see https://mss.readthedocs.io/en/stable/development.html#setting-up-a-git-remote |
cdb03bb to
c98eca3
Compare
ReimarBauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
| ) | ||
|
|
||
| # create 2nd flighttrack | ||
| window.create_new_flight_track() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe It would be better to use a filename parameter and use a name.
you maybe need an information in the view_settings.json to compare with the data of the waypoint table. e.g. path, url, ..
| window = msui_mw.MSUIMainWindow() | ||
| window.show() | ||
|
|
||
| # create 1st flighttrack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is maybe better to save to a filename so that flightpath file exists and to avoid storing anything for the current default "new flight track (...)"
Because when you do use it for temporary data at the moment someone hitting the create new button and having something in the json file like,
{
"new flight track (2)": {
"global": {
"mss_version": "10.1.0",
"flight_track_name": "new flight track (2)"
},
"views": [
{
"view_type": "topview",
"view_id": "view_topview_0"
},
{
windows gets pushed on him
Changes on the behaviour should be done in the next PR
| if function is None: | ||
| try: | ||
| waypoints_model = ft.WaypointsTableModel(filename=str(filename)) | ||
| waypoints_model = ft.WaypointsTableModel(filename=filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, this makes an os.path string from the Path, was there a problem solved by the change, which one?
|
on the terminal I see sometimes ERROR: Failed to get settings for topview (id: unknown): 'url' |
looking on it |
tests/_test_msui/test_msui.py
Outdated
| parsed_url = urllib.parse.urlparse(mswms_server) | ||
| scheme, host, port = parsed_url.scheme, parsed_url.hostname, parsed_url.port | ||
| server_url = f"{scheme}://{host}:{port}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is effectively a no-op, mswms_server == server_url. You don't have to parse the URL if you don't need its parts. xref: #2831 (comment)
ReimarBauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
further work will be done in a new PR
ReimarBauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send it to your branch please
ReimarBauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base branch changed
5443beb
into
Open-MSS:GSOC2025-AnnapurnaGupta
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save view settings on application close for top, side, linear, and table for flight tracks Implemented restoring of views logic and added a test to cover the functionality.
Save and Restore View Configurations
Details
Store and Restore View Configuration Locally and on Server
The
msui_mainwindowcurrently manages all open views but does not retain their states when the application is closed. This proposal introduces a way to capture and restore view settings upon exit and re-login, enhancing user experience by preserving configurations across sessions and devices.1.1 Proposed Changes for Local Flight Tracks
Create a New File:
mslib/utils/view_restoration.pyThis file will handle the core logic for saving, loading, and validating view configuration settings using a local JSON file (
view_setting.json).The key changes proposed include:
■ A way to capture view states on exit:
closeEvent()inmsui_mainwindow.view_restoration.pyto be saved inview_setting.json.■ A way to save settings in
view_setting.jsonfile:view_restoration.pywill write the captured view configuration into the JSON file.■ A way to load settings for user:
restore_viewsoption:view_setting.jsonexists.■ A way to validate the settings before saving to JSON file:
view_restoration.pywill validate the structure and completeness of the data.Adding Option
restore_viewsA new configuration option,
restore_views, will be introduced to allow users to control whether the application should restore the previously saved view configuration on startup.If
restore_viewsis enabled:view_setting.jsonfile in the user's configuration directory.If
restore_viewsis disabled:view_setting.jsonfile (even if it exists).Proposed
restore_viewOptionThis button allows users to quickly restore their previous session’s layout using saved settings from
view_setting.json.1.2 Proposed Changes for Operation (Server)
Extend Database (
mslib/mscolab/models.py)mslib/mscolab/models.py) to include a newViewSettingstable for persistent storage of view configurations.Implement Server API Endpoints
The API will act as a bridge between the client and the database to enable saving and restoring view configurations.
The key changes proposed include:
■ A way to save view configuration:
viewSettingtable in the database.■ A way to restore configurations:
ViewSettingsand returns them to the client.