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

Message posting clean-up #4256

Merged
merged 30 commits into from
Mar 7, 2024
Merged

Message posting clean-up #4256

merged 30 commits into from
Mar 7, 2024

Conversation

davep
Copy link
Contributor

@davep davep commented Mar 5, 2024

Assorted tweaks and fixes as fallout from the work done in #3869. Where possible/sensible extra tests have been added too.

The most significant change here, I think, is to SelectionList, which needed a little bit of extra work because it became necessary to find back the index of a value. (while this is in review I'm going to give that part one last run over as I want to be double sure it's a good approach -- I think this also possibly either provides a "good" reason for #3908 or might actually make it less good)

davep added 27 commits March 4, 2024 09:24
This is currently a failing test; work relating to Textualize#3869 should make this
pass.
This is currently a failing test; work relating to Textualize#3869 should make this
pass.
Until now it was possible, depending on the DOM, for this message to not
bubble. This ensures that this won't be an issue.

In support of work on Textualize#3869.
This will fail right at the moment; the fix follows.

In support of work on Textualize#3869.
In aid of Textualize#3869. This will fail right now, this is a thing that needs to be
fixed.
In aid of Textualize#3869. This ensures that when the dev makes a call on
SelectionList.toggle, that SelectionList.SelectionToggled gets posted.
The call to load_text needed fixing for messages too; and actually setting
TextArea.text calls this anyway.

In support of Textualize#3869.
@davep davep added bug Something isn't working enhancement New feature or request Task labels Mar 5, 2024
@davep davep self-assigned this Mar 5, 2024
@davep davep marked this pull request as ready for review March 5, 2024 14:03
@davep davep changed the title WiP: Message posting clean-up Message posting clean-up Mar 5, 2024
Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I'm not going to pretend I went through all the code of all widgets to make sure you didn't miss anything, but the changes you did make look good.

Comment on lines 704 to 710
self._values = {
**self._values,
**{
option.value: index
for index, option in enumerate(cleaned_options, start=self.option_count)
},
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't .update better in terms of speed while being the same in terms of readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Off the top of my head I don't know the speed difference; it feels like you are right, do you have a reference?

Copy link
Contributor

@rodrigogiraoserrao rodrigogiraoserrao Mar 6, 2024

Choose a reason for hiding this comment

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

I don't have a reference, no, it's just an educated guess.
I was just surprised you spelled this out 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably go with update. It would be faster, but doubt the difference would be measurable. It's more that update expresses intent better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool. Will tweak it.

Mention them as breaking changes too; while this is an improvement that
shouldn't have a negative impact on applications, it's still something
developers should be aware of.
@davep davep merged commit f55610e into Textualize:main Mar 7, 2024
20 checks passed
@davep davep deleted the message-tidy branch March 7, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request Task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure all widget messages are posted even when triggered by the developer
3 participants