Skip to content

Conversation

@annapurna-gupta
Copy link
Collaborator

Fixes #2714


# 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"))
Copy link
Member

@ReimarBauer ReimarBauer May 6, 2025

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

# Todo add the dir to the file in the mssautoplot.json
dirpath = "./"
file_path = os.path.join(dirpath, filename)
file_path = DEFAULT_FTML_PATH
Copy link
Member

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

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

@ReimarBauer
Copy link
Member

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.

@ReimarBauer
Copy link
Member

ReimarBauer commented May 23, 2025

the autoplot dockingwidget still does not save a path into the json configuration for the filenames, see
https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/autoplot_dockwidget.py#L318
The filenames can be stored on different directories. In the json file we need the file location, not only the names.

@annapurna-gupta
Copy link
Collaborator Author

the autoplot dockingwidget still does not save a path into the json configuration for the filenames, see
https://github.com/Open-MSS/MSS/blob/develop/mslib/msui/autoplot_dockwidget.py#L318
The filenames can be stored on different directories. In the json file we need the file location, not only the names.

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?

@annapurna-gupta
Copy link
Collaborator Author

Hii @ReimarBauer
I’ve added the path for the .ftml file like this:

if filename and not os.path.isabs(filename): default_dir = os.path.join(os.path.expanduser("~"), ".config", "msui") filename = os.path.join(default_dir, filename)

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?

@ReimarBauer
Copy link
Member

ReimarBauer commented May 26, 2025

Hii @ReimarBauer I’ve added the path for the .ftml file like this:

if filename and not os.path.isabs(filename): default_dir = os.path.join(os.path.expanduser("~"), ".config", "msui") filename = os.path.join(default_dir, filename)

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.

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment

else:
if filename != parent2.mscolab.active_operation_name:
filename += ".ftml"
filename = os.path.join(const.MSUI_CONFIG_PATH, filename + ".ftml")
Copy link
Member

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

Copy link
Member

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

@annapurna-gupta
Copy link
Collaborator Author

Hii @ReimarBauer
I noticed that running:
mssautoplot --cpath ~/.config/msui/mssautoplot.json
gives resource 'example_flight.ftml' not found
but this works:
mssautoplot --cpath ~/.config/msui/mssautoplot.json --ftml-path /home/anuu/.config/msui/example_flight.ftml

@ReimarBauer
Copy link
Member

Hii @ReimarBauer I noticed that running: mssautoplot --cpath ~/.config/msui/mssautoplot.json gives resource 'example_flight.ftml' not found but this works: mssautoplot --cpath ~/.config/msui/mssautoplot.json --ftml-path /home/anuu/.config/msui/example_flight.ftml

Please share the section of your mssautoplot.json for

"automated_plotting_flights": [],
"automated_plotting_hsecs": [],
"automated_plotting_vsecs": [],
"automated_plotting_lsecs": []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autoplot ftml files need the path and file stored

2 participants