easycoder 250109.2__py2.py3-none-any.whl → 250110.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 CHANGED
@@ -10,4 +10,4 @@ from .ec_program import *
10
10
  from .ec_timestamp import *
11
11
  from .ec_value import *
12
12
 
13
- __version__ = "250109.2"
13
+ __version__ = "250110.1"
easycoder/ec_renderer.py CHANGED
@@ -9,8 +9,6 @@ from kivy.clock import Clock
9
9
  from kivy.vector import Vector
10
10
  import math, os
11
11
 
12
- os.environ['KIVY_TEXT'] = 'pango'
13
-
14
12
  ec_ui = None
15
13
 
16
14
  def getUI():
@@ -108,53 +106,54 @@ class UI(Widget):
108
106
  self.zlist.append(element)
109
107
 
110
108
  def createElement(self, spec):
111
- with self.canvas:
112
- if hasattr(spec, 'fill'):
113
- c = spec.fill
114
- if isinstance(c, str):
115
- c = colormap[c]
116
- Color(c[0], c[1], c[2])
117
- else:
118
- Color(c[0]/255, c[1]/255, c[2]/255)
119
- size = (getActual(spec.size[0], spec), getActual(spec.size[1], spec))
120
- spec.realsize = size
121
- # Deal with special case of 'center'
122
- if spec.pos[0] == 'center':
123
- left = getActual('50w', spec) - spec.realsize[0]/2
124
- else:
125
- left = getActual(spec.pos[0], spec)
126
- if spec.pos[1] == 'center':
127
- bottom = getActual('50h', spec) - spec.realsize[1]/2
128
- else:
129
- bottom = getActual(spec.pos[1], spec)
130
- pos = (left, bottom)
131
- spec.realpos = pos
132
- if spec.parent != None:
133
- pos = Vector(pos) + spec.parent.realpos
134
- if spec.type == 'ellipse':
135
- item = Ellipse(pos=pos, size=size)
136
- elif spec.type == 'rectangle':
137
- item = Rectangle(pos=pos, size=size)
138
- elif spec.type == 'text':
139
- if hasattr(spec, 'color'):
140
- c = spec.color
109
+ size = (getActual(spec.size[0], spec), getActual(spec.size[1], spec))
110
+ spec.realsize = size
111
+ # Deal with special case of 'center'
112
+ if spec.pos[0] == 'center':
113
+ left = getActual('50w', spec) - spec.realsize[0]/2
114
+ else:
115
+ left = getActual(spec.pos[0], spec)
116
+ if spec.pos[1] == 'center':
117
+ bottom = getActual('50h', spec) - spec.realsize[1]/2
118
+ else:
119
+ bottom = getActual(spec.pos[1], spec)
120
+ pos = (left, bottom)
121
+ spec.realpos = pos
122
+ if spec.parent != None:
123
+ pos = Vector(pos) + spec.parent.realpos
124
+ if spec.type != 'hotspot':
125
+ with self.canvas:
126
+ if hasattr(spec, 'fill'):
127
+ c = spec.fill
141
128
  if isinstance(c, str):
142
129
  c = colormap[c]
143
130
  Color(c[0], c[1], c[2])
144
131
  else:
145
132
  Color(c[0]/255, c[1]/255, c[2]/255)
146
- else:
147
- Color(1, 1, 1, 1)
148
- if self.font == None:
149
- label = CoreLabel(text=spec.text, font_size=1000, halign='center', valign='center')
150
- else:
151
- label = CoreLabel(text=spec.text, font_context = None, font_name=self.font, font_size=1000, halign='center', valign='center')
152
- label.refresh()
153
- item = Rectangle(pos=pos, size=size, texture=label.texture)
154
- elif spec.type == 'image':
155
- item = AsyncImage(pos=pos, size=size, source=spec.source)
156
- spec.item = item
157
- self.addElement(spec.id, spec)
133
+ if spec.type == 'ellipse':
134
+ item = Ellipse(pos=pos, size=size)
135
+ elif spec.type == 'rectangle':
136
+ item = Rectangle(pos=pos, size=size)
137
+ elif spec.type == 'text':
138
+ if hasattr(spec, 'color'):
139
+ c = spec.color
140
+ if isinstance(c, str):
141
+ c = colormap[c]
142
+ Color(c[0], c[1], c[2])
143
+ else:
144
+ Color(c[0]/255, c[1]/255, c[2]/255)
145
+ else:
146
+ Color(1, 1, 1, 1)
147
+ if self.font == None:
148
+ label = CoreLabel(text=spec.text, font_size=1000, halign='center', valign='center')
149
+ else:
150
+ label = CoreLabel(text=spec.text, font_context = None, font_name=self.font, font_size=1000, halign='center', valign='center')
151
+ label.refresh()
152
+ item = Rectangle(pos=pos, size=size, texture=label.texture)
153
+ elif spec.type == 'image':
154
+ item = AsyncImage(pos=pos, size=size, source=spec.source)
155
+ spec.item = item
156
+ self.addElement(spec.id, spec)
158
157
 
