easycoder 250105.1__py2.py3-none-any.whl → 250106.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of easycoder might be problematic. Click here for more details.
- easycoder/__init__.py +1 -1
- easycoder/ec_compiler.py +1 -1
- easycoder/ec_core.py +0 -1
- easycoder/ec_graphics.py +26 -12
- easycoder/ec_renderer.py +18 -15
- easycoder/ec_screenspec.py +4 -7
- easycoder/ec_value.py +2 -2
- {easycoder-250105.1.dist-info → easycoder-250106.2.dist-info}/METADATA +3 -3
- easycoder-250106.2.dist-info/RECORD +19 -0
- {easycoder-250105.1.dist-info → easycoder-250106.2.dist-info}/WHEEL +1 -1
- easycoder-250105.1.dist-info/RECORD +0 -19
- {easycoder-250105.1.dist-info → easycoder-250106.2.dist-info}/LICENSE +0 -0
- {easycoder-250105.1.dist-info → easycoder-250106.2.dist-info}/entry_points.txt +0 -0
easycoder/__init__.py
CHANGED
easycoder/ec_compiler.py
CHANGED
|
@@ -102,7 +102,7 @@ class Compiler:
|
|
|
102
102
|
|
|
103
103
|
def showWarnings(self):
|
|
104
104
|
for warning in self.warnings:
|
|
105
|
-
print(f'Warning at line {self.getLino() + 1}
|
|
105
|
+
print(f'Warning at line {self.getLino() + 1} of {self.program.name}: {warning}')
|
|
106
106
|
|
|
107
107
|
def getSymbolRecord(self):
|
|
108
108
|
token = self.getToken()
|
easycoder/ec_core.py
CHANGED
easycoder/ec_graphics.py
CHANGED
|
@@ -9,6 +9,7 @@ class Graphics(Handler):
|
|
|
9
9
|
|
|
10
10
|
def __init__(self, compiler):
|
|
11
11
|
Handler.__init__(self, compiler)
|
|
12
|
+
self.windowCreated = False
|
|
12
13
|
|
|
13
14
|
def getName(self):
|
|
14
15
|
return 'graphics'
|
|
@@ -36,7 +37,7 @@ class Graphics(Handler):
|
|
|
36
37
|
FatalError(self.program.compiler, f'There is no screen element with id \'{id}\'')
|
|
37
38
|
return -1
|
|
38
39
|
if element.getType() != keyword:
|
|
39
|
-
FatalError(self.program.compiler, f'Mismatched element type
|
|
40
|
+
FatalError(self.program.compiler, f'Mismatched element type: \'{element['type']}\' and \'{keyword}\'')
|
|
40
41
|
self.putSymbolValue(targetRecord, {'type': 'text', 'content': id})
|
|
41
42
|
return self.nextPC()
|
|
42
43
|
|
|
@@ -65,11 +66,15 @@ class Graphics(Handler):
|
|
|
65
66
|
r = self.compileConstant(255)
|
|
66
67
|
g = self.compileConstant(255)
|
|
67
68
|
b = self.compileConstant(255)
|
|
69
|
+
fullscreen = False
|
|
68
70
|
while True:
|
|
69
71
|
token = self.peek()
|
|
70
72
|
if token == 'title':
|
|
71
73
|
self.nextToken()
|
|
72
74
|
t = self.nextValue()
|
|
75
|
+
elif token == 'fullscreen':
|
|
76
|
+
fullscreen = True
|
|
77
|
+
self.nextToken()
|
|
73
78
|
elif token == 'at':
|
|
74
79
|
self.nextToken()
|
|
75
80
|
left = self.nextValue()
|
|
@@ -91,9 +96,10 @@ class Graphics(Handler):
|
|
|
91
96
|
command['pos'] = (left, top)
|
|
92
97
|
command['size'] = (width, height)
|
|
93
98
|
command['fill'] = (r, g, b)
|
|
99
|
+
command['fullscreen'] = fullscreen
|
|
94
100
|
self.add(command)
|
|
95
101
|
return True
|
|
96
|
-
|
|
102
|
+
|
|
97
103
|
elif self.isSymbol():
|
|
98
104
|
record = self.getSymbolRecord()
|
|
99
105
|
command['target'] = record['name']
|
|
@@ -113,7 +119,7 @@ class Graphics(Handler):
|
|
|
113
119
|
self.add(command)
|
|
114
120
|
record['elementID'] = command['id']
|
|
115
121
|
return False
|
|
116
|
-
|
|
122
|
+
|
|
117
123
|
def getElementData(self, type, command):
|
|
118
124
|
width = None
|
|
119
125
|
height = None
|
|
@@ -170,23 +176,28 @@ class Graphics(Handler):
|
|
|
170
176
|
command['source'] = source
|
|
171
177
|
|
|
172
178
|
def r_create(self, command):
|
|
179
|
+
|
|
173
180
|
try:
|
|
174
181
|
type = command['type']
|
|
175
182
|
if type == 'window':
|
|
183
|
+
if self.windowCreated == True:
|
|
184
|
+
RuntimeError(self.program, 'A window has already been created')
|
|
176
185
|
self.windowSpec = Object()
|
|
177
186
|
self.windowSpec.title = command['title']['content']
|
|
187
|
+
self.windowSpec.fullscreen = command['fullscreen']
|
|
178
188
|
self.windowSpec.flush = flush
|
|
179
189
|
self.windowSpec.kill = self.program.kill
|
|
180
190
|
self.windowSpec.pos = (self.getRuntimeValue(command['pos'][0]), self.getRuntimeValue(command['pos'][1]))
|
|
181
191
|
self.windowSpec.size = (self.getRuntimeValue(command['size'][0]), self.getRuntimeValue(command['size'][1]))
|
|
182
192
|
self.windowSpec.fill = (self.getRuntimeValue(command['fill'][0])/255, self.getRuntimeValue(command['fill'][1])/255, self.getRuntimeValue(command['fill'][2])/255)
|
|
193
|
+
self.windowCreated = True
|
|
183
194
|
else:
|
|
184
195
|
element = self.ui.createWidget(self.getWidgetSpec(command))
|
|
185
196
|
print(element)
|
|
186
197
|
except Exception as e:
|
|
187
198
|
RuntimeError(self.program, e)
|
|
188
199
|
return self.nextPC()
|
|
189
|
-
|
|
200
|
+
|
|
190
201
|
def getWidgetSpec(self, command):
|
|
191
202
|
spec = Object()
|
|
192
203
|
spec.id = self.getRuntimeValue(command['id'])
|
|
@@ -301,13 +312,22 @@ class Graphics(Handler):
|
|
|
301
312
|
# render {spec}
|
|
302
313
|
def k_render(self, command):
|
|
303
314
|
command['spec'] = self.nextValue()
|
|
315
|
+
command['parent'] = None
|
|
316
|
+
if self.peek() == 'in':
|
|
317
|
+
self.nextToken()
|
|
318
|
+
if self.nextIsSymbol():
|
|
319
|
+
command['parent'] = self.getSymbolRecord()['name']
|
|
304
320
|
self.add(command)
|
|
305
321
|
return True
|
|
306
322
|
|
|
307
323
|
def r_render(self, command):
|
|
324
|
+
spec = self.getRuntimeValue(command['spec'])
|
|
325
|
+
parent = command['parent']
|
|
326
|
+
if parent !=None:
|
|
327
|
+
parent = self.getVariable(command['parent'])
|
|
308
328
|
self.ui = self.renderer.getUI()
|
|
309
329
|
try:
|
|
310
|
-
ScreenSpec().render(
|
|
330
|
+
ScreenSpec().render(spec, parent, self.ui)
|
|
311
331
|
except Exception as e:
|
|
312
332
|
RuntimeError(self.program, e)
|
|
313
333
|
return self.nextPC()
|
|
@@ -316,12 +336,6 @@ class Graphics(Handler):
|
|
|
316
336
|
def k_run(self, command):
|
|
317
337
|
if self.nextIs('graphics'):
|
|
318
338
|
self.add(command)
|
|
319
|
-
cmd = {}
|
|
320
|
-
cmd['domain'] = 'graphics'
|
|
321
|
-
cmd['lino'] = command['lino'] + 1
|
|
322
|
-
cmd['keyword'] = 'getui'
|
|
323
|
-
cmd['debug'] = False
|
|
324
|
-
self.addCommand(cmd)
|
|
325
339
|
return True
|
|
326
340
|
return False
|
|
327
341
|
|
|
@@ -385,7 +399,7 @@ class Graphics(Handler):
|
|
|
385
399
|
value['type'] = 'symbol'
|
|
386
400
|
return value
|
|
387
401
|
return None
|
|
388
|
-
|
|
402
|
+
|
|
389
403
|
if self.tokenIs('the'):
|
|
390
404
|
self.nextToken()
|
|
391
405
|
kwd = self.getToken()
|
easycoder/ec_renderer.py
CHANGED
|
@@ -41,21 +41,21 @@ class Element():
|
|
|
41
41
|
def setPos(self, pos):
|
|
42
42
|
self.spec.realpos = pos
|
|
43
43
|
self.spec.item.pos = pos
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
# Called when the parent moves
|
|
46
46
|
def repos(self):
|
|
47
47
|
spec = self.spec
|
|
48
48
|
spec.item.pos = Vector(spec.realpos) + spec.parent.realpos
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
def getRealSize(self):
|
|
51
51
|
return self.spec.realsize
|
|
52
|
-
|
|
52
|
+
|
|
53
53
|
def getSize(self):
|
|
54
54
|
return self.spec.size
|
|
55
55
|
|
|
56
56
|
def setSize(self, size):
|
|
57
57
|
self.spec.size = size
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
def getChildren(self):
|
|
60
60
|
return self.spec.children
|
|
61
61
|
|
|
@@ -68,7 +68,7 @@ class UI(Widget):
|
|
|
68
68
|
if id in self.elements.keys():
|
|
69
69
|
return self.elements[id]
|
|
70
70
|
return None
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
def addElement(self, id, spec):
|
|
73
73
|
if id in self.elements.keys():
|
|
74
74
|
raise(Exception(f'Element {id} already exists'))
|
|
@@ -133,7 +133,7 @@ class UI(Widget):
|
|
|
133
133
|
item = AsyncImage(pos=pos, size=size, source=spec.source)
|
|
134
134
|
spec.item = item
|
|
135
135
|
self.addElement(spec.id, spec)
|
|
136
|
-
|
|
136
|
+
|
|
137
137
|
def moveElementBy(self, id, dist):
|
|
138
138
|
element = self.getElement(id)
|
|
139
139
|
if element != None:
|
|
@@ -141,7 +141,7 @@ class UI(Widget):
|
|
|
141
141
|
for id in element.getChildren():
|
|
142
142
|
self.getElement(id).repos()
|
|
143
143
|
return
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
def moveElementTo(self, id, pos):
|
|
146
146
|
element = self.getElement(id)
|
|
147
147
|
if element != None:
|
|
@@ -172,7 +172,7 @@ class UI(Widget):
|
|
|
172
172
|
if tp[0] >= pos[0] and tp[0] < pos[0] + size[0] and tp[1] >= pos[1] and tp[1] < pos[1] + size[1]:
|
|
173
173
|
element.cb()
|
|
174
174
|
break
|
|
175
|
-
|
|
175
|
+
|
|
176
176
|
def setOnClick(self, id, callback):
|
|
177
177
|
self.getElement(id).cb = callback
|
|
178
178
|
|
|
@@ -200,7 +200,7 @@ class UI(Widget):
|
|
|
200
200
|
return spec.realsize[1]
|
|
201
201
|
else:
|
|
202
202
|
raise Exception(f'Unknown attribute: {attribute}')
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
def setAttribute(self, id, attribute, value):
|
|
205
205
|
spec = self.getElement(id).spec
|
|
206
206
|
if attribute == 'left':
|
|
@@ -222,15 +222,15 @@ class Renderer(App):
|
|
|
222
222
|
|
|
223
223
|
def getUI(self):
|
|
224
224
|
return self.ui
|
|
225
|
-
|
|
225
|
+
|
|
226
226
|
def request_close(self):
|
|
227
227
|
print('close window')
|
|
228
228
|
self.kill()
|
|
229
229
|
Window.close()
|
|
230
|
-
|
|
230
|
+
|
|
231
231
|
def flushQueue(self, dt):
|
|
232
232
|
self.flush()
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
def build(self):
|
|
235
235
|
Clock.schedule_interval(self.flushQueue, 0.01)
|
|
236
236
|
return self.ui
|
|
@@ -240,8 +240,11 @@ class Renderer(App):
|
|
|
240
240
|
self.title = spec.title
|
|
241
241
|
self.flush = spec.flush
|
|
242
242
|
self.kill = spec.kill
|
|
243
|
-
Window.size = spec.size
|
|
244
|
-
Window.left = spec.pos[0]
|
|
245
|
-
Window.top = spec.pos[1]
|
|
246
243
|
Window.clearcolor = spec.fill
|
|
247
244
|
Window.on_request_close=self.request_close
|
|
245
|
+
if spec.fullscreen:
|
|
246
|
+
Window.fullscreen = True
|
|
247
|
+
else:
|
|
248
|
+
Window.size = spec.size
|
|
249
|
+
Window.left = spec.pos[0]
|
|
250
|
+
Window.top = spec.pos[1]
|
easycoder/ec_screenspec.py
CHANGED
|
@@ -61,17 +61,14 @@ class ScreenSpec():
|
|
|
61
61
|
self.createWidget(spec[widgets], parent)
|
|
62
62
|
|
|
63
63
|
# Render a graphic specification
|
|
64
|
-
def render(self, spec, ui):
|
|
64
|
+
def render(self, spec, parent, ui):
|
|
65
65
|
self.ui = ui
|
|
66
66
|
|
|
67
67
|
# If it'a string, process it
|
|
68
68
|
if isinstance(spec, str):
|
|
69
|
-
self.renderSpec(loads(spec),
|
|
69
|
+
self.renderSpec(loads(spec), parent)
|
|
70
70
|
|
|
71
71
|
# If it's a 'dict', extract the spec and the args
|
|
72
|
-
elif isinstance(spec, dict):
|
|
73
|
-
spec = loads(spec['spec'])
|
|
74
|
-
self.renderSpec(spec, None)
|
|
75
|
-
|
|
76
72
|
else:
|
|
77
|
-
|
|
73
|
+
self.renderSpec(spec, parent)
|
|
74
|
+
|
easycoder/ec_value.py
CHANGED
|
@@ -51,14 +51,14 @@ class Value:
|
|
|
51
51
|
if item != None:
|
|
52
52
|
return item
|
|
53
53
|
self.compiler.rewindTo(mark)
|
|
54
|
-
self.compiler.warning(f'I don\'t understand \'{token}\'')
|
|
54
|
+
# self.compiler.warning(f'I don\'t understand \'{token}\'')
|
|
55
55
|
return None
|
|
56
56
|
|
|
57
57
|
def compileValue(self):
|
|
58
58
|
token = self.getToken()
|
|
59
59
|
item = self.getItem()
|
|
60
60
|
if item == None:
|
|
61
|
-
|
|
61
|
+
self.compiler.warning(f'ec_value.compileValue: Cannot get the value of "{token}"')
|
|
62
62
|
return None
|
|
63
63
|
|
|
64
64
|
value = {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250106.2
|
|
4
4
|
Summary: Rapid scripting in English
|
|
5
5
|
Keywords: compiler,scripting,prototyping,programming,coding,python,low code,hypertalk,computer language,learn to code
|
|
6
6
|
Author-email: Graham Trott <gtanyware@gmail.com>
|
|
@@ -77,7 +77,7 @@ A couple of demo graphical scripts are included in the `scripts` directory:
|
|
|
77
77
|
|
|
78
78
|
- English-like syntax based on vocabulary rather than structure. Scripts can be read as English
|
|
79
79
|
- Comprehensive feature set
|
|
80
|
-
- Runs directly from source scripts
|
|
80
|
+
- Runs directly from source scripts. A fast compiler creates efficient intermediate code that runs immediately after compilation
|
|
81
81
|
- Low memory requirements
|
|
82
82
|
- Minimim dependency on other 3rd-party packages
|
|
83
83
|
- Built-in co-operative multitasking
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
easycoder/README.md,sha256=PYqOc_SkIGiFbyCNs90y7JqoqWe4aO1xYIW-6bOnFKU,573
|
|
2
|
+
easycoder/__init__.py,sha256=CmJ8x5YEEEP1t-zhZ4OLmZKxrPHxUeRdV1hgp3cn-AI,283
|
|
3
|
+
easycoder/ec.py,sha256=Nj5PRl8GsKjfGJKq0FOM1a7FeK3cN68CoIFg8lswQEg,221
|
|
4
|
+
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
5
|
+
easycoder/ec_compiler.py,sha256=f3zZRtbNsegBuRHTvTLK8BOdnuRq5p_p-1vtJYb-LiY,4800
|
|
6
|
+
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
7
|
+
easycoder/ec_core.py,sha256=71rSNOwMrO0Ik1hdgTshOYRo2XVD0Br7gUZfCR7A0OA,86291
|
|
8
|
+
easycoder/ec_graphics.py,sha256=vcI7g3wVUbwbGl5j032tYVWBu9aceThI4ZN8lLMpd5w,17017
|
|
9
|
+
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
10
|
+
easycoder/ec_program.py,sha256=sdVPc1c8urLn5icov-NVyNkc78UR930ipDDONlZTge8,9831
|
|
11
|
+
easycoder/ec_renderer.py,sha256=ht_fdC6Yt5PKhTVim_2zg1cCQTHeS1OKzQSRYgL1cT4,8054
|
|
12
|
+
easycoder/ec_screenspec.py,sha256=qNqhbP16gAi2cRUD3W0dpb8tTC4-N4mE2l6HtOG0vbc,2405
|
|
13
|
+
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
14
|
+
easycoder/ec_value.py,sha256=7yJovn24pPC3jrURSQyEvZ8m826fXiqxsCpSvxwNrfQ,2403
|
|
15
|
+
easycoder-250106.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
16
|
+
easycoder-250106.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
+
easycoder-250106.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
|
18
|
+
easycoder-250106.2.dist-info/METADATA,sha256=zAk-MboXzmDC4mNTpacn7_TKUu0ivHKTclgdJEg0jdI,5817
|
|
19
|
+
easycoder-250106.2.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
easycoder/README.md,sha256=PYqOc_SkIGiFbyCNs90y7JqoqWe4aO1xYIW-6bOnFKU,573
|
|
2
|
-
easycoder/__init__.py,sha256=owNA7S9z8wlR3KRxJytrzPU-s4ngA04Xq8_EUinKwK8,283
|
|
3
|
-
easycoder/ec.py,sha256=Nj5PRl8GsKjfGJKq0FOM1a7FeK3cN68CoIFg8lswQEg,221
|
|
4
|
-
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
5
|
-
easycoder/ec_compiler.py,sha256=_xBh2L47mz_WOMYdruMYSHyyz2wfh7Hf28q559AWVSU,4781
|
|
6
|
-
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
7
|
-
easycoder/ec_core.py,sha256=5woFkLx9divJomakFyeexmhqJeEPI1hUlzyB3MlAruI,86359
|
|
8
|
-
easycoder/ec_graphics.py,sha256=ylkdEOo04g8aOeY9xB1V9mf3aZWkoIUt-caXivuVje4,16427
|
|
9
|
-
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
10
|
-
easycoder/ec_program.py,sha256=sdVPc1c8urLn5icov-NVyNkc78UR930ipDDONlZTge8,9831
|
|
11
|
-
easycoder/ec_renderer.py,sha256=oZ56OyJojQq-2ZPlVMFOrEyG_vj91D4yv9Nd5m92RQA,8031
|
|
12
|
-
easycoder/ec_screenspec.py,sha256=TeXgccfYoE--r7Rf9t9drV1V3fU-p-iBnZwtjHzIh8M,2524
|
|
13
|
-
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
14
|
-
easycoder/ec_value.py,sha256=KkSIxAum-bnb_qnaRgS1UiVUg_-khVPQrrEPiSXjQs4,2382
|
|
15
|
-
easycoder-250105.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
16
|
-
easycoder-250105.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
-
easycoder-250105.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
18
|
-
easycoder-250105.1.dist-info/METADATA,sha256=hm-vw2r4-nH5eaa8ouO0Qpdx9nyeNFK60iXwS41GDxg,5817
|
|
19
|
-
easycoder-250105.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|