easycoder 241218.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.

@@ -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.isnumeric():
87
- val = eval(token)
88
- if isinstance(val, int):
89
- value['type'] = 'int'
90
- value['content'] = val
91
- return value
92
- if isinstance(val, float):
93
- value['type'] = 'float'
94
- value['content'] = val
95
- return value
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: 241218.1
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>
@@ -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=k7jfdc4pthQcQKvNzXXUQGWfqAU8_YxU1NXjra0hOsE,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=w3qf-CZlnA-jKcflT8PPzX7NUDJkqrl8w692-rwU3Y8,12122
10
- easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
11
- easycoder/ec_value.py,sha256=aOvSF6bM1iKpcLLm0zyGerxHixBkyjE3iYl1Bx6jmzU,2381
12
- easycoder-241218.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
13
- easycoder-241218.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
14
- easycoder-241218.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
15
- easycoder-241218.1.dist-info/METADATA,sha256=ooonquwbm7yneNnmOFldtcEYhHMxyXyUwCanVjXYRnE,4098
16
- easycoder-241218.1.dist-info/RECORD,,