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

feat: add context manager for register_type #470

Merged
merged 3 commits into from
Oct 22, 2022

Conversation

tlambert03
Copy link
Member

closes #466

@Czaki ... if you have a moment to review, it would be appreciated!

@codecov
Copy link

codecov bot commented Oct 22, 2022

Codecov Report

Merging #470 (2482915) into main (88e598b) will increase coverage by 0.03%.
The diff coverage is 95.00%.

@@            Coverage Diff             @@
##             main     #470      +/-   ##
==========================================
+ Coverage   88.05%   88.08%   +0.03%     
==========================================
  Files          31       31              
  Lines        4170     4189      +19     
==========================================
+ Hits         3672     3690      +18     
- Misses        498      499       +1     
Impacted Files Coverage Δ
magicgui/type_map.py 95.67% <95.00%> (-0.11%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

magicgui/type_map.py Show resolved Hide resolved
magicgui/type_map.py Outdated Show resolved Hide resolved
Comment on lines 428 to 432
_RETURN_CALLBACKS[_type_] = prev_return_callback # type: ignore
if prev_type_def is null:
_TYPE_DEFS.pop(_type_, None)
else:
_TYPE_DEFS[_type_] = prev_type_def # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

looking at test and coverage messages, it looks like something is wrong. Or are default widgets stored outside _TYPE_DEFS dict?

Copy link
Member Author

Choose a reason for hiding this comment

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

default widgets are stored outside of _TYPE_DEFS (for better or worse)

@tlambert03
Copy link
Member Author

tlambert03 commented Oct 22, 2022

many thanks for the review @Czaki . updated

@tlambert03 tlambert03 merged commit f0aabb8 into pyapp-kit:main Oct 22, 2022
@tlambert03 tlambert03 deleted the context-manager branch October 22, 2022 19:54
@tlambert03 tlambert03 added the enhancement New feature or request label Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: add context manager to temporarily change the widget associated with a type
2 participants