-
Notifications
You must be signed in to change notification settings - Fork 119
Add config & CLI support for .ftml path in mssautoplot #2814
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
base: develop
Are you sure you want to change the base?
Add config & CLI support for .ftml path in mssautoplot #2814
Conversation
mslib/msui/constants.py
Outdated
|
|
||
| # ToDo refactor to a function | ||
| MSS_AUTOPLOT = os.getenv('MSS_AUTOPLOT', os.path.join(MSUI_CONFIG_PATH, "mssautoplot.json")) | ||
| DEFAULT_FTML_PATH = os.getenv('MSS_FTML_PATH', os.path.join(MSUI_CONFIG_PATH, "example_flight.ftml")) |
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.
please use the users config var mss_dir, and don't create a new constant
or investigate how it stores the first used dir.
e.g. when you store in a ftml dir, it uses that dir for e.g. an import
it should not behave different to the common user interface.
look for self.last_save_directory
mslib/utils/mssautoplot.py
Outdated
| # Todo add the dir to the file in the mssautoplot.json | ||
| dirpath = "./" | ||
| file_path = os.path.join(dirpath, filename) | ||
| file_path = DEFAULT_FTML_PATH |
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.
use the users config of mss_dir
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 comment
|
Let’s also make sure we save the file path in mssautoplot.json. We can just use self.last_save_directory for this; no need to create a new default. |
|
the autoplot dockingwidget still does not save a path into the json configuration for the filenames, see |
I'm currently working on the CLI version of autoplot (not the GUI-based autoplot_dockwidget). My changes are focused on command-line behavior, so they won't affect or fix the GUI behavior related to JSON path saving? or am i missing something? |
|
Hii @ReimarBauer
But I think it’s not working as expected — the file still isn’t being found. Could you please help me check if I’m missing something? |
When configuring the new mssautoplot.json, we should mirror the behavior of existing configurations regarding file paths. Specifically, the path used to store an FTML file should be relative to the user's designated storage location. For example, if a user saves an FTML file as /Users/reimarbauer/FTML/example.ftml, the new configuration should reflect this same path. This consistency is important because sharing my mssautoplot.json necessitates also sharing the corresponding FTML file – and knowing the storage location ensures I can easily identify the correct one among potentially many examples. Please implement the functionality for the autoplot docking widget https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/autoplot_dockwidget.py to save the FTML path/file before proceeding with CLI improvements. |
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 comment
mslib/msui/autoplot_dockwidget.py
Outdated
| else: | ||
| if filename != parent2.mscolab.active_operation_name: | ||
| filename += ".ftml" | ||
| filename = os.path.join(const.MSUI_CONFIG_PATH, filename + ".ftml") |
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.
when you do "save as" the used directory is stored at
https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/msui_mainwindow.py#L946
self.last_save_directory
You need to enable access to the var and use it then. We need the dir where the file is stored by File - Save_As
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.
you can pass it into the topview and from there to the dockingwidget, see https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/msui_mainwindow.py#L1029
|
Hii @ReimarBauer |
Please share the section of your mssautoplot.json for |
Fixes #2714