easycoder 241215.1__py2.py3-none-any.whl → 241227.1__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 +2 -2
- easycoder/ec.py +10 -0
- easycoder/ec_classes.py +3 -0
- easycoder/ec_compiler.py +7 -6
- easycoder/ec_core.py +4 -2
- easycoder/ec_graphics.py +234 -239
- easycoder/ec_handler.py +1 -0
- easycoder/ec_program.py +26 -28
- easycoder/ec_renderer.py +176 -321
- easycoder/ec_screenspec.py +78 -0
- easycoder/ec_value.py +10 -10
- {easycoder-241215.1.dist-info → easycoder-241227.1.dist-info}/METADATA +3 -3
- easycoder-241227.1.dist-info/RECORD +18 -0
- easycoder-241215.1.dist-info/RECORD +0 -16
- {easycoder-241215.1.dist-info → easycoder-241227.1.dist-info}/LICENSE +0 -0
- {easycoder-241215.1.dist-info → easycoder-241227.1.dist-info}/WHEEL +0 -0
- {easycoder-241215.1.dist-info → easycoder-241227.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# screenspec.py
|
|
2
|
+
|
|
3
|
+
from json import loads
|
|
4
|
+
from .ec_renderer import Object
|
|
5
|
+
|
|
6
|
+
class ScreenSpec():
|
|
7
|
+
|
|
8
|
+
# Get an attribute of an element
|
|
9
|
+
def getAttribute(self, id, attribute):
|
|
10
|
+
element = self.ui.getElement(id)
|
|
11
|
+
return element[attribute]
|
|
12
|
+
|
|
13
|
+
# Render a single widget
|
|
14
|
+
def createWidget(self, widget, parent):
|
|
15
|
+
spec = Object()
|
|
16
|
+
type = widget['type']
|
|
17
|
+
spec.type = type
|
|
18
|
+
spec.id = widget['id']
|
|
19
|
+
spec.pos = (widget['left'], widget['bottom'])
|
|
20
|
+
spec.size = (widget['width'], widget['height'])
|
|
21
|
+
if widget.get('fill') != None:
|
|
22
|
+
spec.fill = widget['fill']
|
|
23
|
+
if widget.get('text') != None:
|
|
24
|
+
spec.text = widget['text']
|
|
25
|
+
if widget.get('fontSize') != None:
|
|
26
|
+
spec.fontSize = widget['fontSize']
|
|
27
|
+
if widget.get('source') != None:
|
|
28
|
+
spec.source = widget['source']
|
|
29
|
+
if widget.get('color') != None:
|
|
30
|
+
spec.color = widget['color']
|
|
31
|
+
spec.parent = parent
|
|
32
|
+
spec.children = []
|
|
33
|
+
self.ui.createElement(spec)
|
|
34
|
+
|
|
35
|
+
if '#' in widget:
|
|
36
|
+
children = widget['#']
|
|
37
|
+
if isinstance(children, list):
|
|
38
|
+
for item in children:
|
|
39
|
+
if item in widget:
|
|
40
|
+
child = widget[item]
|
|
41
|
+
childSpec = self.createWidget(child, spec)
|
|
42
|
+
spec.children.append(childSpec.id)
|
|
43
|
+
else:
|
|
44
|
+
raise Exception(f'Child \'{item}\' is missing')
|
|
45
|
+
else:
|
|
46
|
+
child = widget[children]
|
|
47
|
+
childSpec = self.createWidget(child, spec)
|
|
48
|
+
spec.children.append(childSpec.id)
|
|
49
|
+
|
|
50
|
+
return spec
|
|
51
|
+
|
|
52
|
+
# Render a complete specification
|
|
53
|
+
def renderSpec(self, spec, parent):
|
|
54
|
+
widgets = spec['#']
|
|
55
|
+
# If a list, iterate it
|
|
56
|
+
if isinstance(widgets, list):
|
|
57
|
+
for widget in widgets:
|
|
58
|
+
self.createWidget(spec[widget], parent)
|
|
59
|
+
# Otherwise, process the single widget
|
|
60
|
+
else:
|
|
61
|
+
self.createWidget(spec[widgets], parent)
|
|
62
|
+
|
|
63
|
+
# Render a graphic specification
|
|
64
|
+
def render(self, spec, ui):
|
|
65
|
+
self.ui = ui
|
|
66
|
+
|
|
67
|
+
# If it'a string, process it
|
|
68
|
+
if isinstance(spec, str):
|
|
69
|
+
self.renderSpec(loads(spec), None)
|
|
70
|
+
|
|
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
|
+
else:
|
|
77
|
+
raise Exception('Spec is an unknown type')
|
|
78
|
+
|
easycoder/ec_value.py
CHANGED
|
@@ -83,16 +83,16 @@ class Value:
|
|
|
83
83
|
|
|
84
84
|
def compileConstant(self, token):
|
|
85
85
|
value = {}
|
|
86
|
-
if token
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
if type(token) == 'str':
|
|
87
|
+
token = eval(token)
|
|
88
|
+
if isinstance(token, int):
|
|
89
|
+
value['type'] = 'int'
|
|
90
|
+
value['content'] = token
|
|
91
|
+
return value
|
|
92
|
+
if isinstance(token, float):
|
|
93
|
+
value['type'] = 'float'
|
|
94
|
+
value['content'] = token
|
|
95
|
+
return value
|
|
96
96
|
value['type'] = 'text'
|
|
97
97
|
value['content'] = token
|
|
98
98
|
return value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 241227.1
|
|
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>
|
|
@@ -62,7 +62,7 @@ Here in the repository is a folder called `scripts` containing some sample scrip
|
|
|
62
62
|
## Graphical programmming
|
|
63
63
|
**_EasyCoder_** is currently being extended to include a graphical programming environment. A single demo script `graphics-demo.ecs` is included in the `scripts` directory. To run it, first install the Python graphics library if it's not already present on your system. On Linux this is done with `sudo apt install python3-tk`. On Windows it's `pip install tk`. Then give the command `easycoder -g scripts/graphics-demo.ecs`.
|
|
64
64
|
|
|
65
|
-
As development progresses this demo script will be extended to include new features as they are added. **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **
|
|
65
|
+
As development progresses this demo script will be extended to include new features as they are added. **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **_EasyCoder_** environment, in other Python programs.
|
|
66
66
|
|
|
67
67
|
## EasyCoder programming reference
|
|
68
68
|
|
|
@@ -74,5 +74,5 @@ The language comprises a general-purpose core package, which can be enhanced by
|
|
|
74
74
|
|
|
75
75
|
**_EasyCoder_** can be extended to add new functionality with the use of 'plugins'. These contain compiler and runtime modules for the added language features. **_EasyCoder_** can use the added keywords, values and conditions freely; the effect is completely seamless. There is an outline example in the `plugins` directory called `example.py`, which comprises a module called `Points` with new language syntax to deal with two-valued items such as coordinates. In the `scripts` directory there is `points.ecs`, which exercises the new functionality.
|
|
76
76
|
|
|
77
|
-
A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in **_EasyCoder_
|
|
77
|
+
A plugin can act as a wrapper around any Python functionality that has a sensible API, thereby hiding its complexity. The only challenge is to devise an unambiguous syntax that doesn't clash with anything already existing in **_EasyCoder_**.
|
|
78
78
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
easycoder/__init__.py,sha256=l4J8ZzYaQ2L6tojyFFqc47eck2zDXoR8sUqlCyvanBs,283
|
|
2
|
+
easycoder/ec.py,sha256=Nj5PRl8GsKjfGJKq0FOM1a7FeK3cN68CoIFg8lswQEg,221
|
|
3
|
+
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
+
easycoder/ec_compiler.py,sha256=2r6Nk7px9UMYqIpYc6dAbYOAFu-CoWPy-iqlsed49Lo,4690
|
|
5
|
+
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
6
|
+
easycoder/ec_core.py,sha256=Q-E2TX_yn9OhdV6HvUzYgiKX9fEQ_ro1-VxSQ5Xl-4Y,76508
|
|
7
|
+
easycoder/ec_graphics.py,sha256=Sy1seMMEZ5KmkDKPhTKIkoGjXl5loYArvAS2YpdsFH8,13347
|
|
8
|
+
easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
|
|
9
|
+
easycoder/ec_program.py,sha256=j3eveYucPQX6E1flDwf1OpkPCh9OtDri88z8baXjvqI,8062
|
|
10
|
+
easycoder/ec_renderer.py,sha256=UZk-VSyN4But0fRTs7wUnPwRGrCF6XA7LxhPxgZaYgU,5705
|
|
11
|
+
easycoder/ec_screenspec.py,sha256=gmYYi0Q6S2qSQzCW0lMPB61EC7ZZ1mNQX8B1knxrTCg,2525
|
|
12
|
+
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
13
|
+
easycoder/ec_value.py,sha256=XIBtGhcCgh1abrzAn-Wy4l_xH_3cTWakMVIiSlBAZjM,2386
|
|
14
|
+
easycoder-241227.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
15
|
+
easycoder-241227.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
+
easycoder-241227.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
17
|
+
easycoder-241227.1.dist-info/METADATA,sha256=-1vKmMw26mJSHmztn_O049rpIJqAgJ4OQWPC-lDO9ms,4098
|
|
18
|
+
easycoder-241227.1.dist-info/RECORD,,
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=aW_U1vTxPggcn2FkBFYhEwPI9qsf4KZPbV2hNZk24B4,289
|
|
2
|
-
easycoder/ec_classes.py,sha256=mRvIk2d-yc20u54oX8fauKeYy-z_g30Otbl-dn5O6T4,1486
|
|
3
|
-
easycoder/ec_compiler.py,sha256=s7M3Jl6z0X_tp-QW4p3v7ac2fhL_bf0uw1GHebqt1Ug,4638
|
|
4
|
-
easycoder/ec_condition.py,sha256=WSbONo4zs2sX1icOVpscZDFSCAEFmTsquoc2RGcLx_k,763
|
|
5
|
-
easycoder/ec_core.py,sha256=NfXNTyxmsU4_f3JTTFMUzgsfCRL9se8rdVfwqBC_1wM,76452
|
|
6
|
-
easycoder/ec_graphics.py,sha256=qHkZkpT5WM0Y-vHXXLoiqGGS_1qWiajKBYqS1MRSicA,12786
|
|
7
|
-
easycoder/ec_handler.py,sha256=WDDIz0awD3vSQZ149rgbUWsClt6zXqED8ByXQJ5p1Ds,2200
|
|
8
|
-
easycoder/ec_program.py,sha256=MHPHEYHoU5zUVsnkL30kyUxtFph-8naVlDGN2hHsKpw,8103
|
|
9
|
-
easycoder/ec_renderer.py,sha256=SiKmUg5SWjlquscZt7UwD6EFlYLZWORmzMl5FrNz7u0,12082
|
|
10
|
-
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
11
|
-
easycoder/ec_value.py,sha256=aOvSF6bM1iKpcLLm0zyGerxHixBkyjE3iYl1Bx6jmzU,2381
|
|
12
|
-
easycoder-241215.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
13
|
-
easycoder-241215.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
-
easycoder-241215.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
15
|
-
easycoder-241215.1.dist-info/METADATA,sha256=J5XUm0EhpR-bLU1FizskpkVt1F4ZyHUHHmeuug71iAQ,4096
|
|
16
|
-
easycoder-241215.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|