abouttreesummaryrefslogcommitdiff
path: root/check_layout.py
diff options
context:
space:
mode:
authorJules Aguillon2023-08-05 17:58:13 +0200
committerJules Aguillon2023-08-05 19:40:13 +0200
commit76f01122c2f60a51e5c2d4cdf289e5136cd50752 (patch)
tree7a0f1b285289e6cd47cf845ae41761ffc53b348f /check_layout.py
parent94bd9c6bc888a72fcb8f494e6c5d84c36a347c35 (diff)
downloadunexpected-keyboard-76f01122c2f60a51e5c2d4cdf289e5136cd50752.tar.gz
unexpected-keyboard-76f01122c2f60a51e5c2d4cdf289e5136cd50752.zip
Tweak check_layout.py
- Warn about missing esc, tab, f11_placeholder and f12_placeholder. - Don't check non-layout files and special layouts.
Diffstat (limited to 'check_layout.py')
-rw-r--r--check_layout.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/check_layout.py b/check_layout.py
index d242010..e5e14dc 100644
--- a/check_layout.py
+++ b/check_layout.py
@@ -3,6 +3,11 @@ import sys
warning_count = 0
+KNOWN_NOT_LAYOUT = set([
+ "res/xml/number_row.xml", "res/xml/numpad.xml", "res/xml/pin.xml",
+ "res/xml/bottom_row.xml", "res/xml/settings.xml", "res/xml/method.xml",
+ "res/xml/greekmath.xml", "res/xml/numeric.xml" ])
+
def warn(msg):
global warning_count
print(msg)
@@ -44,9 +49,10 @@ def check_layout(layout):
root, keys = layout
missing_some_of(keys, "~!@#$%^&*(){}`[]=\\-_;:/.,?<>'\"+|", "ASCII punctuation")
missing_some_of(keys, "0123456789", "digits")
- missing_some_of(keys, ["f11_placeholder", "f12_placeholder"])
- missing_some_of(keys, ["esc", "tab"])
- missing_required(keys, ["backspace", "delete"], "Layout doesn't define some important keys")
+ missing_required(keys,
+ ["esc", "tab", "backspace", "delete",
+ "f11_placeholder", "f12_placeholder"],
+ "Layout doesn't define some important keys")
unexpected_keys(keys,
["copy", "paste", "cut", "selectAll", "shareText",
"pasteAsPlainText", "undo", "redo", "replaceText",
@@ -74,6 +80,8 @@ def check_layout(layout):
warn("Layout doesn't specify a script.")
for fname in sys.argv[1:]:
+ if fname in KNOWN_NOT_LAYOUT:
+ continue
layout = parse_layout(fname)
if layout == None:
print("Not a layout file: %s" % fname)