easycoder 250106.14__tar.gz → 250107.2__tar.gz
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-250106.14 → easycoder-250107.2}/PKG-INFO +1 -1
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/__init__.py +1 -1
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_graphics.py +15 -6
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_renderer.py +50 -53
- {easycoder-250106.14 → easycoder-250107.2}/scripts/wave.ecg +2 -0
- {easycoder-250106.14 → easycoder-250107.2}/LICENSE +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/boolean.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/empty.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/ends.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/even.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/exists.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/greater.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/hasProperty.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/includes.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/is.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/less.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/list.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/none.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/not.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/numeric.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/object.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/odd.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/starts.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/conditions/string.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/add.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/append.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/assert.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/begin.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/clear.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/close.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/create.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/debug.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/decrement.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/delete.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/divide.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/exit.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/file.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/fork.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/get.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/go.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/gosub.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/if.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/import.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/increment.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/index.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/init.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/input.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/load.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/lock.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/module.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/multiply.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/negate.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/open.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/pop.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/post.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/print.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/push.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/put.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/read.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/release.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/replace.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/return.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/run.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/save.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/script.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/set.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/split.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/stack.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/stop.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/system.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/take.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/toggle.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/truncate.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/unlock.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/variable.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/wait.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/while.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/keywords/write.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/arg.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/args.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/cos.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/datime.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/decode.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/element.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/elements.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/empty.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/encode.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/error.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/files.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/float.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/from.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/hash.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/index.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/integer.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/json.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/keys.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/left.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/length.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/lowercase.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/memory.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/modification.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/modulo.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/newline.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/now.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/position.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/property.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/random.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/right.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/sin.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/stringify.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/tab.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/tan.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/timestamp.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/today.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/trim.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/type.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/uppercase.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/value.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/core/values/weekday.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/attach.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/close.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/create.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/ellipse.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/image.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/move.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/on.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/rectangle.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/render.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/run.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/set.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/keywords/text.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/values/attribute.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/doc/graphics/values/window.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_classes.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_compiler.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_condition.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_core.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_handler.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_program.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_screenspec.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_timestamp.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/easycoder/ec_value.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/images/Semoigo Dawn.jpg +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/json/graphics-demo.json +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/plugins/ec_p100.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/plugins/example.py +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/pyproject.toml +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/README.md +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/benchmark.ecs +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/fizzbuzz.ecs +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/graphics-demo.ecg +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/hello.ecs +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/points.ecs +0 -0
- {easycoder-250106.14 → easycoder-250107.2}/scripts/tests.ecs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250107.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>
|
|
@@ -32,12 +32,12 @@ class Graphics(Handler):
|
|
|
32
32
|
targetRecord = self.getVariable(command['name'])
|
|
33
33
|
keyword = targetRecord['keyword']
|
|
34
34
|
id = self.getRuntimeValue(command['id'])
|
|
35
|
-
|
|
36
|
-
if
|
|
35
|
+
uiElement = self.ui.getElement(id)
|
|
36
|
+
if uiElement == None:
|
|
37
37
|
FatalError(self.program.compiler, f'There is no screen element with id \'{id}\'')
|
|
38
38
|
return -1
|
|
39
|
-
if
|
|
40
|
-
etype =
|
|
39
|
+
if uiElement.getType() != keyword:
|
|
40
|
+
etype = uiElement['type']
|
|
41
41
|
FatalError(self.program.compiler, f'Mismatched element type: "{etype}" and "{keyword}"')
|
|
42
42
|
self.putSymbolValue(targetRecord, {'type': 'text', 'content': id})
|
|
43
43
|
return self.nextPC()
|
|
@@ -265,6 +265,7 @@ class Graphics(Handler):
|
|
|
265
265
|
self.ui.moveElementBy(self.getRuntimeValue(command['target']), dist)
|
|
266
266
|
return self.nextPC()
|
|
267
267
|
|
|
268
|
+
# on click/tap {element} {action}
|
|
268
269
|
def k_on(self, command):
|
|
269
270
|
token = self.nextToken()
|
|
270
271
|
if token in ['click', 'tap']:
|
|
@@ -298,14 +299,22 @@ class Graphics(Handler):
|
|
|
298
299
|
return True
|
|
299
300
|
return False
|
|
300
301
|
|
|
302
|
+
# Set a handler on every element
|
|
301
303
|
def r_on(self, command):
|
|
302
304
|
pc = command['goto']
|
|
303
305
|
if command['type'] == 'tap':
|
|
304
306
|
record = self.getVariable(command['target'])
|
|
307
|
+
def oncb(data):
|
|
308
|
+
record['index'] = data.index
|
|
309
|
+
self.run(data.pc)
|
|
305
310
|
keyword = record['keyword']
|
|
306
311
|
if self.isGraphicType(keyword):
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
for index in range(0, record['elements']):
|
|
313
|
+
id = record['value'][index]['content']
|
|
314
|
+
data = Object()
|
|
315
|
+
data.pc = pc
|
|
316
|
+
data.index = index
|
|
317
|
+
self.ui.setOnClick(id, data, oncb)
|
|
309
318
|
else:
|
|
310
319
|
name = record['name']
|
|
311
320
|
RuntimeError(self.program, f'{name} is not a clickable object')
|
|
@@ -9,14 +9,39 @@ from kivy.clock import Clock
|
|
|
9
9
|
from kivy.vector import Vector
|
|
10
10
|
import math
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
# Get a real position or size value
|
|
13
|
+
# These are {n}w/h, where w/h are percentages
|
|
14
|
+
# e.g. 25w or 50h
|
|
15
|
+
def getReal(spec, val):
|
|
16
|
+
if isinstance(val, str):
|
|
17
|
+
c = val[-1]
|
|
18
|
+
if c in ['w', 'h']:
|
|
19
|
+
val = int(val[0:len(val)-1])
|
|
20
|
+
if spec.parent == None:
|
|
21
|
+
if c == 'w':
|
|
22
|
+
n = Window.width
|
|
23
|
+
else:
|
|
24
|
+
n = Window.height
|
|
25
|
+
else:
|
|
26
|
+
if c == 'w':
|
|
27
|
+
n = spec.parent.realsize[0]
|
|
28
|
+
else:
|
|
29
|
+
n = spec.parent.realsize[1]
|
|
30
|
+
return val * n / 100
|
|
31
|
+
return val
|
|
14
32
|
|
|
15
33
|
class Element():
|
|
16
34
|
|
|
17
35
|
def __init__(self, type, spec):
|
|
18
36
|
self.type = type
|
|
19
37
|
self.spec = spec
|
|
38
|
+
self.actionCB = None
|
|
39
|
+
|
|
40
|
+
def getRelativePosition(self):
|
|
41
|
+
spec = self.spec
|
|
42
|
+
x = getReal(spec, spec.pos[0])
|
|
43
|
+
y = getReal(spec, spec.pos[1])
|
|
44
|
+
return Vector(x, y)
|
|
20
45
|
|
|
21
46
|
def getType(self):
|
|
22
47
|
return self.spec.type
|
|
@@ -24,37 +49,25 @@ class Element():
|
|
|
24
49
|
def getID(self):
|
|
25
50
|
return self.spec.id
|
|
26
51
|
|
|
27
|
-
def getRealPos(self):
|
|
28
|
-
spec = self.spec
|
|
29
|
-
pos = spec.realpos
|
|
30
|
-
if spec.parent != None:
|
|
31
|
-
pos = Vector(pos) + spec.parent.realpos
|
|
32
|
-
return pos
|
|
33
|
-
|
|
34
52
|
def getPos(self):
|
|
35
53
|
spec = self.spec
|
|
36
|
-
pos = spec.
|
|
54
|
+
pos = spec.realpos
|
|
37
55
|
if spec.parent != None:
|
|
38
|
-
pos =
|
|
56
|
+
pos = self.getRelativePosition() + spec.parent.realpos
|
|
39
57
|
return pos
|
|
40
58
|
|
|
41
59
|
def setPos(self, pos):
|
|
60
|
+
# Update the spec
|
|
42
61
|
self.spec.realpos = pos
|
|
62
|
+
# Update the displayed item
|
|
43
63
|
self.spec.item.pos = pos
|
|
44
64
|
|
|
45
|
-
# Called when the parent moves
|
|
46
|
-
def repos(self):
|
|
47
|
-
spec = self.spec
|
|
48
|
-
spec.item.pos = Vector(spec.realpos) + spec.parent.realpos
|
|
49
|
-
|
|
50
|
-
def getRealSize(self):
|
|
51
|
-
return self.spec.realsize
|
|
52
|
-
|
|
53
65
|
def getSize(self):
|
|
54
|
-
return self.spec.
|
|
66
|
+
return self.spec.realsize
|
|
55
67
|
|
|
56
68
|
def setSize(self, size):
|
|
57
|
-
self.spec.
|
|
69
|
+
self.spec.realsize = size
|
|
70
|
+
self.spec.item.size = size
|
|
58
71
|
|
|
59
72
|
def getChildren(self):
|
|
60
73
|
return self.spec.children
|
|
@@ -78,25 +91,6 @@ class UI(Widget):
|
|
|
78
91
|
self.zlist.append(element)
|
|
79
92
|
|
|
80
93
|
def createElement(self, spec):
|
|
81
|
-
# Get a real position or size value
|
|
82
|
-
def getReal(val):
|
|
83
|
-
if isinstance(val, str):
|
|
84
|
-
c = val[-1]
|
|
85
|
-
if c in ['w', 'h']:
|
|
86
|
-
val = int(val[0:len(val)-1])
|
|
87
|
-
if spec.parent == None:
|
|
88
|
-
if c == 'w':
|
|
89
|
-
n = Window.width
|
|
90
|
-
else:
|
|
91
|
-
n = Window.height
|
|
92
|
-
else:
|
|
93
|
-
if c == 'w':
|
|
94
|
-
n = spec.parent.realsize[0]
|
|
95
|
-
else:
|
|
96
|
-
n = spec.parent.realsize[1]
|
|
97
|
-
return val * n / 100
|
|
98
|
-
return val
|
|
99
|
-
|
|
100
94
|
with self.canvas:
|
|
101
95
|
if hasattr(spec, 'fill'):
|
|
102
96
|
c = spec.fill
|
|
@@ -105,9 +99,9 @@ class UI(Widget):
|
|
|
105
99
|
Color(c[0], c[1], c[2])
|
|
106
100
|
else:
|
|
107
101
|
Color(c[0]/255, c[1]/255, c[2]/255)
|
|
108
|
-
pos = (getReal(spec.pos[0]), getReal(spec.pos[1]))
|
|
102
|
+
pos = (getReal(spec, spec.pos[0]), getReal(spec, spec.pos[1]))
|
|
109
103
|
spec.realpos = pos
|
|
110
|
-
size = (getReal(spec.size[0]), getReal(spec.size[1]))
|
|
104
|
+
size = (getReal(spec, spec.size[0]), getReal(spec, spec.size[1]))
|
|
111
105
|
spec.realsize = size
|
|
112
106
|
if spec.parent != None:
|
|
113
107
|
pos = Vector(pos) + spec.parent.realpos
|
|
@@ -137,15 +131,15 @@ class UI(Widget):
|
|
|
137
131
|
def moveElementBy(self, id, dist):
|
|
138
132
|
element = self.getElement(id)
|
|
139
133
|
if element != None:
|
|
140
|
-
element.setPos(Vector(element.
|
|
134
|
+
element.setPos(Vector(element.getPos()) + dist)
|
|
141
135
|
for id in element.getChildren():
|
|
142
|
-
self.
|
|
136
|
+
self.moveElementBy(id, dist)
|
|
143
137
|
return
|
|
144
138
|
|
|
145
139
|
def moveElementTo(self, id, pos):
|
|
146
140
|
element = self.getElement(id)
|
|
147
141
|
if element != None:
|
|
148
|
-
self.moveElementBy(id, Vector(pos) - element.
|
|
142
|
+
self.moveElementBy(id, Vector(pos) - element.getPos())
|
|
149
143
|
return
|
|
150
144
|
|
|
151
145
|
def on_touch_down(self, touch):
|
|
@@ -153,12 +147,10 @@ class UI(Widget):
|
|
|
153
147
|
x = tp[0]
|
|
154
148
|
y = tp[1]
|
|
155
149
|
for element in reversed(self.zlist):
|
|
156
|
-
if element.
|
|
150
|
+
if element.actionCB != None:
|
|
157
151
|
spec = element.spec
|
|
158
152
|
pos = spec.realpos
|
|
159
|
-
|
|
160
|
-
pos = Vector(pos) + spec.parent.realpos
|
|
161
|
-
size = spec.size
|
|
153
|
+
size = element.getSize()
|
|
162
154
|
if spec.type == 'ellipse':
|
|
163
155
|
a = int(size[0])/2
|
|
164
156
|
b = int(size[1])/2
|
|
@@ -166,15 +158,17 @@ class UI(Widget):
|
|
|
166
158
|
h = ctr[0]
|
|
167
159
|
k = ctr[1]
|
|
168
160
|
if (math.pow((x - h), 2) / math.pow(a, 2)) + (math.pow((y - k), 2) / math.pow(b, 2)) <= 1:
|
|
169
|
-
element.
|
|
161
|
+
element.actionCB(element.data)
|
|
170
162
|
break
|
|
171
163
|
elif spec.type in ['rectangle', 'text', 'image']:
|
|
172
164
|
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
|
-
element.
|
|
165
|
+
element.actionCB(element.data)
|
|
174
166
|
break
|
|
175
167
|
|
|
176
|
-
def setOnClick(self, id, callback):
|
|
177
|
-
self.getElement(id)
|
|
168
|
+
def setOnClick(self, id, data, callback):
|
|
169
|
+
element = self.getElement(id)
|
|
170
|
+
element.data = data
|
|
171
|
+
element.actionCB = callback
|
|
178
172
|
|
|
179
173
|
def getWindowAttribute(self, attribute):
|
|
180
174
|
if attribute == 'left':
|
|
@@ -250,3 +244,6 @@ class Renderer(App):
|
|
|
250
244
|
Window.size = spec.size
|
|
251
245
|
Window.left = spec.pos[0]
|
|
252
246
|
Window.top = spec.pos[1]
|
|
247
|
+
|
|
248
|
+
class Object():
|
|
249
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|