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

Generating bepo layout generates Exception: Too many OEM keys #175

Open
gagath opened this issue May 26, 2024 · 2 comments
Open

Generating bepo layout generates Exception: Too many OEM keys #175

gagath opened this issue May 26, 2024 · 2 comments

Comments

@gagath
Copy link
Contributor

gagath commented May 26, 2024

This seems to be related to the klc Windows generator.
When building the Linux files only, the program exits successfully:

$ kalamine build bepo.toml
... dist/custom.ahk
Traceback (most recent call last):
  File "$HOME/kalamine/venv/bin/kalamine", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/kalamine/cli.py", line 137, in build
    build_all(layout, Path("dist"))
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/kalamine/cli.py", line 73, in build_all
    file.write(klc.klc(layout))
               ^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/kalamine/generators/klc.py", line 384, in klc
    out = substitute_lines(out, "LAYOUT",         klc_keymap(layout))
                                                  ^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/kalamine/generators/klc.py", line 139, in klc_keymap
    virtual_key = klc_virtual_key(layout, symbols, scan_code)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "$HOME/kalamine/venv/lib/python3.12/site-packages/kalamine/generators/klc.py", line 91, in klc_virtual_key
    raise Exception("Too many OEM keys")
Exception: Too many OEM keys

The used bepo.toml attached: bepo.toml.txt

Suggestion: the error should be fixed, or at least a clear error message with actionable explanation should be displayed.

@Ced-C
Copy link
Contributor

Ced-C commented Jun 1, 2024

Same issue when trying to generate driver for the latest version of Bépolar:

  • I got an error saying “Too many OEM keys”
  • it traces back to klc driver generation :
... dist/bepolar.ahk
Traceback (most recent call last):
  File "/home/cedc/.local/bin/kalamine", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/kalamine/cli.py", line 137, in build
    build_all(layout, Path("dist"))
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/kalamine/cli.py", line 73, in build_all
    file.write(klc.klc(layout))
               ^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/kalamine/generators/klc.py", line 384, in klc
    out = substitute_lines(out, "LAYOUT",         klc_keymap(layout))
                                                  ^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/kalamine/generators/klc.py", line 139, in klc_keymap
    virtual_key = klc_virtual_key(layout, symbols, scan_code)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cedc/.local/share/pipx/venvs/kalamine/lib/python3.12/site-packages/kalamine/generators/klc.py", line 91, in klc_virtual_key
    raise Exception("Too many OEM keys")
Exception: Too many OEM keys

Step to reproduce : kalamine build Bépolar.toml
with

name        = "Bépolar"
name8       = "bepolar"
locale      = "fr"
variant     = "bepolar"
description = "French (Bépolar)"
author      = "Cèd’C"
url         = "https://github.com/Ced-C/Bepolar"
geometry    = "ERGO"
version     = "0.7.0"

base = '''
  ╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
  ┆ ¬   ┃ #   │ « “ │ » ” │ ( „ │ ) ‘ ┃ @   │ + ÷ │ ^*ˇ │ / | │ * × ┃*µ   ┆ § ¶ ┆
  ┆ ~*~ ┃ 1 & │ 2 < │ 3 > │ 4 ( │ 5 ) ┃ 6 @ │ 7 ± │ 8*^ │ 9 \ │ 0 ° ┃ = ≠ ┆ % ‰ ┆
  ╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ B   │ M   │ P   │ O   │ W   ┃ Z   │ V   │ D   │ L   │ J   ┃ {   ┆ }   ┆
  ·     ┃   â │   û │   î │   ô │   œ ┃     │   ŭ │   ( │   ) │   ) ┃ [   ┆ ]   ┆
  ·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
  ·     ┃ A   │ U   │ I   │ E   │ ;   ┃ C   │ T   │ S   │ R   │ N   ┃ "   ┆ €*¤ ┆
  ·     ┃   à │   ù │   é │   è │ , ê ┃   ç │   ™ │   ß │   ® │   ñ ┃ ' ` ┆ $ ¢ ┆
  ╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
  ┆ \ ¦ ┃ ! ¡ │ Y   │ X   │ : · │ K   ┃ ? ¿ │ Q   │ G   │ H   │ F   ┃           ·
  ┆ / | ┃ - — │   ŷ │   _ │ . … │   æ ┃***¨ │   – │   µ │   © │   ‑ ┃           ·
  ╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·
'''

altgr = '''
╭╌╌╌╌╌┰─────┬─────┬─────┬─────┬─────┰─────┬─────┬─────┬─────┬─────┰╌╌╌╌╌┬╌╌╌╌╌╮
┆     ┃   ¹ │   ² │   ³ │   ⁴ │   ⁵ ┃   ⁶ │   ⁷ │   ⁸ │   ⁹ │   ⁰ ┃     ┆     ┆
┆     ┃   ₁ │   ₂ │   ₃ │   ₄ │   ₅ ┃   ₆ │   ₇ │   ₈ │   ₉ │   ₀ ┃     ┆     ┆
╰╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
·     ┃  *^ │   ≤ │   ≥ │  *¤ │   ‰ ┃  *˚ │     │   × │  *´ │  *` ┃     ┆     ┆
·     ┃   ^ │   < │   > │   $ │   % ┃   @ │   & │   * │   ' │   ` ┃     ┆     ┆
·     ┠─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┼╌╌╌╌╌┤
·     ┃  *ˇ │     │     │  *˙ │   ≠ ┃  */ │   ± │  *¯ │   ÷ │  *” ┃     ┆     ┆
·     ┃   { │   ( │   ) │   } │   = ┃   \ │   + │   - │   / │   " ┃  *´ ┆     ┆
╭╌╌╌╌╌╂─────┼─────┼─────┼─────┼─────╂─────┼─────┼─────┼─────┼─────╂╌╌╌╌╌┴╌╌╌╌╌╯
┆     ┃  *~ │  *, │  *˛ │   – │     ┃   ¦ │   ¬ │  *¸ │   : │  *˘ ┃           ·
┆     ┃   ~ │   [ │   ] │   _ │   # ┃   | │   ! │   ; │   : │   ? ┃           ·
╰╌╌╌╌╌┸─────┴─────┴─────┴─────┴─────┸─────┴─────┴─────┴─────┴─────┚ · · · · · ·
'''

[spacebar]
shift       = "\u202f"  # NARROW NO-BREAK SPACE
altgr       = "\u0020"  # SPACE
altgr_shift = "\u00a0"  # NO-BREAK SPACE
1dk         = "\u2019"  # RIGHT SINGLE QUOTATION MARK
1dk_shift   = "\u2019"  # RIGHT SINGLE QUOTATION MARK

using kalamine V0.36

@Geobert
Copy link
Contributor

Geobert commented Jun 1, 2024

on both instances, removal of the 2 leading spaces on each line of base description fixes the issue

we need to bullet proof the parser

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

No branches or pull requests

3 participants