remove built-in special chars from keyboard

This commit is contained in:
Roman Trapeznikov 2020-08-02 12:57:39 +03:00
parent 04480157c3
commit 3919cfbe37
No known key found for this signature in database
GPG Key ID: 827DD41DACE1E018

View File

@ -30,21 +30,7 @@ from typing import TYPE_CHECKING
import ba
if TYPE_CHECKING:
from typing import Iterable, List
def split(chars: Iterable[ba.SpecialChar],
maxlen: int) -> List[List[ba.SpecialChar]]:
"""Returns ba.SpecialChar groups with a fixed number of elements"""
result = []
shatter: List[ba.SpecialChar] = []
for i in chars:
if len(shatter) < maxlen:
shatter.append(i)
else:
result.append(shatter)
shatter = [i]
return result
from typing import Dict, Tuple
# ba_meta export keyboard
@ -55,7 +41,4 @@ class EnglishKeyboard(ba.Keyboard):
('z', 'x', 'c', 'v', 'b', 'n', 'm')]
nums = ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '/', ':',
';', '(', ')', '$', '&', '@', '"', '.', ',', '?', '!', '\'', '_')
pages = {
f'emoji{i}': tuple(ba.charstr(char) for char in page)
for i, page in enumerate(split(ba.SpecialChar, len(nums)))
}
pages: Dict[str, Tuple[str, ...]] = {}