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

fix(klc): avoid empty keys #196

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kalamine/generators/klc.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def klc_virtual_key(layout: "KeyboardLayout", symbols: list, scan_code: str) ->
return "OEM_MINUS"
elif base == " ":
return "SPACE"
elif base == "-1" and shifted == "-1":
raise Exception("Empty key are not allowed, please complete the description")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise Exception("Empty key are not allowed, please complete the description")
raise Exception("Empty keys are not allowed, please complete the description")

Copy link
Collaborator

Choose a reason for hiding this comment

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

This section confusing. Where do these "-1" come from? This doesn’t seem sane to me. :-)

The exception message could be more self-explanatory. What should be completed?
And while we’re at it, the "too many OEM keys" message could be a bit better as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don’t know where the -1 comes from, isn’t it filled by the toml parser?

"Too many OEM" is not very clear indeed, do you have a better idea? I don’t have any ^^'

else:
MAX_OEM = 9
# We affect abitrary OEM VK and it will not match the one
Expand Down
Loading