159
158
  def moveElementBy(self, id, dist):
160
159
  element = self.getElement(id)
@@ -185,19 +184,19 @@ class UI(Widget):
185
184
  for element in reversed(self.zlist):
186
185
  if element.actionCB != None:
187
186
  spec = element.spec
188
- pos = spec.realpos
187
+ pos = element.getPos()
189
188
  size = element.getSize()
190
189
  if spec.type == 'ellipse':
191
190
  a = int(size[0])/2
192
191
  b = int(size[1])/2
193
- ctr = (pos[0] + a, pos[1] +b)
192
+ ctr = (pos[0]+a, pos[1]+b)
194
193
  h = ctr[0]
195
194
  k = ctr[1]
196
195
  if (math.pow((x - h), 2) / math.pow(a, 2)) + (math.pow((y - k), 2) / math.pow(b, 2)) <= 1:
197
196
  element.actionCB(element.data)
198
197
  break
199
- elif spec.type in ['rectangle', 'text', 'image']:
200
- if tp[0] >= pos[0] and tp[0] < pos[0] + size[0] and tp[1] >= pos[1] and tp[1] < pos[1] + size[1]:
198
+ elif spec.type in ['rectangle', 'text', 'image', 'hotspot']:
199
+ if x >= pos[0] and x < pos[0] + size[0] and y >= pos[1] and y < pos[1] + size[1]:
201
200
  element.actionCB(element.data)
202
201
  break
203
202
 
@@ -58,16 +58,16 @@ class ScreenSpec():
58
58
 
59
59
  # Render a complete specification
60
60
  def renderSpec(self, spec, parent):
61
- if 'font' in spec: getUI().font = spec['font']
62
- else: getUI().font = None
63
- widgets = spec['#']
64
- # If a list, iterate it
65
- if isinstance(widgets, list):
66
- for widget in widgets:
67
- self.createWidget(spec[widget], parent)
68
- # Otherwise, process the single widget
61
+ if 'type' in spec: self.createWidget(spec, parent)
69
62
  else:
70
- self.createWidget(spec[widgets], parent)
63
+ widgets = spec['#']
64
+ # If a list, iterate it
65
+ if isinstance(widgets, list):
66
+ for widget in widgets:
67
+ self.createWidget(spec[widget], parent)
68
+ # Otherwise, process the single widget
69
+ else:
70
+ self.createWidget(spec[widgets], parent)
71
71
 
72
72
  # Render a graphic specification
73
73
  def render(self, spec, parent):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: easycoder
3
- Version: 250109.2
3
+ Version: 250110.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>
@@ -12,7 +12,8 @@ Project-URL: Home, https://github.com/easycoder/easycoder-py
12
12
  # Introduction
13
13
  **_EasyCoder_** is a high-level English-like scripting language suited for prototyping and rapid testing of ideas. It operates on the command line and a graphics module is under construction. This version of the language is written in Python and it acts as a fairly thin wrapper around Python functions, giving fast compilation and good runtime performance for general applications.
14
14
  <hr>
15
- For the JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser, please visit
15
+
16
+ There is also a JavaScript version of **_EasyCoder_**, which provides a full set of graphical features to run in a browser. For this, please visit
16
17
 
