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

Change Choice.shortcut_key to property with setter #349

Merged
merged 3 commits into from
Jul 23, 2024

Conversation

overhacked
Copy link
Contributor

@overhacked overhacked commented Jan 9, 2024

What is the problem that this PR addresses?

Ensures that Choice.auto_shortcut is set to False whenever Choice.shortcut_key is set to a str value and vice versa

Closes #340

How did you solve it?

Implemented the suggested fix in PR #340 to convert Choices.shortcut_key to a property with a setter.

Checklist

  • I have read the Contributor's Guide.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@overhacked overhacked force-pushed the auto_shortcut_loop_fix branch 2 times, most recently from 40ef821 to 8f4ab05 Compare January 9, 2024 02:34
@overhacked overhacked marked this pull request as ready for review January 9, 2024 02:36
@overhacked
Copy link
Contributor Author

@kiancross, I implemented the fix you suggested in #340: #340 (comment). Checking in about whether it is possible to merge this? Thanks!

@kiancross
Copy link
Collaborator

@overhacked Please can you update this branch with latest changes from master and then I will review.

@overhacked
Copy link
Contributor Author

Up to date now. I ran lints and tests before pushing; hopefully CI passes 🤞.

Copy link
Collaborator

@kiancross kiancross left a comment

Choose a reason for hiding this comment

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

@overhacked Does some logic need to be added for when auto_shortcut is changed?

Ensures that `Choice.auto_shortcut` is set to `False`
whenever `Choice.shortcut_key` is set to a `str` value
and vice versa. Add tests for fix.

Fixes tmbo#340

Signed-off-by: Ross Williams <ross@ross-williams.net>
`auto_shortcut` and `shortcut_key` interact in ways that requires logic
when setting either, to ensure that they do not conflict.

Signed-off-by: Ross Williams <ross@ross-williams.net>
@overhacked
Copy link
Contributor Author

@kiancross, you're right. I added code to handle blanking shortcut_key when auto_shortcut is set to True, along with normal getter/deleter functions.

questionary/prompts/common.py Outdated Show resolved Hide resolved
@kiancross kiancross enabled auto-merge (squash) July 23, 2024 23:35
@kiancross
Copy link
Collaborator

Great, thank you!

@kiancross kiancross merged commit f6761e2 into tmbo:master Jul 23, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants