Skip to content
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

Add LoaderConfig plugin to the Reference Viewer #1076

Merged
merged 3 commits into from
Jan 4, 2024

Conversation

ejeschke
Copy link
Owner

The LoaderConfig plugin allows you to configure the file openers that can be used to load various content into Ginga.

Registered file openers are associated with file MIME types, and there can be several openers for a single MIME type. A priority associated with a MIME type/opener pairing determines which opener will be used for each type--the lowest priority value will determine which opener will be used. If there are more than one opener with the same low priority then the user will be prompted for which opener to use, when opening a file in Ginga. This plugin can be used to set the opener preferences and save it to the user's $HOME/.ginga configuration area.

Documentation added and change log updated.

@ejeschke
Copy link
Owner Author

If/when you have time, @pllim.

@ejeschke
Copy link
Owner Author

Previously, the loader preference could only be set by using the --fitspkg command line option or the FITSpkg setting in general.cfg. These methods still work, and use the loader priority apparatus, as before.

@pllim
Copy link
Collaborator

pllim commented Nov 30, 2023

@ejeschke , I probably won't have time till next week at the earliest. I also have not been using this feature much, so not sure how best to contribute here.

@ejeschke
Copy link
Owner Author

No problem. Most users will not notice or need unless they have both astropy and fitsio installed.

@ejeschke ejeschke force-pushed the loaderconfig-plugin branch from 1878a83 to 1d9c0d1 Compare December 1, 2023 03:24
@pllim
Copy link
Collaborator

pllim commented Dec 4, 2023

Hmm where did the ReadTheDocs check go?

@pllim
Copy link
Collaborator

pllim commented Dec 4, 2023

I think RTD isn't pick up the YAML file because now the default pattern they look for is .yaml and not .yml. I think I fixed it on the admin panel but closing/reopening here to be sure.

@pllim pllim closed this Dec 4, 2023
@pllim pllim reopened this Dec 4, 2023
@pllim
Copy link
Collaborator

pllim commented Dec 4, 2023

Oh, I misunderstood the instruction. I think we actually have to rename the YAML file. (#1078)

Copy link
Collaborator

@pllim pllim left a comment

Choose a reason for hiding this comment

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

What is the behavior for files not recognized by MIME, like ASDF?

Registered file openers are associated with file MIME types, and there can
be several openers for a single MIME type. A priority associated
with a MIME type/opener pairing determines which opener will be used
for each type--the lowest priority value will determine which opener will
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems counter-intuitive to me. Generally speaking, I thought highest priority means it would come first?

It sounds like you are using ascending order number, which is kind of like reverse of the priority?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Well, it depends on how you interpret a priority number. There are systems for where a lower number has higher priority (e.g. Unix process priorities). And it does match the typical English usage, to wit: "my first priority is ...; my second priority is ...".

I think as long as the documentation is clear on this (see conspicuous note in plugin docstring) there should be no misunderstanding.

Comment on lines +13 to +14
file in Ginga. This plugin can be used to set the opener preferences
and save it to the user's $HOME/.ginga configuration area.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would be nice to give an example exactly what the filename should be in $HOME/.ginga and some example content of that file.

@ejeschke ejeschke force-pushed the loaderconfig-plugin branch from 1d9c0d1 to 695f159 Compare December 4, 2023 23:00
@ejeschke ejeschke mentioned this pull request Dec 4, 2023
@ejeschke ejeschke force-pushed the loaderconfig-plugin branch from 695f159 to 4458491 Compare January 3, 2024 03:13
@ejeschke
Copy link
Owner Author

ejeschke commented Jan 3, 2024

What is the behavior for files not recognized by MIME, like ASDF?

There is a set of known types that will be recognized if they are failed to be identified by ASDF. The file extension ".asdf" is one of them. But we also have a special check for ASDF embedded in FITS (especially for STScI)

Copy link
Collaborator

@pllim pllim left a comment

Choose a reason for hiding this comment

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

LGTM in principle. FFTM. Thanks!

@ejeschke ejeschke force-pushed the loaderconfig-plugin branch from efb798e to 64a9266 Compare January 4, 2024 01:48
@ejeschke ejeschke merged commit 5868816 into ejeschke:main Jan 4, 2024
10 checks passed
@ejeschke ejeschke deleted the loaderconfig-plugin branch January 4, 2024 02:57
@ejeschke
Copy link
Owner Author

ejeschke commented Jan 4, 2024

Thanks, @pllim!

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

Successfully merging this pull request may close these issues.

2 participants