17
18
  Repository: [https://github.com/easycoder/easycoder.github.io](https://github.com/easycoder/easycoder.github.io)
18
19
  Website: [https://easycoder.github.io](https://easycoder.github.io)
@@ -23,6 +24,8 @@ Install **_EasyCoder_** in your Python environment:
23
24
  ```
24
25
  pip install easycoder
25
26
  ```
27
+ You may also need to install `pytz`, as some commands need it.
28
+
26
29
  Write a test script, 'hello.ecs', containing the following:
27
30
  ```
28
31
  print `Hello, world!`
@@ -30,28 +33,27 @@ print `Hello, world!`
30
33
  This is traditionally the first program to be written in virtually any language. To run it, use `easycoder hello.ecs`.
31
34
 
32
35
  The output will look like this (the version number will differ):
33
-
34
36
  ```
35
37
  EasyCoder version 250101.1
36
38
  Compiled <anon>: 1 lines (2 tokens) in 0 ms
37
39
  Run <anon>
38
40
  1-> Hello, world!
39
41
  ```
40
- It's conventional to add a program title to a script:
41
42
 
43
+ It's conventional to add a program title to a script:
42
44
  ```
43
45
  ! Test script
44
46
  script Test
45
47
  print `Hello, world!`
46
48
  ```
47
49
  The first line here is just a comment and has no effect on the running of the script. The second line gives the script a name, which is useful in debugging as it says which script was running. When run, the output is now
48
-
49
50
  ```
50
51
  EasyCoder version 250101.1
51
52
  Compiled Test: 3 lines (4 tokens) in 0 ms
52
53
  Run Test
53
54
  3-> Hello, world!
54
55
  ```
56
+
55
57
  As you might guess from the above, the print command shows the line in the script it was called from. This is very useful in tracking down debugging print commands in large scripts.
56
58
 
57
59
  Here in the repository is a folder called `scripts` containing some sample scripts:
@@ -65,13 +67,15 @@ Here in the repository is a folder called `scripts` containing some sample scrip
65
67
 
66
68
  Graphical scripts look much like any other script but their file names must use the extension `.ecg` to signal to **_EasyCoder_** that it needs to load the graphics module. Non-graphical applications can use any extension but `.ecs` is recommended. This allows the **_EasyCoder_** application to be used wherever Python is installed, in either a command-line or a graphical environment, but graphics will of course not be available in the former.
67
69
 
68
- A couple of demo graphical scripts are included in the `scripts` directory:
70
+ Some demo graphical scripts are included in the `scripts` directory:
69
71
 
70
72
  `graphics-demo.ecg` shows some of the elements that can be created, and demonstrates a variety of the graphical features of the language such as detecting when elements are clicked.
71
73
 
72
74
  `wave.ecg` is a "Mexican Wave" simulation.
73
75
 
74
- **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **_EasyCoder_** environment, in other Python programs.
76
+ `keyboard.ecg` creates an on-screen keyboard (currently a 4-function calculator keypad) that responds to clicks on its keys. It uses a plugin module (see below) to add extra vocabulary and syntax to the language. This is currently under development so its features are likely to change. The intention is to support a wide range of keyboard styles with the minimum mount of coding. The plugin (`ec_keyword.py`) can be downloaded from the repository.
77
+
78
+ **_EasyCoder_** graphics are handled by a library module, `ec_renderer` that can be used outside of the **_EasyCoder_** environment, in other Python programs. The renderer works with JSON-formatted specifications of the itens to be displayed.
75
79
 
76
80
  ## Significant features
77
81
 
@@ -1,5 +1,5 @@
1
1
  easycoder/README.md,sha256=PYqOc_SkIGiFbyCNs90y7JqoqWe4aO1xYIW-6bOnFKU,573
2
- easycoder/__init__.py,sha256=IErx-lbecKTrIN5Hym-iAL4hyckfBU2Dv9jyVVyEjvQ,283
2
+ easycoder/__init__.py,sha256=KEoZyN1TYD3a0J2QGu_x1QXg9HkZyzBkMQedeTXIxvg,283
3
3
  easycoder/ec.py,sha256=Nj5PRl8GsKjfGJKq0FOM1a7FeK3cN68CoIFg8lswQEg,221
4
4
  easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
5
5
  easycoder/ec_compiler.py,sha256=f3zZRtbNsegBuRHTvTLK8BOdnuRq5p_p-1vtJYb-LiY,4800
@@ -8,12 +8,12 @@ easycoder/ec_core.py,sha256=71rSNOwMrO0Ik1hdgTshOYRo2XVD0Br7gUZfCR7A0OA,86291
8
8
  easycoder/ec_graphics.py,sha256=uH_8NK8PGoSYl5POgLMgDlwMw5l1ayrPV7CBXn26Fos,18486
9
9
  easycoder/ec_handler.py,sha256=IJvxcrJJSR53d6DS_8H5qPHKhp9y5-GV4WXAjhZxu_o,2250
10
10
  easycoder/ec_program.py,sha256=u51FxCnarubxwoAfREnqGMHf2YL7zaWnH9Gs8XUWmJ4,9843
11
- easycoder/ec_renderer.py,sha256=yqLfXjCed1oFyFH0uzN6ffu1hot59vYx7yr1Sv7E_Uo,9225
12
- easycoder/ec_screenspec.py,sha256=nhWuUJ4Jvew0iKmcfkTY-7EIvAWIwXWwrqub6aW4N3c,2609
11
+ easycoder/ec_renderer.py,sha256=I3fPEHkW3hFPmKqzz8RoNV5-xmp1siq7b06Sw8dtt9M,9281
12
+ easycoder/ec_screenspec.py,sha256=PnAJWDDJT0FcU8JxcjXiBd7A8aFCfaLyEKYdj3rRUP4,2625
13
13
  easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
14
14
  easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
15
- easycoder-250109.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
- easycoder-250109.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- easycoder-250109.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
18
- easycoder-250109.2.dist-info/METADATA,sha256=UsHVHoqqJvWVgxQfP1kKtUIkSlMXrCSIgs25vy1npbw,5817
19
- easycoder-250109.2.dist-info/RECORD,,
15
+ easycoder-250110.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
+ easycoder-250110.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ easycoder-250110.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
18
+ easycoder-250110.1.dist-info/METADATA,sha256=idcvzsOLbA0YUi0JicPSvRkztSTePhMKxeES9Q1p2js,6426
19
+ easycoder-250110.1.dist-info/RECORD,,