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

Add keyboard #428

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Add keyboard #428

wants to merge 4 commits into from

Conversation

kj7rrv
Copy link

@kj7rrv kj7rrv commented Jun 22, 2023

This PR adds a keyboard and an app to demonstrate it.

micropython.zip for PineTime

KbdemoApp

The keyboard can type any character that can be typed on a standard US QWERTY keyboard, except Tab.

As part of implementing the keyboard, it also adds an option to make the wrap() command ignore spaces.

# Same as old behavior
wrap("Lorem ipsum dolor sit amet", 196)
wrap("Lorem ipsum dolor sit amet", 196, True)
wrap("Lorem ipsum dolor sit amet", 196, prefer_spaces=True)

# Still breaks on newlines, but handles spaces as regular characters
wrap("Lorem ipsum dolor sit amet", 196, False)
wrap("Lorem ipsum dolor sit amet", 196, prefer_spaces=False)

Signed-off-by: Samuel Sloniker <sam@kj7rrv.com>
Signed-off-by: Samuel Sloniker <sam@kj7rrv.com>
Signed-off-by: Samuel Sloniker <sam@kj7rrv.com>
@kj7rrv kj7rrv changed the title Add option to make wrap() ignore spaces Add keyboard Jun 22, 2023
@GaryM0101
Copy link

Tested the Pinetime build...flashed successfully but stuck the main.py screen. This tells me there is not enough memory to load the default clock. In safe mode the main.py is there.
Connected to PineTime (FA:38:CE:C5:3C:ED).
Exit console using Ctrl-X.

from shell import *
cd ('/flash')
ls
1312 Beacon.mpy
18 alarms.txt

logs 35 main.py

cat ('main.py')
import wasp
wasp.system.schedule()

@kj7rrv
Copy link
Author

kj7rrv commented Jun 26, 2023

Thank you @GaryM0101! Is there a way to precompile the module to reduce RAM usage, or is that already done as part of compiling the micropython.zip file?

@GaryM0101
Copy link

GaryM0101 commented Jun 26, 2023 via email

@kj7rrv
Copy link
Author

kj7rrv commented Jun 26, 2023 via email

@fgaz fgaz added enhancement New feature or request new app Requests or adds a new application labels Jun 27, 2023
wasp/keyboard.py Outdated Show resolved Hide resolved
bg = draw.darken(theme("ui"), theme("contrast"))
bg2 = draw.darken(bg, 2)

self._draw_grid(draw, 0, bg2, lo)
Copy link
Contributor

Choose a reason for hiding this comment

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

If this line is moved to the end of the open function, just before the self._draw() call, then redraws for the shift or symbols keys will be somewhat faster.

@kj7rrv kj7rrv marked this pull request as draft August 15, 2023 00:24
Co-authored-by: Eloi Torrents <eloitor@disroot.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new app Requests or adds a new application
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants