easycoder 250423.1__py2.py3-none-any.whl → 250424.3__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 +4 -4
- easycoder/ec_core.py +30 -29
- easycoder/ec_graphics.py +2 -2
- easycoder/ec_program.py +1 -1
- easycoder/ec_pyside6.py +176 -86
- {easycoder-250423.1.dist-info → easycoder-250424.3.dist-info}/METADATA +1 -1
- easycoder-250424.3.dist-info/RECORD +18 -0
- easycoder-250423.1.dist-info/RECORD +0 -18
- {easycoder-250423.1.dist-info → easycoder-250424.3.dist-info}/LICENSE +0 -0
- {easycoder-250423.1.dist-info → easycoder-250424.3.dist-info}/WHEEL +0 -0
- {easycoder-250423.1.dist-info → easycoder-250424.3.dist-info}/entry_points.txt +0 -0
easycoder/__init__.py
CHANGED
easycoder/ec_compiler.py
CHANGED
|
@@ -114,10 +114,10 @@ class Compiler:
|
|
|
114
114
|
def compileLabel(self, command):
|
|
115
115
|
return self.compileSymbol(command, self.getToken(), False)
|
|
116
116
|
|
|
117
|
-
def compileVariable(self, command,
|
|
118
|
-
return self.compileSymbol(command, self.nextToken(),
|
|
117
|
+
def compileVariable(self, command, hasValue = False):
|
|
118
|
+
return self.compileSymbol(command, self.nextToken(), hasValue)
|
|
119
119
|
|
|
120
|
-
def compileSymbol(self, command, name,
|
|
120
|
+
def compileSymbol(self, command, name, hasValue):
|
|
121
121
|
try:
|
|
122
122
|
v = self.symbols[name]
|
|
123
123
|
except:
|
|
@@ -128,7 +128,7 @@ class Compiler:
|
|
|
128
128
|
self.symbols[name] = self.getPC()
|
|
129
129
|
command['program'] = self.program
|
|
130
130
|
command['type'] = 'symbol'
|
|
131
|
-
command['
|
|
131
|
+
command['hasValue'] = hasValue
|
|
132
132
|
command['name'] = name
|
|
133
133
|
command['elements'] = 1
|
|
134
134
|
command['index'] = 0
|
easycoder/ec_core.py
CHANGED
|
@@ -26,7 +26,7 @@ class Core(Handler):
|
|
|
26
26
|
if self.nextToken() == 'to':
|
|
27
27
|
if self.nextIsSymbol():
|
|
28
28
|
symbolRecord = self.getSymbolRecord()
|
|
29
|
-
if symbolRecord['
|
|
29
|
+
if symbolRecord['hasValue']:
|
|
30
30
|
if self.peek() == 'giving':
|
|
31
31
|
# This variable must be treated as a second value
|
|
32
32
|
command['value2'] = self.getValue()
|
|
@@ -57,7 +57,7 @@ class Core(Handler):
|
|
|
57
57
|
except:
|
|
58
58
|
value2 = None
|
|
59
59
|
target = self.getVariable(command['target'])
|
|
60
|
-
if not target['
|
|
60
|
+
if not target['hasValue']:
|
|
61
61
|
self.variableDoesNotHoldAValueError(target['name'])
|
|
62
62
|
targetValue = self.getSymbolValue(target)
|
|
63
63
|
if targetValue == None:
|
|
@@ -87,7 +87,7 @@ class Core(Handler):
|
|
|
87
87
|
if self.nextIs('to'):
|
|
88
88
|
if self.nextIsSymbol():
|
|
89
89
|
symbolRecord = self.getSymbolRecord()
|
|
90
|
-
if symbolRecord['
|
|
90
|
+
if symbolRecord['hasValue']:
|
|
91
91
|
command['target'] = symbolRecord['name']
|
|
92
92
|
self.add(command)
|
|
93
93
|
return True
|
|
@@ -149,7 +149,7 @@ class Core(Handler):
|
|
|
149
149
|
def k_clear(self, command):
|
|
150
150
|
if self.nextIsSymbol():
|
|
151
151
|
target = self.getSymbolRecord()
|
|
152
|
-
if target['
|
|
152
|
+
if target['hasValue']:
|
|
153
153
|
command['target'] = target['name']
|
|
154
154
|
self.add(command)
|
|
155
155
|
return True
|
|
@@ -245,7 +245,7 @@ class Core(Handler):
|
|
|
245
245
|
def k_decrement(self, command):
|
|
246
246
|
if self.nextIsSymbol():
|
|
247
247
|
symbolRecord = self.getSymbolRecord()
|
|
248
|
-
if symbolRecord['
|
|
248
|
+
if symbolRecord['hasValue']:
|
|
249
249
|
command['target'] = self.getToken()
|
|
250
250
|
self.add(command)
|
|
251
251
|
return True
|
|
@@ -325,7 +325,7 @@ class Core(Handler):
|
|
|
325
325
|
except:
|
|
326
326
|
value2 = None
|
|
327
327
|
target = self.getVariable(command['target'])
|
|
328
|
-
if not target['
|
|
328
|
+
if not target['hasValue']:
|
|
329
329
|
self.variableDoesNotHoldAValueError(target['name'])
|
|
330
330
|
return None
|
|
331
331
|
value = self.getSymbolValue(target)
|
|
@@ -400,7 +400,7 @@ class Core(Handler):
|
|
|
400
400
|
def k_get(self, command):
|
|
401
401
|
if self.nextIsSymbol():
|
|
402
402
|
symbolRecord = self.getSymbolRecord()
|
|
403
|
-
if symbolRecord['
|
|
403
|
+
if symbolRecord['hasValue']:
|
|
404
404
|
command['target'] = self.getToken()
|
|
405
405
|
else:
|
|
406
406
|
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
|
|
@@ -610,7 +610,7 @@ class Core(Handler):
|
|
|
610
610
|
def k_increment(self, command):
|
|
611
611
|
if self.nextIsSymbol():
|
|
612
612
|
symbolRecord = self.getSymbolRecord()
|
|
613
|
-
if symbolRecord['
|
|
613
|
+
if symbolRecord['hasValue']:
|
|
614
614
|
command['target'] = self.getToken()
|
|
615
615
|
self.add(command)
|
|
616
616
|
return True
|
|
@@ -701,7 +701,7 @@ class Core(Handler):
|
|
|
701
701
|
return True
|
|
702
702
|
elif self.isSymbol():
|
|
703
703
|
symbolRecord = self.getSymbolRecord()
|
|
704
|
-
if symbolRecord['
|
|
704
|
+
if symbolRecord['hasValue']:
|
|
705
705
|
command['target'] = symbolRecord['name']
|
|
706
706
|
if self.nextIs('from'):
|
|
707
707
|
command['file'] = self.nextValue()
|
|
@@ -717,7 +717,7 @@ class Core(Handler):
|
|
|
717
717
|
try:
|
|
718
718
|
with open(filename) as f: content = f.read()
|
|
719
719
|
except:
|
|
720
|
-
|
|
720
|
+
content = ''
|
|
721
721
|
try:
|
|
722
722
|
if filename.endswith('.json'): content = json.loads(content)
|
|
723
723
|
except:
|
|
@@ -785,7 +785,7 @@ class Core(Handler):
|
|
|
785
785
|
except:
|
|
786
786
|
value2 = None
|
|
787
787
|
target = self.getVariable(command['target'])
|
|
788
|
-
if not target['
|
|
788
|
+
if not target['hasValue']:
|
|
789
789
|
self.variableDoesNotHoldAValueError(target['name'])
|
|
790
790
|
return None
|
|
791
791
|
value = self.getSymbolValue(target)
|
|
@@ -810,7 +810,7 @@ class Core(Handler):
|
|
|
810
810
|
def k_negate(self, command):
|
|
811
811
|
if self.nextIsSymbol():
|
|
812
812
|
symbolRecord = self.getSymbolRecord()
|
|
813
|
-
if symbolRecord['
|
|
813
|
+
if symbolRecord['hasValue']:
|
|
814
814
|
command['target'] = self.getToken()
|
|
815
815
|
self.add(command)
|
|
816
816
|
return True
|
|
@@ -819,7 +819,7 @@ class Core(Handler):
|
|
|
819
819
|
|
|
820
820
|
def r_negate(self, command):
|
|
821
821
|
symbolRecord = self.getVariable(command['target'])
|
|
822
|
-
if not symbolRecord['
|
|
822
|
+
if not symbolRecord['hasValue']:
|
|
823
823
|
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
824
824
|
return None
|
|
825
825
|
value = self.getSymbolValue(symbolRecord)
|
|
@@ -921,7 +921,7 @@ class Core(Handler):
|
|
|
921
921
|
|
|
922
922
|
def r_pop(self, command):
|
|
923
923
|
symbolRecord = self.getVariable(command['target'])
|
|
924
|
-
if not symbolRecord['
|
|
924
|
+
if not symbolRecord['hasValue']:
|
|
925
925
|
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
926
926
|
stackRecord = self.getVariable(command['from'])
|
|
927
927
|
stack = self.getSymbolValue(stackRecord)
|
|
@@ -1060,7 +1060,7 @@ class Core(Handler):
|
|
|
1060
1060
|
if self.nextIsSymbol():
|
|
1061
1061
|
symbolRecord = self.getSymbolRecord()
|
|
1062
1062
|
command['target'] = symbolRecord['name']
|
|
1063
|
-
if '
|
|
1063
|
+
if 'hasValue' in symbolRecord and symbolRecord['hasValue'] == False:
|
|
1064
1064
|
FatalError(self.compiler, f'Symbol {symbolRecord["name"]} is not a value holder')
|
|
1065
1065
|
else:
|
|
1066
1066
|
self.add(command)
|
|
@@ -1074,7 +1074,7 @@ class Core(Handler):
|
|
|
1074
1074
|
if value == None:
|
|
1075
1075
|
return -1
|
|
1076
1076
|
symbolRecord = self.getVariable(command['target'])
|
|
1077
|
-
if not symbolRecord['
|
|
1077
|
+
if not symbolRecord['hasValue']:
|
|
1078
1078
|
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
1079
1079
|
return -1
|
|
1080
1080
|
self.putSymbolValue(symbolRecord, value)
|
|
@@ -1090,7 +1090,7 @@ class Core(Handler):
|
|
|
1090
1090
|
command['line'] = False
|
|
1091
1091
|
if self.nextIsSymbol():
|
|
1092
1092
|
symbolRecord = self.getSymbolRecord()
|
|
1093
|
-
if symbolRecord['
|
|
1093
|
+
if symbolRecord['hasValue']:
|
|
1094
1094
|
if self.peek() == 'from':
|
|
1095
1095
|
self.nextToken()
|
|
1096
1096
|
if self.nextIsSymbol():
|
|
@@ -1259,7 +1259,7 @@ class Core(Handler):
|
|
|
1259
1259
|
def k_set(self, command):
|
|
1260
1260
|
if self.nextIsSymbol():
|
|
1261
1261
|
target = self.getSymbolRecord()
|
|
1262
|
-
if target['
|
|
1262
|
+
if target['hasValue']:
|
|
1263
1263
|
command['type'] = 'set'
|
|
1264
1264
|
command['target'] = target['name']
|
|
1265
1265
|
self.add(command)
|
|
@@ -1384,7 +1384,7 @@ class Core(Handler):
|
|
|
1384
1384
|
def k_split(self, command):
|
|
1385
1385
|
if self.nextIsSymbol():
|
|
1386
1386
|
symbolRecord = self.getSymbolRecord()
|
|
1387
|
-
if symbolRecord['
|
|
1387
|
+
if symbolRecord['hasValue']:
|
|
1388
1388
|
command['target'] = symbolRecord['name']
|
|
1389
1389
|
value = {}
|
|
1390
1390
|
value['type'] = 'text'
|
|
@@ -1423,7 +1423,7 @@ class Core(Handler):
|
|
|
1423
1423
|
def k_shuffle(self, command):
|
|
1424
1424
|
if self.nextIsSymbol():
|
|
1425
1425
|
symbolRecord = self.getSymbolRecord()
|
|
1426
|
-
if symbolRecord['
|
|
1426
|
+
if symbolRecord['hasValue']:
|
|
1427
1427
|
command['target'] = self.getToken()
|
|
1428
1428
|
self.add(command)
|
|
1429
1429
|
return True
|
|
@@ -1432,7 +1432,7 @@ class Core(Handler):
|
|
|
1432
1432
|
|
|
1433
1433
|
def r_shuffle(self, command):
|
|
1434
1434
|
symbolRecord = self.getVariable(command['target'])
|
|
1435
|
-
if not symbolRecord['
|
|
1435
|
+
if not symbolRecord['hasValue']:
|
|
1436
1436
|
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
1437
1437
|
return None
|
|
1438
1438
|
value = self.getSymbolValue(symbolRecord)
|
|
@@ -1495,7 +1495,7 @@ class Core(Handler):
|
|
|
1495
1495
|
if self.nextToken() == 'from':
|
|
1496
1496
|
if self.nextIsSymbol():
|
|
1497
1497
|
symbolRecord = self.getSymbolRecord()
|
|
1498
|
-
if symbolRecord['
|
|
1498
|
+
if symbolRecord['hasValue']:
|
|
1499
1499
|
if self.peek() == 'giving':
|
|
1500
1500
|
# This variable must be treated as a second value
|
|
1501
1501
|
command['value2'] = self.getValue()
|
|
@@ -1530,7 +1530,7 @@ class Core(Handler):
|
|
|
1530
1530
|
except:
|
|
1531
1531
|
value2 = None
|
|
1532
1532
|
target = self.getVariable(command['target'])
|
|
1533
|
-
if not target['
|
|
1533
|
+
if not target['hasValue']:
|
|
1534
1534
|
self.variableDoesNotHoldAValueError(target['name'])
|
|
1535
1535
|
return None
|
|
1536
1536
|
value = self.getSymbolValue(target)
|
|
@@ -1552,7 +1552,7 @@ class Core(Handler):
|
|
|
1552
1552
|
def k_toggle(self, command):
|
|
1553
1553
|
if self.nextIsSymbol():
|
|
1554
1554
|
target = self.getSymbolRecord()
|
|
1555
|
-
if target['
|
|
1555
|
+
if target['hasValue']:
|
|
1556
1556
|
command['target'] = target['name']
|
|
1557
1557
|
self.add(command)
|
|
1558
1558
|
return True
|
|
@@ -1712,7 +1712,7 @@ class Core(Handler):
|
|
|
1712
1712
|
|
|
1713
1713
|
def incdec(self, command, mode):
|
|
1714
1714
|
symbolRecord = self.getVariable(command['target'])
|
|
1715
|
-
if not symbolRecord['
|
|
1715
|
+
if not symbolRecord['hasValue']:
|
|
1716
1716
|
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
|
|
1717
1717
|
return None
|
|
1718
1718
|
value = self.getSymbolValue(symbolRecord)
|
|
@@ -1781,7 +1781,7 @@ class Core(Handler):
|
|
|
1781
1781
|
if self.nextToken() == 'of':
|
|
1782
1782
|
if self.nextIsSymbol():
|
|
1783
1783
|
symbolRecord = self.getSymbolRecord()
|
|
1784
|
-
if symbolRecord['
|
|
1784
|
+
if symbolRecord['hasValue']:
|
|
1785
1785
|
value['target'] = symbolRecord['name']
|
|
1786
1786
|
return value
|
|
1787
1787
|
self.warning(f'Core.compileValue: Token \'{self.getToken()}\' does not hold a value')
|
|
@@ -1792,7 +1792,7 @@ class Core(Handler):
|
|
|
1792
1792
|
if self.nextToken() == 'of':
|
|
1793
1793
|
if self.nextIsSymbol():
|
|
1794
1794
|
symbolRecord = self.getSymbolRecord()
|
|
1795
|
-
if symbolRecord['
|
|
1795
|
+
if symbolRecord['hasValue']:
|
|
1796
1796
|
value['target'] = symbolRecord['name']
|
|
1797
1797
|
return value
|
|
1798
1798
|
FatalError(self.compiler, 'Variable does not hold a value')
|
|
@@ -1838,8 +1838,9 @@ class Core(Handler):
|
|
|
1838
1838
|
if token == 'count':
|
|
1839
1839
|
if self.nextIs('of'):
|
|
1840
1840
|
if self.nextIsSymbol():
|
|
1841
|
-
|
|
1842
|
-
|
|
1841
|
+
if self.getSymbolRecord()['hasValue']:
|
|
1842
|
+
value['name'] = self.getToken()
|
|
1843
|
+
return value
|
|
1843
1844
|
return None
|
|
1844
1845
|
|
|
1845
1846
|
if token == 'index':
|
easycoder/ec_graphics.py
CHANGED
|
@@ -165,11 +165,11 @@ class Graphics(Handler):
|
|
|
165
165
|
def k_get(self, command):
|
|
166
166
|
if self.nextIsSymbol():
|
|
167
167
|
symbolRecord = self.getSymbolRecord()
|
|
168
|
-
if symbolRecord['
|
|
168
|
+
if symbolRecord['hasValue']:
|
|
169
169
|
command['target'] = self.getToken()
|
|
170
170
|
else:
|
|
171
171
|
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
|
|
172
|
-
if symbolRecord['
|
|
172
|
+
if symbolRecord['hasValue']:
|
|
173
173
|
if self.nextIs('from'):
|
|
174
174
|
if self.nextIs('popup'):
|
|
175
175
|
command['ptype'] = self.nextToken()
|
easycoder/ec_program.py
CHANGED
|
@@ -149,7 +149,7 @@ class Program:
|
|
|
149
149
|
elif valType == 'symbol':
|
|
150
150
|
name = value['name']
|
|
151
151
|
symbolRecord = self.getSymbolRecord(name)
|
|
152
|
-
if symbolRecord['
|
|
152
|
+
if symbolRecord['hasValue']:
|
|
153
153
|
handler = self.domainIndex[symbolRecord['domain']].valueHandler('symbol')
|
|
154
154
|
result = handler(symbolRecord)
|
|
155
155
|
else:
|
easycoder/ec_pyside6.py
CHANGED
|
@@ -30,7 +30,8 @@ from PySide6.QtWidgets import (
|
|
|
30
30
|
QSpacerItem,
|
|
31
31
|
QSizePolicy,
|
|
32
32
|
QDialog,
|
|
33
|
-
QMessageBox
|
|
33
|
+
QMessageBox,
|
|
34
|
+
QDialogButtonBox
|
|
34
35
|
)
|
|
35
36
|
|
|
36
37
|
class Graphics(Handler):
|
|
@@ -132,6 +133,31 @@ class Graphics(Handler):
|
|
|
132
133
|
else: layout.addWidget(widget)
|
|
133
134
|
return self.nextPC()
|
|
134
135
|
|
|
136
|
+
# Center one window on another
|
|
137
|
+
# center {window2} on {window1}
|
|
138
|
+
def k_center(self, command):
|
|
139
|
+
if self.nextIsSymbol():
|
|
140
|
+
record = self.getSymbolRecord()
|
|
141
|
+
if record['keyword'] == 'window':
|
|
142
|
+
command['window2'] = record['name']
|
|
143
|
+
if self.nextIs('on'):
|
|
144
|
+
if self.nextIsSymbol():
|
|
145
|
+
record = self.getSymbolRecord()
|
|
146
|
+
if record['keyword'] == 'window':
|
|
147
|
+
command['window1'] = record['name']
|
|
148
|
+
self.add(command)
|
|
149
|
+
return True
|
|
150
|
+
return False
|
|
151
|
+
|
|
152
|
+
def r_center(self, command):
|
|
153
|
+
window1 = self.getVariable(command['window1'])['window']
|
|
154
|
+
window2 = self.getVariable(command['window2'])['window']
|
|
155
|
+
geo1 = window1.geometry()
|
|
156
|
+
geo2 = window2.geometry()
|
|
157
|
+
geo2.moveCenter(geo1.center())
|
|
158
|
+
window2.setGeometry(geo2)
|
|
159
|
+
return self.nextPC()
|
|
160
|
+
|
|
135
161
|
# Declare a checkbox variable
|
|
136
162
|
def k_checkbox(self, command):
|
|
137
163
|
return self.compileVariable(command, False)
|
|
@@ -140,6 +166,7 @@ class Graphics(Handler):
|
|
|
140
166
|
return self.nextPC()
|
|
141
167
|
|
|
142
168
|
# Close a window
|
|
169
|
+
# close {window}
|
|
143
170
|
def k_close(self, command):
|
|
144
171
|
if self.nextIsSymbol():
|
|
145
172
|
record = self.getSymbolRecord()
|
|
@@ -165,24 +192,30 @@ class Graphics(Handler):
|
|
|
165
192
|
command['title'] = 'Default'
|
|
166
193
|
x = None
|
|
167
194
|
y = None
|
|
168
|
-
w = 640
|
|
169
|
-
h = 480
|
|
195
|
+
w = self.compileConstant(640)
|
|
196
|
+
h = self.compileConstant(480)
|
|
170
197
|
while True:
|
|
171
198
|
token = self.peek()
|
|
172
|
-
if token in ['title', 'at', 'size']:
|
|
199
|
+
if token in ['title', 'at', 'size', 'layout']:
|
|
173
200
|
self.nextToken()
|
|
174
201
|
if token == 'title': command['title'] = self.nextValue()
|
|
175
202
|
elif token == 'at':
|
|
176
203
|
x = self.nextValue()
|
|
177
204
|
y = self.nextValue()
|
|
178
205
|
elif token == 'size':
|
|
179
|
-
|
|
180
|
-
|
|
206
|
+
w = self.nextValue()
|
|
207
|
+
h = self.nextValue()
|
|
208
|
+
elif token == 'layout':
|
|
209
|
+
if self.nextIsSymbol():
|
|
210
|
+
record = self.getSymbolRecord()
|
|
211
|
+
if record['keyword'] == 'layout':
|
|
212
|
+
command['layout'] = record['name']
|
|
213
|
+
else: return False
|
|
181
214
|
else: break
|
|
182
|
-
command['w'] = self.compileConstant(w)
|
|
183
|
-
command['h'] = self.compileConstant(h)
|
|
184
215
|
command['x'] = x
|
|
185
216
|
command['y'] = y
|
|
217
|
+
command['w'] = w
|
|
218
|
+
command['h'] = h
|
|
186
219
|
self.add(command)
|
|
187
220
|
return True
|
|
188
221
|
|
|
@@ -260,38 +293,50 @@ class Graphics(Handler):
|
|
|
260
293
|
return True
|
|
261
294
|
|
|
262
295
|
def k_createDialog(self, command):
|
|
263
|
-
if self.peek() == '
|
|
296
|
+
if self.peek() == 'on':
|
|
264
297
|
self.nextToken()
|
|
265
|
-
|
|
266
|
-
|
|
298
|
+
if self.nextIsSymbol():
|
|
299
|
+
command['window'] = self.getSymbolRecord()['name']
|
|
300
|
+
else: command['window'] = None
|
|
301
|
+
title = ''
|
|
302
|
+
while True:
|
|
303
|
+
if self.peek() == 'title':
|
|
304
|
+
self.nextToken()
|
|
305
|
+
title = self.nextValue()
|
|
306
|
+
elif self.peek() == 'layout':
|
|
307
|
+
self.nextToken()
|
|
308
|
+
if self.nextIsSymbol():
|
|
309
|
+
command['layout'] = self.getSymbolRecord()['name']
|
|
310
|
+
else: break
|
|
267
311
|
command['title'] = title
|
|
268
312
|
self.add(command)
|
|
269
313
|
return True
|
|
270
314
|
|
|
271
315
|
def k_createMessageBox(self, command):
|
|
272
|
-
if self.
|
|
316
|
+
if self.peek() == 'on':
|
|
317
|
+
self.nextToken()
|
|
273
318
|
if self.nextIsSymbol():
|
|
274
319
|
command['window'] = self.getSymbolRecord()['name']
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
return
|
|
320
|
+
else: command['window'] = None
|
|
321
|
+
style = 'question'
|
|
322
|
+
title = ''
|
|
323
|
+
message = ''
|
|
324
|
+
while True:
|
|
325
|
+
if self.peek() == 'style':
|
|
326
|
+
self.nextToken()
|
|
327
|
+
style = self.nextToken()
|
|
328
|
+
elif self.peek() == 'title':
|
|
329
|
+
self.nextToken()
|
|
330
|
+
title = self.nextValue()
|
|
331
|
+
elif self.peek() == 'message':
|
|
332
|
+
self.nextToken()
|
|
333
|
+
message = self.nextValue()
|
|
334
|
+
else: break
|
|
335
|
+
command['style'] = style
|
|
336
|
+
command['title'] = title
|
|
337
|
+
command['message'] = message
|
|
338
|
+
self.add(command)
|
|
339
|
+
return True
|
|
295
340
|
|
|
296
341
|
def k_create(self, command):
|
|
297
342
|
if self.nextIsSymbol():
|
|
@@ -323,6 +368,9 @@ class Graphics(Handler):
|
|
|
323
368
|
if y == None: y = (self.screenHeight - h) / 2
|
|
324
369
|
else: y = self.getRuntimeValue(x)
|
|
325
370
|
window.setGeometry(x, y, w, h)
|
|
371
|
+
container = QWidget()
|
|
372
|
+
container.setLayout(self.getVariable(command['layout'])['widget'])
|
|
373
|
+
window.setCentralWidget(container)
|
|
326
374
|
record['window'] = window
|
|
327
375
|
return self.nextPC()
|
|
328
376
|
|
|
@@ -347,7 +395,7 @@ class Graphics(Handler):
|
|
|
347
395
|
if 'size' in command:
|
|
348
396
|
fm = label.fontMetrics()
|
|
349
397
|
c = label.contentsMargins()
|
|
350
|
-
w = fm.horizontalAdvance('
|
|
398
|
+
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) +c.left()+c.right()
|
|
351
399
|
label.setMaximumWidth(w)
|
|
352
400
|
record['widget'] = label
|
|
353
401
|
return self.nextPC()
|
|
@@ -357,7 +405,7 @@ class Graphics(Handler):
|
|
|
357
405
|
if 'size' in command:
|
|
358
406
|
fm = pushbutton.fontMetrics()
|
|
359
407
|
c = pushbutton.contentsMargins()
|
|
360
|
-
w = fm.horizontalAdvance('
|
|
408
|
+
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) +c.left()+c.right()
|
|
361
409
|
pushbutton.setMaximumWidth(w)
|
|
362
410
|
record['widget'] = pushbutton
|
|
363
411
|
return self.nextPC()
|
|
@@ -386,8 +434,14 @@ class Graphics(Handler):
|
|
|
386
434
|
return self.nextPC()
|
|
387
435
|
|
|
388
436
|
def r_createDialog(self, command, record):
|
|
437
|
+
layout = self.getVariable(command['layout'])['widget']
|
|
389
438
|
dialog = QDialog()
|
|
390
439
|
dialog.setWindowTitle(self.getRuntimeValue(command['title']))
|
|
440
|
+
dialog.buttonBox = QDialogButtonBox((QDialogButtonBox.Ok | QDialogButtonBox.Cancel))
|
|
441
|
+
dialog.buttonBox.accepted.connect(dialog.accept)
|
|
442
|
+
dialog.buttonBox.rejected.connect(dialog.reject)
|
|
443
|
+
layout.addWidget(dialog.buttonBox)
|
|
444
|
+
dialog.setLayout(layout)
|
|
391
445
|
record['dialog'] = dialog
|
|
392
446
|
return self.nextPC()
|
|
393
447
|
|
|
@@ -424,6 +478,30 @@ class Graphics(Handler):
|
|
|
424
478
|
def r_dialog(self, command):
|
|
425
479
|
return self.nextPC()
|
|
426
480
|
|
|
481
|
+
# Disable a widget
|
|
482
|
+
def k_disable(self, command):
|
|
483
|
+
if self.nextIsSymbol():
|
|
484
|
+
command['name'] = self.getSymbolRecord()['name']
|
|
485
|
+
self.add(command)
|
|
486
|
+
return True
|
|
487
|
+
return False
|
|
488
|
+
|
|
489
|
+
def r_disable(self, command):
|
|
490
|
+
self.getVariable(command['name'])['widget'].setEnabled(False)
|
|
491
|
+
return self.nextPC()
|
|
492
|
+
|
|
493
|
+
# Enable a widget
|
|
494
|
+
def k_enable(self, command):
|
|
495
|
+
if self.nextIsSymbol():
|
|
496
|
+
command['name'] = self.getSymbolRecord()['name']
|
|
497
|
+
self.add(command)
|
|
498
|
+
return True
|
|
499
|
+
return False
|
|
500
|
+
|
|
501
|
+
def r_enable(self, command):
|
|
502
|
+
self.getVariable(command['name'])['widget'].setEnabled(True)
|
|
503
|
+
return self.nextPC()
|
|
504
|
+
|
|
427
505
|
# Create a group box
|
|
428
506
|
def k_groupbox(self, command):
|
|
429
507
|
return self.compileVariable(command, False)
|
|
@@ -525,19 +603,33 @@ class Graphics(Handler):
|
|
|
525
603
|
def r_pushbutton(self, command):
|
|
526
604
|
return self.nextPC()
|
|
527
605
|
|
|
528
|
-
#
|
|
529
|
-
def
|
|
530
|
-
|
|
531
|
-
self.
|
|
606
|
+
# remove current item from {combobox}
|
|
607
|
+
def k_remove(self, command):
|
|
608
|
+
command['variant'] = None
|
|
609
|
+
if self.nextIs('current'):
|
|
610
|
+
if self.nextIs('item'):
|
|
611
|
+
if self.nextIs('from'):
|
|
612
|
+
if self.nextIsSymbol():
|
|
613
|
+
record = self.getSymbolRecord()
|
|
614
|
+
if record['keyword'] == 'combobox':
|
|
615
|
+
command['variant'] = 'current'
|
|
616
|
+
command['name'] = record['name']
|
|
617
|
+
self.addCommand(command)
|
|
618
|
+
return True
|
|
619
|
+
return False
|
|
620
|
+
|
|
621
|
+
def r_remove(self, command):
|
|
622
|
+
variant = command['variant']
|
|
623
|
+
record = self.getVariable(command['name'])
|
|
624
|
+
if record['keyword'] == 'combobox' and variant == 'current':
|
|
625
|
+
widget = record['widget']
|
|
626
|
+
widget.removeItem(widget.currentIndex())
|
|
627
|
+
return self.nextPC()
|
|
532
628
|
|
|
533
629
|
# This is called every 10ms to keep the main application running
|
|
534
630
|
def flush(self):
|
|
535
631
|
self.program.flushCB()
|
|
536
632
|
|
|
537
|
-
# Resume execution at the line following 'start graphics'
|
|
538
|
-
def resume(self):
|
|
539
|
-
self.program.flush(self.nextPC())
|
|
540
|
-
|
|
541
633
|
# Set something
|
|
542
634
|
def k_set(self, command):
|
|
543
635
|
token = self.nextToken()
|
|
@@ -563,22 +655,17 @@ class Graphics(Handler):
|
|
|
563
655
|
groupbox.setFixedHeight(self.getRuntimeValue(command['value']))
|
|
564
656
|
return self.nextPC()
|
|
565
657
|
|
|
566
|
-
#
|
|
567
|
-
# show {
|
|
568
|
-
# show {
|
|
658
|
+
# show {window}
|
|
659
|
+
# show {dialog}
|
|
660
|
+
# show {messagebox} giving {result}}
|
|
569
661
|
def k_show(self, command):
|
|
570
662
|
if self.nextIsSymbol():
|
|
571
663
|
record = self.getSymbolRecord()
|
|
572
664
|
keyword = record['keyword']
|
|
573
|
-
if keyword == '
|
|
574
|
-
command['
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
record = self.getSymbolRecord()
|
|
578
|
-
if record['keyword'] == 'window':
|
|
579
|
-
command['window'] = record['name']
|
|
580
|
-
self.add(command)
|
|
581
|
-
return True
|
|
665
|
+
if keyword == 'window':
|
|
666
|
+
command['window'] = record['name']
|
|
667
|
+
self.add(command)
|
|
668
|
+
return True
|
|
582
669
|
elif keyword == 'dialog':
|
|
583
670
|
command['dialog'] = record['name']
|
|
584
671
|
self.add(command)
|
|
@@ -593,13 +680,7 @@ class Graphics(Handler):
|
|
|
593
680
|
return False
|
|
594
681
|
|
|
595
682
|
def r_show(self, command):
|
|
596
|
-
if '
|
|
597
|
-
dialog = self.getVariable(command['dialog'])['dialog']
|
|
598
|
-
b1 = QPushButton("ok",dialog)
|
|
599
|
-
b1.move(50,50)
|
|
600
|
-
dialog.setWindowModality(Qt.ApplicationModal)
|
|
601
|
-
dialog.exec_()
|
|
602
|
-
elif 'messagebox' in command:
|
|
683
|
+
if 'messagebox' in command:
|
|
603
684
|
data = self.getVariable(command['messagebox'])['data']
|
|
604
685
|
symbolRecord = self.getVariable(command['result'])
|
|
605
686
|
window = self.getVariable(data['window'])['window']
|
|
@@ -619,14 +700,12 @@ class Graphics(Handler):
|
|
|
619
700
|
v['type'] = 'text'
|
|
620
701
|
v['content'] = result
|
|
621
702
|
self.putSymbolValue(symbolRecord, v)
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
windowRecord = self.getVariable(command['window'])
|
|
625
|
-
window = windowRecord['window']
|
|
626
|
-
container = QWidget()
|
|
627
|
-
container.setLayout(layoutRecord['widget'])
|
|
628
|
-
window.setCentralWidget(container)
|
|
703
|
+
elif 'window' in command:
|
|
704
|
+
window = self.getVariable(command['window'])['window']
|
|
629
705
|
window.show()
|
|
706
|
+
elif 'dialog' in command:
|
|
707
|
+
dialog = self.getVariable(command['dialog'])['dialog']
|
|
708
|
+
dialog.exec()
|
|
630
709
|
return self.nextPC()
|
|
631
710
|
|
|
632
711
|
# Start the graphics
|
|
@@ -637,11 +716,16 @@ class Graphics(Handler):
|
|
|
637
716
|
return False
|
|
638
717
|
|
|
639
718
|
def r_start(self, command):
|
|
719
|
+
def on_last_window_closed():
|
|
720
|
+
print("Performing cleanup...")
|
|
721
|
+
self.program.kill()
|
|
722
|
+
def resume():
|
|
723
|
+
self.program.flush(self.nextPC())
|
|
640
724
|
timer = QTimer()
|
|
641
725
|
timer.timeout.connect(self.flush)
|
|
642
726
|
timer.start(10)
|
|
643
|
-
QTimer.singleShot(500,
|
|
644
|
-
self.app.lastWindowClosed.connect(
|
|
727
|
+
QTimer.singleShot(500, resume)
|
|
728
|
+
self.app.lastWindowClosed.connect(on_last_window_closed)
|
|
645
729
|
self.app.exec()
|
|
646
730
|
|
|
647
731
|
# Declare a window variable
|
|
@@ -665,8 +749,17 @@ class Graphics(Handler):
|
|
|
665
749
|
if self.tokenIs('the'):
|
|
666
750
|
self.nextToken()
|
|
667
751
|
token = self.getToken()
|
|
668
|
-
|
|
669
|
-
|
|
752
|
+
|
|
753
|
+
if token == 'count':
|
|
754
|
+
if self.nextIs('of'):
|
|
755
|
+
if self.nextIsSymbol():
|
|
756
|
+
value['type'] = 'symbol'
|
|
757
|
+
record = self.getSymbolRecord()
|
|
758
|
+
keyword = record['keyword']
|
|
759
|
+
if keyword == 'combobox':
|
|
760
|
+
value['type'] = 'count'
|
|
761
|
+
value['name'] = record['name']
|
|
762
|
+
return value
|
|
670
763
|
|
|
671
764
|
return None
|
|
672
765
|
|
|
@@ -682,20 +775,11 @@ class Graphics(Handler):
|
|
|
682
775
|
def v_symbol(self, symbolRecord):
|
|
683
776
|
symbolRecord = self.getVariable(symbolRecord['name'])
|
|
684
777
|
keyword = symbolRecord['keyword']
|
|
685
|
-
if keyword == '
|
|
686
|
-
|
|
687
|
-
window = self.getVariable(data['window'])['window']
|
|
688
|
-
style = data['style']
|
|
689
|
-
title = data['title']
|
|
690
|
-
message = data['message']
|
|
691
|
-
if style == 'question':
|
|
692
|
-
button = QMessageBox.question(window, title, message)
|
|
693
|
-
elif style == 'warning':
|
|
694
|
-
button = QMessageBox.warning(window, title, message)
|
|
695
|
-
content = True if button == QMessageBox.Ok else False
|
|
778
|
+
if keyword == 'lineinput':
|
|
779
|
+
lineinput = symbolRecord['widget']
|
|
696
780
|
v = {}
|
|
697
|
-
v['type'] = '
|
|
698
|
-
v['content'] =
|
|
781
|
+
v['type'] = 'text'
|
|
782
|
+
v['content'] = lineinput.displayText()
|
|
699
783
|
return v
|
|
700
784
|
elif keyword == 'combobox':
|
|
701
785
|
combobox = symbolRecord['widget']
|
|
@@ -705,8 +789,14 @@ class Graphics(Handler):
|
|
|
705
789
|
return v
|
|
706
790
|
return None
|
|
707
791
|
|
|
708
|
-
def
|
|
792
|
+
def v_count(self, v):
|
|
793
|
+
record = self.getVariable(v['name'])
|
|
794
|
+
keyword = record['keyword']
|
|
795
|
+
widget = record['widget']
|
|
796
|
+
if keyword == 'combobox': content = widget.count()
|
|
709
797
|
value = {}
|
|
798
|
+
value['type'] = 'int'
|
|
799
|
+
value['content'] = content
|
|
710
800
|
return value
|
|
711
801
|
|
|
712
802
|
#############################################################################
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250424.3
|
|
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/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
|
|
2
|
+
easycoder/__init__.py,sha256=U91pzIS30xf6fU78HzxaL0kYq6R3saY-_c-EAacke8w,262
|
|
3
|
+
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
+
easycoder/ec_compiler.py,sha256=WN4DMTU66kzOAwOGJe3KDoXj2nPvq19ACegQ-RSMglo,4780
|
|
5
|
+
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
6
|
+
easycoder/ec_core.py,sha256=RHFdEMgudlLPUOisbzj_sdvrWfokoPOYKv_T8oV19ag,90563
|
|
7
|
+
easycoder/ec_graphics.py,sha256=WXxKMB4GJSmxvk-FVbOTyufiUx4TYIzyDoB1PCAO3JY,16067
|
|
8
|
+
easycoder/ec_gutils.py,sha256=yqu4RRQ6VdRkC5B2ADBYsXzgNu76dLnekd9aUjdEgPw,6399
|
|
9
|
+
easycoder/ec_handler.py,sha256=K7nBuQTH8l0k8hX1o2b4KhTnhZHGdf2fkEuX4FJXJs8,2277
|
|
10
|
+
easycoder/ec_program.py,sha256=ZCcvI36iq9HG4o8rFwFxzVElzZ7PEeNOPMr8eqwz8ns,10010
|
|
11
|
+
easycoder/ec_pyside6.py,sha256=Ii3k3UV8nrmv_QqE6FrZuDSjnBXVTzhPy65k0KlvcGE,28339
|
|
12
|
+
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
13
|
+
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
14
|
+
easycoder-250424.3.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
15
|
+
easycoder-250424.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
+
easycoder-250424.3.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
17
|
+
easycoder-250424.3.dist-info/METADATA,sha256=spAxnp7GfGJlgr_oHMB3ekXEnOvLE7XOiMXAbT2byrY,5617
|
|
18
|
+
easycoder-250424.3.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
|
|
2
|
-
easycoder/__init__.py,sha256=fcdquenJKFAbAFQBvEtkEG-Mozj93phUG4RxL1kmjps,262
|
|
3
|
-
easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
|
|
4
|
-
easycoder/ec_compiler.py,sha256=rtxFEWnhW0550MtWEDvYHOw9cYkeTcR0oG3t-kmgnBk,4795
|
|
5
|
-
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
6
|
-
easycoder/ec_core.py,sha256=-nSX_KA_VBximHI1GIuXA-FhsqcyTNp9-HFrv6Dy64M,90625
|
|
7
|
-
easycoder/ec_graphics.py,sha256=ScGLNxW_sxu0WyoO-Od-9MM0bhpVvf-vGa5UmoHYRCA,16073
|
|
8
|
-
easycoder/ec_gutils.py,sha256=yqu4RRQ6VdRkC5B2ADBYsXzgNu76dLnekd9aUjdEgPw,6399
|
|
9
|
-
easycoder/ec_handler.py,sha256=K7nBuQTH8l0k8hX1o2b4KhTnhZHGdf2fkEuX4FJXJs8,2277
|
|
10
|
-
easycoder/ec_program.py,sha256=BDwU7aGHiaw6WdbQvVFDhGVaHsvwQ1CWa4wb5MPmOe8,10013
|
|
11
|
-
easycoder/ec_pyside6.py,sha256=HFjUZHbVNichHnetPK2IxNSAiR01TZbeQsq3NX43SuM,25080
|
|
12
|
-
easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
|
|
13
|
-
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
14
|
-
easycoder-250423.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
15
|
-
easycoder-250423.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
-
easycoder-250423.1.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
17
|
-
easycoder-250423.1.dist-info/METADATA,sha256=57xCBptE9U7miwDGAm4NjL4Us_o-L5x0f9FxMRrjIPs,5617
|
|
18
|
-
easycoder-250423.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|