Skip to content

Commit 51c1fc2

Browse files
committed
v250111.2
1 parent 4edfbe8 commit 51c1fc2

File tree

9 files changed

+792
-250
lines changed

9 files changed

+792
-250
lines changed
Binary file not shown.

easycoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
from .ec_timestamp import *
1111
from .ec_value import *
1212

13-
__version__ = "250111.1"
13+
__version__ = "250111.2"

plugins/ec_keyboard.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,16 @@ def r_on(self, command):
5353
return self.nextPC()
5454

5555
# Render a keyboard
56-
# render keyboard {layout) at {left} {bottom} width {width}
56+
# render keyboard {face) [and {face)...] at {left} {bottom} width {width}
5757
def k_render(self, command):
5858
if self.nextIs('keyboard'):
59-
command['layout'] = self.nextValue()
59+
faces = []
60+
while True:
61+
faces.append(self.nextValue())
62+
token = self.peek()
63+
if token != 'and': break
64+
self.nextToken()
65+
command['faces'] = json.dumps(faces)
6066
x = getConstant('10w')
6167
y = getConstant('10h')
6268
w = getConstant('50w')
@@ -78,16 +84,18 @@ def k_render(self, command):
7884

7985
def r_render(self, command):
8086
self.keyboard = Object()
81-
layout = self.getRuntimeValue(command['layout'])
82-
with open(f'{layout}') as f: spec = f.read()
83-
self.keyboard.layout = json.loads(spec)
84-
layout = self.keyboard.layout[0]
87+
faces = json.loads(command['faces'])
88+
self.keyboard.faces = []
89+
for f in range(0, len(faces)):
90+
with open(f'{self.getRuntimeValue(faces[f])}') as f: spec = f.read()
91+
self.keyboard.faces.append(json.loads(spec))
92+
layout = self.keyboard.faces[0]
8593
x = getActual(self.getRuntimeValue(command['x']))
8694
y = getActual(self.getRuntimeValue(command['y']))
8795
w = getActual(self.getRuntimeValue(command['w']))
8896
# Scan the keyboard layout to find the longest row
8997
max = 0
90-
rows = self.keyboard.layout[0]['rows']
98+
rows = layout['rows']
9199
nrows = len(rows)
92100
for r in range(0, nrows):
93101
row = rows[r]

plugins/keyboards/4-function.json

Lines changed: 60 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,62 @@
1-
[
2-
{
3-
"face": "plugins/keyboards/4-function.png",
4-
"rows":
1+
{
2+
"face": "plugins/keyboards/4-function.png",
3+
"rows":
4+
[
55
[
6-
[
7-
{
8-
"id": "1"
9-
},
10-
{
11-
"id": "2"
12-
},
13-
{
14-
"id": "3"
15-
},
16-
{
17-
"id": "+"
18-
}
19-
],
20-
[
21-
{
22-
"id": "4"
23-
},
24-
{
25-
"id": "5"
26-
},
27-
{
28-
"id": "6"
29-
},
30-
{
31-
"id": "-"
32-
}
33-
],
34-
[
35-
{
36-
"id": "7"
37-
},
38-
{
39-
"id": "8"
40-
},
41-
{
42-
"id": "9"
43-
},
44-
{
45-
"id": "*"
46-
}
47-
],
48-
[
49-
{
50-
"id": "0"
51-
},
52-
{
53-
"id": "C"
54-
},
55-
{
56-
"id": "="
57-
},
58-
{
59-
"id": "/"
60-
}
61-
]
6+
{
7+
"id": "1"
8+
},
9+
{
10+
"id": "2"
11+
},
12+
{
13+
"id": "3"
14+
},
15+
{
16+
"id": "+"
17+
}
18+
],
19+
[
20+
{
21+
"id": "4"
22+
},
23+
{
24+
"id": "5"
25+
},
26+
{
27+
"id": "6"
28+
},
29+
{
30+
"id": "-"
31+
}
32+
],
33+
[
34+
{
35+
"id": "7"
36+
},
37+
{
38+
"id": "8"
39+
},
40+
{
41+
"id": "9"
42+
},
43+
{
44+
"id": "*"
45+
}
46+
],
47+
[
48+
{
49+
"id": "0"
50+
},
51+
{
52+
"id": "C"
53+
},
54+
{
55+
"id": "="
56+
},
57+
{
58+
"id": "/"
59+
}
6260
]
63-
}
64-
]
61+
]
62+
}

0 commit comments

Comments
 (0)