Refactor registering interaction handlers for editable textboxes#1190
Conversation
|
Ooooo that's interesting, this error is only seen on Windows: Looks orthogonal. I will open a separate issue and revert the change to the test for now. |
That's misleading: It is not seen on OSX but I don't know if the error should occur on Linux because our Linux+wx CI job has not been running. |
It is because on Windows + wx, the first input is always being activated and in the case of textbox, the entire text is selected. This makes the test setup different from Mac OS or with Qt. Therefore this is orthogonal to the refactoring. |
aaronayres35
left a comment
There was a problem hiding this comment.
Changes LGTM! Just one question about where to place the new function
| ) | ||
|
|
||
|
|
||
| def register_editable_textbox_handlers(registry, target_class, widget_getter): |
There was a problem hiding this comment.
I very much like this refactor, pulling this logic into its own function is much cleaner. However, do you think we should move this into the helpers module, or somewhere else? It seems a little out of place in common_ui_targets IMO, what do you think?
There was a problem hiding this comment.
I agree this function does not sit well with this module.
But I am a bit hesitant about moving it to helpers. The only UITester/UIWrapper piece of knowledge in that module is the use of interaction object, and in the places where interaction is referred to, they could be replaced with more primitive data such as a string. Perhaps helpers should be renamed to something more meaningful to prevent it from becoming a catch-all-I-don't-know-where-this-goes kind of place.
What about... we move this register_editable_textbox_handlers to a new module called registry_helper? This will mirror the one on tester package and is responsible for holding functions that does some common handler registration.
There was a problem hiding this comment.
That sounds good to me!
There was a problem hiding this comment.
Also, I agree that helpers might be a bit too generic (all code we write should be helping with something!). Currently all the code in helpers is specific to some form of interaction (keyclicks, mouse clicks, key sequences, and DisplayedText queries) so maybe just something like interaction_helpers or something would be sufficient. We can leave that for another PR
There was a problem hiding this comment.
Cool. I will move this function to a new module.
Agreed the renaming of helpers can be a separate PR.
aaronayres35
left a comment
There was a problem hiding this comment.
Changes still LGTM!
This PR refactors how we add interaction handlers for editable textboxes.
There are small changes to the tests to exercise more interactions in order to ensure the refactoring has not broken things.
With this refactoring, I can add interactions for things like the text-style FontEditor relatively easily (see #1161).