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

qmk info: Add --ascii flag #10793

Merged
merged 7 commits into from
Nov 2, 2020
Merged

qmk info: Add --ascii flag #10793

merged 7 commits into from
Nov 2, 2020

Conversation

fauxpark
Copy link
Member

Description

Replaced #10734 with something more useful.

MinGW Python on MSYS2 has trouble rendering the box drawing characters (because it's a native binary and thus thinks the character set is cp1252). As a hacky workaround, we can use ASCII characters instead.

image

It's not as pretty, but it's something.

Types of Changes

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

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • 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).

@fauxpark fauxpark requested review from skullydazed and a team October 29, 2020 20:23
lib/python/qmk/cli/info.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/info.py Outdated Show resolved Hide resolved
lib/python/qmk/keyboard.py Outdated Show resolved Hide resolved
lib/python/qmk/keyboard.py Show resolved Hide resolved
@fauxpark fauxpark requested a review from skullydazed October 30, 2020 01:27
Comment on lines +94 to +98
def render_layout(layout_data, render_ascii, key_labels=None):
"""Renders a single layout.
"""
textpad = [array('u', ' ' * 200) for x in range(50)]
style = 'ascii' if render_ascii else 'unicode'
Copy link
Member

Choose a reason for hiding this comment

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

A thought- it might be more future-proof to do this so we can have other layout styles in the future. Dots? Letters?

Suggested change
def render_layout(layout_data, render_ascii, key_labels=None):
"""Renders a single layout.
"""
textpad = [array('u', ' ' * 200) for x in range(50)]
style = 'ascii' if render_ascii else 'unicode'
def render_layout(layout_data, style='unicode', key_labels=None):
"""Renders a single layout.
Args:
style
The style for the box drawing characters. 'ascii' or 'unicode'
key_labels
A sequence of label strings to write on top of the keys
"""
textpad = [array('u', ' ' * 200) for x in range(50)]
style = 'ascii' if render_ascii else 'unicode'

Copy link
Member Author

Choose a reason for hiding this comment

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

I did experiment with other styles a bit. In the end I found that the current ascii style here, with underscores for the horizontals and pipes for everything else, looked the least awful.

This looks way too messy, for example:
image

@skullydazed skullydazed requested a review from a team October 30, 2020 16:36
Copy link
Member

@noroadsleft noroadsleft left a comment

Choose a reason for hiding this comment

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

Fixed a Unicode error I had in MSYS MinGW64.

@noroadsleft noroadsleft merged commit e69da2d into qmk:master Nov 2, 2020
@noroadsleft
Copy link
Member

Thanks!

@fauxpark fauxpark deleted the cli-ascii branch November 2, 2020 08:41
oscarcarlsson pushed a commit to oscarcarlsson/qmk_firmware that referenced this pull request Nov 2, 2020
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
ringmaster pushed a commit to ringmaster/qmk_firmware that referenced this pull request Nov 5, 2020
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
barrettclark pushed a commit to barrettclark/qmk_firmware that referenced this pull request Nov 5, 2020
* upstream/master: (153 commits)
  [Keymap] add brandonschlack userspace and keymaps (qmk#10411)
  [Keymap] add ai03/polaris:mekberg (qmk#10508)
  CLI: Add `qmk clean` (qmk#10785)
  Adds support for XD84 Pro (qmk#9750)
  Freyr refactor (qmk#10833)
  KC60 refactor (qmk#10834)
  [Keyboard] Fixes for PloopyCo mouse and readmes (qmk#10841)
  Enable extrakeys, mousekeys for all VIA keymaps. (qmk#10740)
  Add OLED support for Riblee F411 (qmk#10778)
  NK65 eeprom compatibility with 128KB and 256KB (qmk#10804)
  Add support for Noxary Vulcan (qmk#10822)
  Enable media keys support for Canoe VIA keymap (qmk#10829)
  Phantom refactor (qmk#10805)
  `qmk info`: Add `--ascii` flag (qmk#10793)
  [Keymap] Corrected the dvorak layout for kinesis advantage (qmk#10808)
  [Keyboard] Fix keyboard matrix scan rate with F072 (qmk#10226)
  [Keyboard] nullbitsco/nibble Configurator rework (qmk#10814)
  [Keyboard] VIA Support: Exent 65% (qmk#10797)
  [Keyboard] Add keebsforall/freebird60 (qmk#10774)
  add 65_ansi_split_bs to default community layouts (qmk#10770)
  ...
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Nov 24, 2020
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Jan 13, 2021
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants