8000 More reasonable signal emission of `ListEdit` and `TupleEdit` by hanjinliu · Pull Request #499 · pyapp-kit/magicgui · GitHub
[go: up one dir, main page]

Skip to content

More reasonable signal emission of ListEdit and TupleEdit#499

Merged
tlambert03 merged 6 commits intopyapp-kit:mainfrom
hanjinliu:main
Nov 13, 2022
Merged

More reasonable signal emission of ListEdit and TupleEdit#499
tlambert03 merged 6 commits intopyapp-kit:mainfrom
hanjinliu:main

Conversation

@hanjinliu
Copy link
Collaborator

I found that ListEdit and TupleEdit are emitting self now, and probably in wrong number of times (which may cause excessive number of function calls). This PR fixes these problems.

This change might break backward compatibility if one uses list_widget.changed.connect. Since they are supposed to be used as value-like widgets, they should emit their values just like FileEdit, so this change should be applied eventually.

@codecov
Copy link
codecov bot commented Nov 13, 2022

Codecov Report

Base: 89.98% // Head: 90.17% // Increases project coverage by +0.18% 🎉

Coverage data is based on head (47bc8c0) compared to base (811efce).
Patch coverage: 92.50% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #499      +/-   ##
==========================================
+ Coverage   89.98%   90.17%   +0.18%     
==========================================
  Files          32       32              
  Lines        4214     4232      +18     
==========================================
+ Hits         3792     3816      +24     
+ Misses        422      416       -6     
Impacted Files Coverage Δ
magicgui/widgets/_concrete.py 89.16% <92.50%> (+1.56%) ⬆️

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member
@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

thanks @hanjinliu! Merging and will follow up on minor typing suggestions in another PR

self._annotation = value
self._args_type = arg

def __iter__(self) -> Iterator[ValueWidget]:
Copy link
Member

Choose a reason for hiding this comment

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

Container is now Generic as of #475 ... so these aren't necessary anymore if we declare class ListEdit(Container[ValueWidget]) ... but I'll do that in a followup PR

assert list_edit.value == [1, 2, 3, 3]
assert list_edit.data == [1, 2, 3, 3]
assert mock.call_count == 1
mock.assert_called_with([1, 2, 3, 3])
Copy link
Member

Choose a reason for hiding this comment

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

👍

@tlambert03 tlambert03 merged commit 964e697 into pyapp-kit:main Nov 13, 2022
@tlambert03 tlambert03 added the bug Something isn't working label Nov 13, 2022
@hanjinliu
Copy link
Collaborator Author

Thank you!

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0