easycoder 250826.2__py2.py3-none-any.whl → 251104.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.
- easycoder/__init__.py +1 -1
- easycoder/ec_classes.py +0 -4
- easycoder/ec_compiler.py +35 -8
- easycoder/ec_condition.py +1 -1
- easycoder/ec_core.py +112 -47
- easycoder/ec_handler.py +2 -2
- easycoder/ec_keyboard.py +13 -3
- easycoder/ec_program.py +6 -5
- easycoder/ec_pyside.py +189 -87
- {easycoder-250826.2.dist-info → easycoder-251104.1.dist-info}/METADATA +1 -1
- easycoder-251104.1.dist-info/RECORD +19 -0
- easycoder-250826.2.dist-info/RECORD +0 -19
- {easycoder-250826.2.dist-info → easycoder-251104.1.dist-info}/WHEEL +0 -0
- {easycoder-250826.2.dist-info → easycoder-251104.1.dist-info}/entry_points.txt +0 -0
- {easycoder-250826.2.dist-info → easycoder-251104.1.dist-info}/licenses/LICENSE +0 -0
easycoder/ec_program.py
CHANGED
|
@@ -34,9 +34,9 @@ class Program:
|
|
|
34
34
|
self.domainIndex = {}
|
|
35
35
|
self.name = '<anon>'
|
|
36
36
|
self.code = []
|
|
37
|
+
self.pc = 0
|
|
37
38
|
self.symbols = {}
|
|
38
39
|
self.onError = 0
|
|
39
|
-
self.pc = 0
|
|
40
40
|
self.debugStep = False
|
|
41
41
|
self.stack = []
|
|
42
42
|
self.script = Script(source)
|
|
@@ -48,7 +48,6 @@ class Program:
|
|
|
48
48
|
self.externalControl = False
|
|
49
49
|
self.ticker = 0
|
|
50
50
|
self.running = True
|
|
51
|
-
# self.start()
|
|
52
51
|
|
|
53
52
|
# This is called at 10msec intervals by the GUI code
|
|
54
53
|
def flushCB(self):
|
|
@@ -62,7 +61,7 @@ class Program:
|
|
|
62
61
|
module['child'] = self
|
|
63
62
|
startCompile = time.time()
|
|
64
63
|
self.tokenise(self.script)
|
|
65
|
-
if self.compiler.
|
|
64
|
+
if self.compiler.compileFromStart():
|
|
66
65
|
finishCompile = time.time()
|
|
67
66
|
s = len(self.script.lines)
|
|
68
67
|
t = len(self.script.tokens)
|
|
@@ -200,12 +199,14 @@ class Program:
|
|
|
200
199
|
def getSymbolContent(self, symbolRecord):
|
|
201
200
|
if len(symbolRecord['value']) == 0:
|
|
202
201
|
return None
|
|
203
|
-
return symbolRecord['value'][symbolRecord['index']]
|
|
202
|
+
try: return symbolRecord['value'][symbolRecord['index']]
|
|
203
|
+
except: RuntimeError(self, f'Cannot get content of symbol "{symbolRecord["name"]}"')
|
|
204
204
|
|
|
205
205
|
def getSymbolValue(self, symbolRecord):
|
|
206
206
|
if len(symbolRecord['value']) == 0:
|
|
207
207
|
return None
|
|
208
|
-
value = symbolRecord['value'][symbolRecord['index']]
|
|
208
|
+
try: value = symbolRecord['value'][symbolRecord['index']]
|
|
209
|
+
except: RuntimeError(self, f'Cannot get value of symbol "{symbolRecord["name"]}"')
|
|
209
210
|
copy = deepcopy(value)
|
|
210
211
|
return copy
|
|
211
212
|
|
easycoder/ec_pyside.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from functools import partial
|
|
3
3
|
from .ec_handler import Handler
|
|
4
|
-
from .ec_classes import RuntimeError
|
|
4
|
+
from .ec_classes import RuntimeError, Object
|
|
5
5
|
from .ec_border import Border
|
|
6
6
|
from PySide6.QtCore import Qt, QTimer, Signal, QRect
|
|
7
7
|
from PySide6.QtGui import QPixmap, QPainter
|
|
@@ -26,6 +26,7 @@ from PySide6.QtWidgets import (
|
|
|
26
26
|
QSlider,
|
|
27
27
|
QSpinBox,
|
|
28
28
|
QTimeEdit,
|
|
29
|
+
QLayout,
|
|
29
30
|
QVBoxLayout,
|
|
30
31
|
QHBoxLayout,
|
|
31
32
|
QGridLayout,
|
|
@@ -67,13 +68,25 @@ class Graphics(Handler):
|
|
|
67
68
|
'combobox',
|
|
68
69
|
'widget'
|
|
69
70
|
]
|
|
71
|
+
|
|
72
|
+
def setWidget(self, record, widget):
|
|
73
|
+
if record['index'] >= record['elements']:
|
|
74
|
+
RuntimeError(self.program, f'Index out of range for widget {record["name"]}')
|
|
75
|
+
if not 'widget' in record:
|
|
76
|
+
record['widget'] = [None] * record['elements']
|
|
77
|
+
while len(record['widget']) < record['elements']:
|
|
78
|
+
record['widget'].append(None)
|
|
79
|
+
record['widget'][record['index']] = widget
|
|
80
|
+
|
|
81
|
+
def getWidget(self, record):
|
|
82
|
+
if 'widget' in record and record['widget'] != None:
|
|
83
|
+
if record['keyword'] in ['layout', 'group']: return record['widget']
|
|
84
|
+
return record['widget'][record['index']]
|
|
85
|
+
else:
|
|
86
|
+
return None
|
|
70
87
|
|
|
71
88
|
def dialogTypes(self):
|
|
72
89
|
return ['confirm', 'lineedit', 'multiline', 'generic']
|
|
73
|
-
|
|
74
|
-
def getWidget(self, record):
|
|
75
|
-
if record['keyword'] in ['pushbutton']: return self.getSymbolContent(record)
|
|
76
|
-
else: return record['widget']
|
|
77
90
|
|
|
78
91
|
class ClickableLineEdit(QLineEdit):
|
|
79
92
|
clicked = Signal()
|
|
@@ -81,6 +94,7 @@ class Graphics(Handler):
|
|
|
81
94
|
def __init__(self):
|
|
82
95
|
super().__init__()
|
|
83
96
|
self.multiline = False
|
|
97
|
+
self.container = None
|
|
84
98
|
|
|
85
99
|
def setContainer(self, container):
|
|
86
100
|
self.container = container
|
|
@@ -96,6 +110,7 @@ class Graphics(Handler):
|
|
|
96
110
|
def __init__(self):
|
|
97
111
|
super().__init__()
|
|
98
112
|
self.multiline = True
|
|
113
|
+
self.container = None
|
|
99
114
|
|
|
100
115
|
def setContainer(self, container):
|
|
101
116
|
self.container = container
|
|
@@ -112,7 +127,7 @@ class Graphics(Handler):
|
|
|
112
127
|
# (2) add {widget} to {layout}
|
|
113
128
|
# (3) add stretch {widget} to {layout}
|
|
114
129
|
# (4) add stretch to {layout}
|
|
115
|
-
# (5) add spacer {size} to {layout}
|
|
130
|
+
# (5) add spacer [size] {size} to {layout}
|
|
116
131
|
# (6) add {widget} at {col} {row} in {grid layout}
|
|
117
132
|
def k_add(self, command):
|
|
118
133
|
def addToLayout():
|
|
@@ -144,6 +159,7 @@ class Graphics(Handler):
|
|
|
144
159
|
|
|
145
160
|
elif token == 'spacer':
|
|
146
161
|
self.nextToken()
|
|
162
|
+
self.skip('size')
|
|
147
163
|
command['widget'] = 'spacer'
|
|
148
164
|
command['size'] = self.nextValue()
|
|
149
165
|
self.skip('to')
|
|
@@ -184,19 +200,19 @@ class Graphics(Handler):
|
|
|
184
200
|
def r_add(self, command):
|
|
185
201
|
if 'value' in command:
|
|
186
202
|
value = self.getRuntimeValue(command['value'])
|
|
187
|
-
|
|
188
|
-
if
|
|
189
|
-
|
|
190
|
-
elif
|
|
191
|
-
if isinstance(value, list):
|
|
192
|
-
else:
|
|
203
|
+
record = self.getVariable(command['widget'])
|
|
204
|
+
if record['keyword'] == 'listbox':
|
|
205
|
+
self.getWidget(record).addItem(value)
|
|
206
|
+
elif record['keyword'] == 'combobox':
|
|
207
|
+
if isinstance(value, list): record['widget'].addItems(value)
|
|
208
|
+
else: self.getWidget(record).addItem(value)
|
|
193
209
|
elif 'row' in command and 'col' in command:
|
|
194
210
|
layout = self.getVariable(command['layout'])['widget']
|
|
195
|
-
|
|
196
|
-
widget =
|
|
211
|
+
record = self.getVariable(command['widget'])
|
|
212
|
+
widget = self.getWidget(record)
|
|
197
213
|
row = self.getRuntimeValue(command['row'])
|
|
198
214
|
col = self.getRuntimeValue(command['col'])
|
|
199
|
-
if
|
|
215
|
+
if record['keyword'] == 'layout':
|
|
200
216
|
layout.addLayout(widget, row, col)
|
|
201
217
|
else:
|
|
202
218
|
layout.addWidget(widget, row, col)
|
|
@@ -270,8 +286,41 @@ class Graphics(Handler):
|
|
|
270
286
|
return False
|
|
271
287
|
|
|
272
288
|
def r_clear(self, command):
|
|
273
|
-
|
|
274
|
-
|
|
289
|
+
|
|
290
|
+
def clearLayout(layout: QLayout) -> None:
|
|
291
|
+
if layout is None:
|
|
292
|
+
return
|
|
293
|
+
while layout.count() > 0:
|
|
294
|
+
item = layout.takeAt(0)
|
|
295
|
+
if item is None:
|
|
296
|
+
continue
|
|
297
|
+
widget = item.widget()
|
|
298
|
+
if widget is not None:
|
|
299
|
+
# Delete the widget
|
|
300
|
+
widget.deleteLater()
|
|
301
|
+
elif item.layout() is not None:
|
|
302
|
+
# Recursively clear sub-layout
|
|
303
|
+
clearLayout(item.layout())
|
|
304
|
+
item.layout().deleteLater()
|
|
305
|
+
# The QLayoutItem will be automatically cleaned up by Qt
|
|
306
|
+
|
|
307
|
+
def clearWidget(widget: QWidget) -> None:
|
|
308
|
+
if widget is None:
|
|
309
|
+
return
|
|
310
|
+
# Clear the layout first
|
|
311
|
+
layout = widget.layout()
|
|
312
|
+
if layout is not None:
|
|
313
|
+
clearLayout(layout)
|
|
314
|
+
layout.deleteLater()
|
|
315
|
+
# Clear any remaining child widgets
|
|
316
|
+
child_widgets = widget.findChildren(QWidget, "", Qt.FindDirectChildrenOnly)
|
|
317
|
+
for child in child_widgets:
|
|
318
|
+
child.deleteLater()
|
|
319
|
+
|
|
320
|
+
widget = self.getWidget(self.getVariable(command['name']))
|
|
321
|
+
clearWidget(widget)
|
|
322
|
+
return self.nextPC()
|
|
323
|
+
|
|
275
324
|
return self.nextPC()
|
|
276
325
|
|
|
277
326
|
# close {window}
|
|
@@ -368,17 +417,18 @@ class Graphics(Handler):
|
|
|
368
417
|
return True
|
|
369
418
|
|
|
370
419
|
def k_createPushbutton(self, command):
|
|
371
|
-
text = ''
|
|
372
420
|
while True:
|
|
373
421
|
token = self.peek()
|
|
374
422
|
if token == 'text':
|
|
375
423
|
self.nextToken()
|
|
376
|
-
text = self.nextValue()
|
|
424
|
+
command['text'] = self.nextValue()
|
|
425
|
+
elif token == 'icon':
|
|
426
|
+
self.nextToken()
|
|
427
|
+
command['icon'] = self.nextValue()
|
|
377
428
|
elif token == 'size':
|
|
378
429
|
self.nextToken()
|
|
379
430
|
command['size'] = self.nextValue()
|
|
380
431
|
else: break
|
|
381
|
-
command['text'] = text
|
|
382
432
|
self.add(command)
|
|
383
433
|
return True
|
|
384
434
|
|
|
@@ -560,19 +610,33 @@ class Graphics(Handler):
|
|
|
560
610
|
elif alignment == 'justify': label.setAlignment(Qt.AlignJustify)
|
|
561
611
|
if 'expand' in command:
|
|
562
612
|
label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
|
|
563
|
-
record
|
|
613
|
+
self.setWidget(record, label)
|
|
564
614
|
return self.nextPC()
|
|
565
615
|
|
|
566
616
|
def r_createPushbutton(self, command, record):
|
|
567
|
-
text = self.getRuntimeValue(command['text'])
|
|
568
|
-
pushbutton = QPushButton(text)
|
|
569
|
-
pushbutton.setAccessibleName(text)
|
|
570
617
|
if 'size' in command:
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
618
|
+
size = self.getRuntimeValue(command['size'])
|
|
619
|
+
else: size = None
|
|
620
|
+
if 'icon' in command:
|
|
621
|
+
iconPath = self.getRuntimeValue(command['icon'])
|
|
622
|
+
pixmap = QPixmap(iconPath)
|
|
623
|
+
if pixmap.isNull():
|
|
624
|
+
RuntimeError(self.program, f'Icon not found: {iconPath}')
|
|
625
|
+
icon = pixmap.scaledToHeight(size if size != None else 24, Qt.SmoothTransformation)
|
|
626
|
+
pushbutton = QPushButton()
|
|
627
|
+
pushbutton.setIcon(icon)
|
|
628
|
+
pushbutton.setIconSize(icon.size())
|
|
629
|
+
elif 'text' in command:
|
|
630
|
+
text = self.getRuntimeValue(command['text'])
|
|
631
|
+
pushbutton = QPushButton(text)
|
|
632
|
+
pushbutton.setAccessibleName(text)
|
|
633
|
+
if size != None:
|
|
634
|
+
fm = pushbutton.fontMetrics()
|
|
635
|
+
c = pushbutton.contentsMargins()
|
|
636
|
+
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) + c.left()+c.right()
|
|
637
|
+
pushbutton.setMaximumWidth(w)
|
|
575
638
|
self.putSymbolValue(record, pushbutton)
|
|
639
|
+
self.setWidget(record, pushbutton)
|
|
576
640
|
return self.nextPC()
|
|
577
641
|
|
|
578
642
|
def r_createCheckBox(self, command, record):
|
|
@@ -594,7 +658,7 @@ class Graphics(Handler):
|
|
|
594
658
|
}
|
|
595
659
|
""")
|
|
596
660
|
checkbox.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
|
|
597
|
-
record
|
|
661
|
+
self.setWidget(record, checkbox)
|
|
598
662
|
return self.nextPC()
|
|
599
663
|
|
|
600
664
|
def r_createLineEdit(self, command, record):
|
|
@@ -605,7 +669,7 @@ class Graphics(Handler):
|
|
|
605
669
|
c = lineinput.contentsMargins()
|
|
606
670
|
w = fm.horizontalAdvance('x') * self.getRuntimeValue(command['size']) +m.left()+m.right()+c.left()+c.right()
|
|
607
671
|
lineinput.setMaximumWidth(w)
|
|
608
|
-
record
|
|
672
|
+
self.setWidget(record, lineinput)
|
|
609
673
|
return self.nextPC()
|
|
610
674
|
|
|
611
675
|
def r_createMultiLineEdit(self, command, record):
|
|
@@ -615,19 +679,19 @@ class Graphics(Handler):
|
|
|
615
679
|
charHeight = fontMetrics.height()
|
|
616
680
|
textinput.setFixedWidth(charWidth * self.getRuntimeValue(command['cols']))
|
|
617
681
|
textinput.setFixedHeight(charHeight * self.getRuntimeValue(command['rows']))
|
|
618
|
-
record
|
|
682
|
+
self.setWidget(record, textinput)
|
|
619
683
|
return self.nextPC()
|
|
620
684
|
|
|
621
685
|
def r_createListWidget(self, command, record):
|
|
622
|
-
record
|
|
686
|
+
self.setWidget(record, QListWidget())
|
|
623
687
|
return self.nextPC()
|
|
624
688
|
|
|
625
689
|
def r_createComboBox(self, command, record):
|
|
626
|
-
record
|
|
690
|
+
self.setWidget(record, QComboBox())
|
|
627
691
|
return self.nextPC()
|
|
628
692
|
|
|
629
693
|
def r_createWidget(self, command, record):
|
|
630
|
-
record
|
|
694
|
+
self.setWidget(record, QWidget())
|
|
631
695
|
return self.nextPC()
|
|
632
696
|
|
|
633
697
|
def r_createDialog(self, command, record):
|
|
@@ -755,12 +819,23 @@ class Graphics(Handler):
|
|
|
755
819
|
def r_group(self, command):
|
|
756
820
|
return self.nextPC()
|
|
757
821
|
|
|
758
|
-
#
|
|
759
|
-
def
|
|
760
|
-
if self.
|
|
761
|
-
self.
|
|
762
|
-
|
|
822
|
+
# hide {widget}
|
|
823
|
+
def k_hide(self, command):
|
|
824
|
+
if self.nextIsSymbol():
|
|
825
|
+
record = self.getSymbolRecord()
|
|
826
|
+
if self.isWidget(record['keyword']):
|
|
827
|
+
command['widget'] = record['name']
|
|
828
|
+
self.add(command)
|
|
829
|
+
return True
|
|
763
830
|
return False
|
|
831
|
+
|
|
832
|
+
def r_hide(self, command):
|
|
833
|
+
record = self.getVariable(command['widget'])
|
|
834
|
+
if 'widget' in record: self.getWidget(record).hide()
|
|
835
|
+
return self.nextPC()
|
|
836
|
+
|
|
837
|
+
# Initialize the graphics environment
|
|
838
|
+
# Unused: def k_init(self, command):
|
|
764
839
|
|
|
765
840
|
def r_init(self, command):
|
|
766
841
|
self.app = QApplication(sys.argv)
|
|
@@ -768,7 +843,22 @@ class Graphics(Handler):
|
|
|
768
843
|
self.program.screenWidth = screen[0]
|
|
769
844
|
self.program.screenHeight = screen[1]
|
|
770
845
|
print(f'Screen: {self.program.screenWidth}x{self.program.screenHeight}')
|
|
771
|
-
return self.nextPC()
|
|
846
|
+
# return self.nextPC()
|
|
847
|
+
def on_last_window_closed():
|
|
848
|
+
self.program.kill()
|
|
849
|
+
def init():
|
|
850
|
+
self.program.flush(self.nextPC())
|
|
851
|
+
def flush():
|
|
852
|
+
if not self.blocked:
|
|
853
|
+
if self.runOnTick != 0:
|
|
854
|
+
self.program.run(self.runOnTick)
|
|
855
|
+
self.program.flushCB()
|
|
856
|
+
timer = QTimer()
|
|
857
|
+
timer.timeout.connect(flush)
|
|
858
|
+
timer.start(10)
|
|
859
|
+
QTimer.singleShot(500, init)
|
|
860
|
+
self.app.lastWindowClosed.connect(on_last_window_closed)
|
|
861
|
+
self.app.exec()
|
|
772
862
|
|
|
773
863
|
# Declare a label variable
|
|
774
864
|
def k_label(self, command):
|
|
@@ -817,11 +907,11 @@ class Graphics(Handler):
|
|
|
817
907
|
# on tick
|
|
818
908
|
def k_on(self, command):
|
|
819
909
|
def setupOn():
|
|
820
|
-
command['goto'] = self.
|
|
910
|
+
command['goto'] = self.getCodeSize() + 2
|
|
821
911
|
self.add(command)
|
|
822
912
|
self.nextToken()
|
|
823
913
|
# Step over the click handler
|
|
824
|
-
pcNext = self.
|
|
914
|
+
pcNext = self.getCodeSize()
|
|
825
915
|
cmd = {}
|
|
826
916
|
cmd['domain'] = 'core'
|
|
827
917
|
cmd['lino'] = command['lino']
|
|
@@ -838,7 +928,7 @@ class Graphics(Handler):
|
|
|
838
928
|
cmd['debug'] = False
|
|
839
929
|
self.add(cmd)
|
|
840
930
|
# Fixup the goto
|
|
841
|
-
self.getCommandAt(pcNext)['goto'] = self.
|
|
931
|
+
self.getCommandAt(pcNext)['goto'] = self.getCodeSize()
|
|
842
932
|
|
|
843
933
|
token = self.nextToken()
|
|
844
934
|
command['type'] = token
|
|
@@ -858,11 +948,11 @@ class Graphics(Handler):
|
|
|
858
948
|
return True
|
|
859
949
|
elif token == 'tick':
|
|
860
950
|
command['tick'] = True
|
|
861
|
-
command['runOnTick'] = self.
|
|
951
|
+
command['runOnTick'] = self.getCodeSize() + 2
|
|
862
952
|
self.add(command)
|
|
863
953
|
self.nextToken()
|
|
864
954
|
# Step over the on tick action
|
|
865
|
-
pcNext = self.
|
|
955
|
+
pcNext = self.getCodeSize()
|
|
866
956
|
cmd = {}
|
|
867
957
|
cmd['domain'] = 'core'
|
|
868
958
|
cmd['lino'] = command['lino']
|
|
@@ -879,13 +969,13 @@ class Graphics(Handler):
|
|
|
879
969
|
cmd['debug'] = False
|
|
880
970
|
self.add(cmd)
|
|
881
971
|
# Fixup the goto
|
|
882
|
-
self.getCommandAt(pcNext)['goto'] = self.
|
|
972
|
+
self.getCommandAt(pcNext)['goto'] = self.getCodeSize()
|
|
883
973
|
return True
|
|
884
974
|
return False
|
|
885
975
|
|
|
886
976
|
def r_on(self, command):
|
|
887
977
|
def run(widget, record):
|
|
888
|
-
for i, w in enumerate(record['
|
|
978
|
+
for i, w in enumerate(record['widget']):
|
|
889
979
|
if w == widget:
|
|
890
980
|
record['index'] = i
|
|
891
981
|
self.run(command['goto'])
|
|
@@ -939,10 +1029,10 @@ class Graphics(Handler):
|
|
|
939
1029
|
record = self.getVariable(command['name'])
|
|
940
1030
|
if variant == 'current':
|
|
941
1031
|
if record['keyword'] == 'combobox':
|
|
942
|
-
widget = record
|
|
1032
|
+
widget = self.getWidget(record)
|
|
943
1033
|
widget.removeItem(widget.currentIndex())
|
|
944
1034
|
if record['keyword'] == 'listbox':
|
|
945
|
-
widget = record
|
|
1035
|
+
widget = self.getWidget(record)
|
|
946
1036
|
selectedItem = widget.currentItem()
|
|
947
1037
|
if selectedItem:
|
|
948
1038
|
row = widget.row(selectedItem)
|
|
@@ -967,7 +1057,7 @@ class Graphics(Handler):
|
|
|
967
1057
|
return False
|
|
968
1058
|
|
|
969
1059
|
def r_select(self, command):
|
|
970
|
-
widget = self.getVariable(command['widget'])
|
|
1060
|
+
widget = self.getWidget(self.getVariable(command['widget']))
|
|
971
1061
|
if 'index' in command:
|
|
972
1062
|
index = self.getRuntimeValue(command['index'])
|
|
973
1063
|
else:
|
|
@@ -1010,9 +1100,10 @@ class Graphics(Handler):
|
|
|
1010
1100
|
self.skip('to')
|
|
1011
1101
|
if self.nextIsSymbol():
|
|
1012
1102
|
record = self.getSymbolRecord()
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1103
|
+
if record['keyword'] == 'layout':
|
|
1104
|
+
command['layout'] = record['name']
|
|
1105
|
+
self.add(command)
|
|
1106
|
+
return True
|
|
1016
1107
|
elif token == 'spacing':
|
|
1017
1108
|
self.skip('of')
|
|
1018
1109
|
if self.nextIsSymbol():
|
|
@@ -1120,25 +1211,26 @@ class Graphics(Handler):
|
|
|
1120
1211
|
def r_set(self, command):
|
|
1121
1212
|
what = command['what']
|
|
1122
1213
|
if what == 'height':
|
|
1123
|
-
widget = self.getVariable(command['name'])
|
|
1214
|
+
widget = self.getWidget(self.getVariable(command['name']))
|
|
1124
1215
|
widget.setFixedHeight(self.getRuntimeValue(command['value']))
|
|
1125
1216
|
elif what == 'width':
|
|
1126
|
-
widget = self.getVariable(command['name'])
|
|
1217
|
+
widget = self.getWidget(self.getVariable(command['name']))
|
|
1127
1218
|
widget.setFixedWidth(self.getRuntimeValue(command['value']))
|
|
1128
1219
|
elif what == 'layout':
|
|
1129
|
-
|
|
1220
|
+
record = self.getVariable(command['layout'])
|
|
1221
|
+
layout = record['widget']
|
|
1130
1222
|
record = self.getVariable(command['name'])
|
|
1131
1223
|
keyword = record['keyword']
|
|
1132
1224
|
if keyword == 'window':
|
|
1133
1225
|
window = record['window']
|
|
1134
1226
|
container = QWidget()
|
|
1135
|
-
container.setLayout(
|
|
1227
|
+
container.setLayout(layout)
|
|
1136
1228
|
window.setCentralWidget(container)
|
|
1137
1229
|
elif keyword == 'widget':
|
|
1138
|
-
widget = record
|
|
1139
|
-
widget.setLayout(
|
|
1230
|
+
widget = self.getWidget(record)
|
|
1231
|
+
widget.setLayout(layout)
|
|
1140
1232
|
elif what == 'spacing':
|
|
1141
|
-
layout = self.getVariable(command['name'])
|
|
1233
|
+
layout = self.getWidget(self.getVariable(command['name']))
|
|
1142
1234
|
layout.setSpacing(self.getRuntimeValue(command['value']))
|
|
1143
1235
|
elif what == 'text':
|
|
1144
1236
|
record = self.getVariable(command['name'])
|
|
@@ -1156,7 +1248,7 @@ class Graphics(Handler):
|
|
|
1156
1248
|
record = self.getVariable(command['name'])
|
|
1157
1249
|
if record['keyword'] == 'checkbox':
|
|
1158
1250
|
state = self.getRuntimeValue(command['value'])
|
|
1159
|
-
record
|
|
1251
|
+
self.getWidget(record).setChecked(state)
|
|
1160
1252
|
elif what == 'alignment':
|
|
1161
1253
|
widget = self.getVariable(command['name'])['widget']
|
|
1162
1254
|
flags = command['value']
|
|
@@ -1195,6 +1287,7 @@ class Graphics(Handler):
|
|
|
1195
1287
|
|
|
1196
1288
|
# show {window}
|
|
1197
1289
|
# show {dialog}
|
|
1290
|
+
# show {widget}
|
|
1198
1291
|
# show {messagebox} giving {result}}
|
|
1199
1292
|
def k_show(self, command):
|
|
1200
1293
|
if self.nextIsSymbol():
|
|
@@ -1208,6 +1301,10 @@ class Graphics(Handler):
|
|
|
1208
1301
|
command['dialog'] = record['name']
|
|
1209
1302
|
self.add(command)
|
|
1210
1303
|
return True
|
|
1304
|
+
elif self.isWidget(keyword):
|
|
1305
|
+
command['name'] = record['name']
|
|
1306
|
+
self.add(command)
|
|
1307
|
+
return True
|
|
1211
1308
|
elif keyword == 'messagebox':
|
|
1212
1309
|
command['messagebox'] = record['name']
|
|
1213
1310
|
self.skip('giving')
|
|
@@ -1268,6 +1365,9 @@ class Graphics(Handler):
|
|
|
1268
1365
|
if dialog.exec() == QDialog.Accepted:
|
|
1269
1366
|
record['result'] = dialog.textEdit.toPlainText()
|
|
1270
1367
|
else: record['result'] = dialog.value
|
|
1368
|
+
elif 'name' in command:
|
|
1369
|
+
record = self.getVariable(command['name'])
|
|
1370
|
+
if 'widget' in record: self.getWidget(record).show()
|
|
1271
1371
|
return self.nextPC()
|
|
1272
1372
|
|
|
1273
1373
|
# Start the graphics
|
|
@@ -1278,21 +1378,22 @@ class Graphics(Handler):
|
|
|
1278
1378
|
return False
|
|
1279
1379
|
|
|
1280
1380
|
def r_start(self, command):
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
timer
|
|
1292
|
-
timer.
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
self.app.
|
|
1381
|
+
return self.nextPC()
|
|
1382
|
+
# def on_last_window_closed():
|
|
1383
|
+
# self.program.kill()
|
|
1384
|
+
# def init():
|
|
1385
|
+
# self.program.flush(self.nextPC())
|
|
1386
|
+
# def flush():
|
|
1387
|
+
# if not self.blocked:
|
|
1388
|
+
# if self.runOnTick != 0:
|
|
1389
|
+
# self.program.run(self.runOnTick)
|
|
1390
|
+
# self.program.flushCB()
|
|
1391
|
+
# timer = QTimer()
|
|
1392
|
+
# timer.timeout.connect(flush)
|
|
1393
|
+
# timer.start(10)
|
|
1394
|
+
# QTimer.singleShot(500, init)
|
|
1395
|
+
# self.app.lastWindowClosed.connect(on_last_window_closed)
|
|
1396
|
+
# self.app.exec()
|
|
1296
1397
|
|
|
1297
1398
|
# Declare a widget variable
|
|
1298
1399
|
def k_widget(self, command):
|
|
@@ -1362,38 +1463,38 @@ class Graphics(Handler):
|
|
|
1362
1463
|
symbolRecord = self.getVariable(symbolRecord['name'])
|
|
1363
1464
|
keyword = symbolRecord['keyword']
|
|
1364
1465
|
if keyword == 'pushbutton':
|
|
1365
|
-
pushbutton = self.
|
|
1466
|
+
pushbutton = self.getWidget(symbolRecord)
|
|
1366
1467
|
v = {}
|
|
1367
1468
|
v['type'] = 'text'
|
|
1368
1469
|
v['content'] = pushbutton.accessibleName()
|
|
1369
1470
|
return v
|
|
1370
1471
|
elif keyword == 'lineinput':
|
|
1371
|
-
lineinput = symbolRecord
|
|
1472
|
+
lineinput = self.getWidget(symbolRecord)
|
|
1372
1473
|
v = {}
|
|
1373
1474
|
v['type'] = 'text'
|
|
1374
1475
|
v['content'] = lineinput.displayText()
|
|
1375
1476
|
return v
|
|
1376
1477
|
elif keyword == 'multiline':
|
|
1377
|
-
multiline = symbolRecord
|
|
1478
|
+
multiline = self.getWidget(symbolRecord)
|
|
1378
1479
|
v = {}
|
|
1379
1480
|
v['type'] = 'text'
|
|
1380
1481
|
v['content'] = multiline.toPlainText()
|
|
1381
1482
|
return v
|
|
1382
1483
|
elif keyword == 'combobox':
|
|
1383
|
-
combobox = symbolRecord
|
|
1484
|
+
combobox = self.getWidget(symbolRecord)
|
|
1384
1485
|
v = {}
|
|
1385
1486
|
v['type'] = 'text'
|
|
1386
1487
|
v['content'] = combobox.currentText()
|
|
1387
1488
|
return v
|
|
1388
1489
|
elif keyword == 'listbox':
|
|
1389
|
-
listbox = symbolRecord
|
|
1490
|
+
listbox = self.getWidget(symbolRecord)
|
|
1390
1491
|
content = listbox.currentItem().text()
|
|
1391
1492
|
v = {}
|
|
1392
1493
|
v['type'] = 'text'
|
|
1393
1494
|
v['content'] = content
|
|
1394
1495
|
return v
|
|
1395
1496
|
elif keyword == 'checkbox':
|
|
1396
|
-
checkbox =
|
|
1497
|
+
checkbox =self.getWidget(symbolRecord)
|
|
1397
1498
|
content = checkbox.isChecked()
|
|
1398
1499
|
v = {}
|
|
1399
1500
|
v['type'] = 'boolean'
|
|
@@ -1410,7 +1511,7 @@ class Graphics(Handler):
|
|
|
1410
1511
|
def v_count(self, v):
|
|
1411
1512
|
record = self.getVariable(v['name'])
|
|
1412
1513
|
keyword = record['keyword']
|
|
1413
|
-
widget = record
|
|
1514
|
+
widget = self.getWidget(record)
|
|
1414
1515
|
if keyword in ['combobox', 'listbox']: content = widget.count()
|
|
1415
1516
|
value = {}
|
|
1416
1517
|
value['type'] = 'int'
|
|
@@ -1420,7 +1521,7 @@ class Graphics(Handler):
|
|
|
1420
1521
|
def v_current(self, v):
|
|
1421
1522
|
record = self.getVariable(v['name'])
|
|
1422
1523
|
keyword = record['keyword']
|
|
1423
|
-
widget = record
|
|
1524
|
+
widget = self.getWidget(record)
|
|
1424
1525
|
if keyword == 'listbox': content = widget.currentItem().text()
|
|
1425
1526
|
value = {}
|
|
1426
1527
|
value['type'] = 'text'
|
|
@@ -1430,8 +1531,9 @@ class Graphics(Handler):
|
|
|
1430
1531
|
#############################################################################
|
|
1431
1532
|
# Compile a condition
|
|
1432
1533
|
def compileCondition(self):
|
|
1433
|
-
condition =
|
|
1434
|
-
|
|
1534
|
+
condition = Object()
|
|
1535
|
+
condition.negate = False
|
|
1536
|
+
return None
|
|
1435
1537
|
|
|
1436
1538
|
#############################################################################
|
|
1437
1539
|
# Condition handlers
|
|
@@ -1440,4 +1542,4 @@ class Graphics(Handler):
|
|
|
1440
1542
|
# Force the application to exit
|
|
1441
1543
|
def force_exit(self):
|
|
1442
1544
|
QApplication.quit() # Gracefully close the application
|
|
1443
|
-
sys.exit(0) # Force a complete system exit
|
|
1545
|
+
sys.exit(0) # Force a complete system exit
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 251104.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,19 @@
|
|
|
1
|
+
easycoder/__init__.py,sha256=7ZoWrgGr2R_dOw69Yis1-y0u8zR8AAQ24gN0GpfM5rc,339
|
|
2
|
+
easycoder/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
|
|
3
|
+
easycoder/ec_border.py,sha256=KpOy0Jq8jI_6DYGo4jaFvoBP_jTIoAYWrmuHhl-FXA4,2355
|
|
4
|
+
easycoder/ec_classes.py,sha256=YGUiKnVN6T5scoeBmmGDQAtE8xJgaTHi0Exh9A7H2Y4,1750
|
|
5
|
+
easycoder/ec_compiler.py,sha256=2bdB7Bb4Cn_Uj7g0wjDn_gO0gQivqeaFellbgbAT2Hg,6587
|
|
6
|
+
easycoder/ec_condition.py,sha256=uamZrlW3Ej3R4bPDuduGB2f00M80Z1D0qV8muDx4Qfw,784
|
|
7
|
+
easycoder/ec_core.py,sha256=K89KR1z_clnubQgq_-L3SiTTRI4qs2ue1MhuUkB9xoU,100888
|
|
8
|
+
easycoder/ec_handler.py,sha256=doGCMXBCQxvSaD3omKMlXoR_LvQODxV7dZyoWafecyg,2336
|
|
9
|
+
easycoder/ec_keyboard.py,sha256=H8DhPT8-IvAIGgRxCs4qSaF_AQLaS6lxxtDteejbktM,19010
|
|
10
|
+
easycoder/ec_program.py,sha256=aPuZOYWFqGd1jsLDl5M5YmLu5LfFAewF9EZh6zHIbyM,10308
|
|
11
|
+
easycoder/ec_pyside.py,sha256=DwHMsk5kDBXg8feSbkyUinGWPO1a4uH-rcT3F9J4Aiw,58287
|
|
12
|
+
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
13
|
+
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
14
|
+
easycoder/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
|
|
15
|
+
easycoder-251104.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
16
|
+
easycoder-251104.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
+
easycoder-251104.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
18
|
+
easycoder-251104.1.dist-info/METADATA,sha256=jWlzWZY1kVcRNkxMiIn6SGBsgK3UESTSnMhp8KlG064,6897
|
|
19
|
+
easycoder-251104.1.dist-info/RECORD,,
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=UtclhKbGdjMumFBAT_zAsSck8VnFGCK4NPb1ZcBqMdE,339
|
|
2
|
-
easycoder/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
|
|
3
|
-
easycoder/ec_border.py,sha256=KpOy0Jq8jI_6DYGo4jaFvoBP_jTIoAYWrmuHhl-FXA4,2355
|
|
4
|
-
easycoder/ec_classes.py,sha256=bejrby7mLHTeAQXhhz-1l8iv6LSbNSy30lW21KJKjXE,1832
|
|
5
|
-
easycoder/ec_compiler.py,sha256=zImpvvSEfHRGe5MiIgmiu2i7rJxsB4pVLujqmHaOqTo,5392
|
|
6
|
-
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
7
|
-
easycoder/ec_core.py,sha256=s7Ovz6iTjlMqVk-tmsnOH-EEECHxsudgUF1EAlIsOZ4,98044
|
|
8
|
-
easycoder/ec_handler.py,sha256=ED08ULiOlZkcs4XHxAguvdPZw_dFXuwGDFLbFuo0kLs,2317
|
|
9
|
-
easycoder/ec_keyboard.py,sha256=ru-HdWolBMZJPyck2s72In9tXFeLJQSPtR1TpjmIo90,18350
|
|
10
|
-
easycoder/ec_program.py,sha256=3KM9n_SAChUgUnRxhPCnA75K2FP1fgxjW8z1YUA3cL4,10140
|
|
11
|
-
easycoder/ec_pyside.py,sha256=m_xyuE3GR-vjPdsrp5bmHmZ_KePRlMgXF6gW9zKeFzo,54080
|
|
12
|
-
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
13
|
-
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
14
|
-
easycoder/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
|
|
15
|
-
easycoder-250826.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
16
|
-
easycoder-250826.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
-
easycoder-250826.2.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
18
|
-
easycoder-250826.2.dist-info/METADATA,sha256=0-hj10IUXVcvGCF9KY-hnxcfOrHIDGPJ33JaJDx2Po8,6897
|
|
19
|
-
easycoder-250826.2.dist-info/RECORD,,
|