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

Properly set title in FitsOpener #256

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion stellarphot/gui_tools/fits_opener.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ class FitsOpener:
"""

def __init__(self, title="Choose an image", filter_pattern=None, **kwargs):
self._fc = FileChooser(title=title, **kwargs)
# ipyautoui.FileChooser doesn't have a title attribute, so we have to
# add it after creating the widget
self._fc = FileChooser(**kwargs)
self._fc.title = title
if not filter_pattern:
self._fc.filter_pattern = ["*.fit*", "*.fit*.[bg]z"]
else:
Expand Down
6 changes: 6 additions & 0 deletions stellarphot/gui_tools/tests/test_fits_opener.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from stellarphot.gui_tools import FitsOpener


def test_fits_opener_title():
opener = FitsOpener(title="Choose an image")
assert opener.file_chooser.title == "Choose an image"
Loading