OneDeadKey / kalamine

Keyboard Layout Maker
MIT License
100 stars 29 forks source link

echec de wkalamine avec l’option angle-mod #172

Open nemolivier opened 3 months ago

nemolivier commented 3 months ago

béop-némo.txt La compilation d’un .toml avec l’option angle.mod plante avec ce message d’erreur :

Creating MSKLC driver for `béop-némo` █████████████∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ 42%Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "c:\users\olivier\.local\bin\wkalamine.exe\__main__.py", line 7, in <module>
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\kalamine\cli_msklc.py", line 61, in build
    if msklc_mgr.build_msklc_dll():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\kalamine\msklc_manager.py", line 179, in build_msklc_dll
    file.write(klc.klc(self._layout))
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\kalamine\generators\klc.py", line 384, in klc
    out = substitute_lines(out, "LAYOUT",         klc_keymap(layout))
                                                  ^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\kalamine\generators\klc.py", line 139, in klc_keymap
    virtual_key = klc_virtual_key(layout, symbols, scan_code)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Olivier\AppData\Local\pipx\pipx\venvs\kalamine\Lib\site-packages\kalamine\generators\klc.py", line 91, in klc_virtual_key
    raise Exception("Too many OEM keys")
Exception: Too many OEM keys

Pas d’erreur si pas utilisation de l’option angle-mod.

Ced-C commented 3 months ago

Bug Confirmed with the latest version of kalamine. it seems that the --angle-mod option is not compatible with the MAX_OEM = 8 by setting the variable to 9 it fixes the bug for me at least.

But that might not be the intended behaviour.

@fabi1cazenave, I think you wrote this part, is kalamine/generators/klc.py:50,54

    if scan_code == "56":
        # manage the ISO key (between shift and Z on ISO keyboards).
        # We're assuming that its scancode is always 56
        # https://www.win.tue.nl/~aeb/linux/kbd/scancodes.html
        return "OEM_102"

Compatible with the angle-mod permutation? Should we deal with it here or increase the MAX_OEM value to 9 upon angle-mod ?

Advise needed 😅

In any case, I am surprised this passed the unit tests.

Geobert commented 2 months ago

increase the MAX_OEM value to 9 upon angle-mod ?

can’t do that, it’s not defined http://kbdedit.com/manual/low_level_vk_list.html