-
Notifications
You must be signed in to change notification settings - Fork 705
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
kvui: add autocompleting new hint text input #3535
base: main
Are you sure you want to change the base?
Conversation
could the items get color depending on type (progression/useful/filler/trap)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Doubtful, since a single item name/id can have different flags in different locations, so that info isn't known without scouting it |
If you click off the hint textbox Edit: also, the dropdown registers a selection with all mouse buttons, including middle and right mouse buttons. I'd expect only left mouse button to select. Losing focus of the text box with tab doesn't cause the dropdown to disappear, so I'm no longer sure what conditions exactly cause it to disappear. Separate issue (though I'm fine to call this a stretch goal/leave for a later PR): I'd expect pressing up/down from the text box to focus one of the dropdown options to let you select one of them with pure keyboard, but this doesn't seem to be the case. The only way to interact with the dropdown is the mouse. Would also be nice to have fuzzy search so I could search "marnie" to get "marine" or something, but that's even more of a stretch goal. |
Another issue: The text input loses focus after hitting enter, even if the hint failed (e.g. due to a typo). It looks like focus entirely vanishes, so there's no recovering it by spamming tab a bunch of times. |
if len(value) >= self.min_chars: | ||
self.dropdown.clear_widgets() | ||
ctx: context_type = App.get_running_app().ctx | ||
item_names = ctx.item_names._game_store[ctx.game].values() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a new mypy issue:
Invalid index type "str | None" for "dict[str, ChainMap[int, str]]"; expected type "str" [index]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically purely a typing issue, as the underlying class is a defaultdict. Maybe @ThePhar for comment, as he made the typing.
After more testing, I've found some of my code suggestions have minor knock-on effects. Also, arrow-key navigation is rather a big change for code suggestions. I've tossed everything together into a PR into this branch (#3537). Merge at your leisure or pick pieces out if you don't like all of the decisions there. |
I did try the no focus lost before making this PR, and then deleted the line again as at least personally I did not like it. There is already not enough feedback to what's going on, but at least the focus loss means something at least tried to happen. |
There's two parts there: Focus moving away (reasonable imo), and focus going totally undefined so no amount of tabbing can recover it (bug). I had the command-line client open on the other monitor so I could get feedback from there when testing, but yeah without it the feedback is lacking. The normal pattern here is probably to just clear the text input on entry, though that could get annoying with typos (unless we also add command history to this, which is less useful than commands as there's little reason to hint the same thing repeatedly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Briefly looked at the code, but really just did functional testing. The scrolling is a little jittery/flashy, but the feature works great. Tested a few different games and all the items displayed and were filtered properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the look of this at all, but it's probably good enough until we switch to kivymd one day.
data/client.kv
Outdated
size_hint_y: None | ||
height: dp(30) | ||
multiline: False | ||
write_tab: False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at end of file
Co-authored-by: black-sliver <[email protected]>
# Conflicts: # kvui.py
Does this discriminate between hint and hint_location? Furthermore, could the list maybe two entries wide so there's more on the screen at once? (the names seem to mostly be smaller than a full line width) |
Co-authored-by: Silvris <[email protected]>
What is this fixing or adding?
adds a autocompleting new hint text input
How was this tested?
locally, connected with TextClient, not connected with TextClient, and connected with SC2 Client.
If this makes graphical changes, please attach screenshots.