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

[kle2json] fix rounding in output #8931

Merged
merged 2 commits into from
Apr 26, 2020
Merged

[kle2json] fix rounding in output #8931

merged 2 commits into from
Apr 26, 2020

Conversation

kbrock
Copy link
Contributor

@kbrock kbrock commented Apr 26, 2020

Description

Two tweaks to the code that converts from keyboard layout editor json to qmk info json files:

  • Remove error on command line execution
  • Round x and y output

Remove error on command line execution

Remove an error thrown in python 3.7.7 (more recent than the targeted 3.6):

./bin/qmk kle2json -f file.json
[...]
TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'

Round x and y output

  [...]
      "layouts": {
          "LAYOUT": {  
-             "layout": [{"label":"Esc", "x":0.66, "y":1.45}, {"label":"!", "x":1.6600000000000001, "y":1.45},
+             "layout": [{"label":"Esc", "x":0.66, "y":1.45}, {"label":"!", "x":1.66, "y":1.45},

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

PS

Starting small as I'm starting to understand python and qmk in general.

@kbrock kbrock changed the title Minor tweaks to kle2json [kle2json] fix rounding in output Apr 26, 2020
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/kle2xy.py Outdated Show resolved Hide resolved
resolves an issue while finding the file path

TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'
fixes quirks with float implementation.

before:
{"label":"Esc", "x":0.66, "y":1.45}, {"label":"!", "x":1.6600000000000001, "y":1.45}

after:
{"label":"Esc", "x":0.66, "y":1.45}, {"label":"!", "x":1.66, "y":1.45}
@kbrock
Copy link
Contributor Author

kbrock commented Apr 26, 2020

thanks @skullydazed - fixed

@zvecr zvecr added cli qmk cli command python labels Apr 26, 2020
@skullydazed skullydazed requested a review from a team April 26, 2020 17:33
@zvecr zvecr merged commit 3cb6fb2 into qmk:master Apr 26, 2020
@zvecr
Copy link
Member

zvecr commented Apr 26, 2020

Thanks!

@kbrock kbrock deleted the kle2info_2 branch April 28, 2020 21:35
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
[kle2json] fix rounding in output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli qmk cli command python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants