easycoder 250824.2__py2.py3-none-any.whl → 250826.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
@@ -12,4 +12,4 @@ from .ec_pyside import *
12
12
  from .ec_timestamp import *
13
13
  from .ec_value import *
14
14
 
15
- __version__ = "250824.2"
15
+ __version__ = "250826.1"
easycoder/ec_classes.py CHANGED
@@ -5,7 +5,7 @@ class FatalError:
5
5
  compiler.showWarnings()
6
6
  lino = compiler.tokens[compiler.index].lino
7
7
  script = compiler.script.lines[lino].strip()
8
- print(f'Compile error in {compiler.program.name} at line {lino + 1} ({script}): {message}')
8
+ print(f'Compile error in {compiler.program.name} at line {lino + 1} ({script}):\n-> {message}')
9
9
  sys.exit()
10
10
 
11
11
  class NoValueError(FatalError):
@@ -31,7 +31,7 @@ class RuntimeError:
31
31
  code = program.code[program.pc]
32
32
  lino = code['lino']
33
33
  script = program.script.lines[lino].strip()
34
- print(f'Runtime Error in {program.name} at line {lino + 1} ({script}): {message}')
34
+ print(f'Runtime Error in {program.name} at line {lino + 1} ({script}):\n-> {message}')
35
35
  sys.exit()
36
36
 
37
37
  class NoValueRuntimeError(RuntimeError):
easycoder/ec_compiler.py CHANGED
@@ -119,6 +119,9 @@ class Compiler:
119
119
 
120
120
  def getSymbolRecord(self):
121
121
  token = self.getToken()
122
+ if not token in self.symbols:
123
+ FatalError(self, f'Undefined symbol name "{token}"')
124
+ return None
122
125
  symbol = self.symbols[token]
123
126
  if symbol == None: return None
124
127
  symbolRecord = self.code[symbol]
easycoder/ec_core.py CHANGED
@@ -540,11 +540,11 @@ class Core(Handler):
540
540
 
541
541
  def r_gosub(self, command):
542
542
  label = command['gosub'] + ':'
543
- address = self.symbols[label]
544
- if address != None:
543
+ if label in self.symbols:
544
+ address = self.symbols[label]
545
545
  self.stack.append(self.nextPC())
546
546
  return address
547
- RuntimeError(self.program, f'There is no label "{label + ":"}"')
547
+ RuntimeError(self.program, f'There is no label "{label}"')
548
548
  return None
549
549
 
550
550
  # if <condition> <action> [else <action>]
easycoder/ec_handler.py CHANGED
@@ -36,6 +36,7 @@ class Handler:
36
36
  self.testCondition = self.program.condition.testCondition
37
37
  self.symbols = self.program.symbols
38
38
  self.stack = self.program.stack
39
+ self.getSymbolContent = self.program.getSymbolContent
39
40
  self.getSymbolValue = self.program.getSymbolValue
40
41
  self.putSymbolValue = self.program.putSymbolValue
41
42
  self.run = self.program.run
easycoder/ec_program.py CHANGED
@@ -197,6 +197,11 @@ class Program:
197
197
  return ''
198
198
  return None
199
199
 
200
+ def getSymbolContent(self, symbolRecord):
201
+ if len(symbolRecord['value']) == 0:
202
+ return None
203
+ return symbolRecord['value'][symbolRecord['index']]
204
+
200
205
  def getSymbolValue(self, symbolRecord):
201
206
  if len(symbolRecord['value']) == 0:
202
207
  return None
easycoder/ec_pyside.py CHANGED
@@ -1,4 +1,5 @@
1
- import sys, os
1
+ import sys
2
+ from functools import partial
2
3
  from .ec_handler import Handler
3
4
  from .ec_classes import RuntimeError
4
5
  from .ec_border import Border
@@ -63,11 +64,16 @@ class Graphics(Handler):
63
64
  'lineinput',
64
65
  'multiline',
65
66
  'listbox',
66
- 'combobox'
67
+ 'combobox',
68
+ 'widget'
67
69
  ]
68
70
 
69
71
  def dialogTypes(self):
70
72
  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']
71
77
 
72
78
  class ClickableLineEdit(QLineEdit):
73
79
  clicked = Signal()
@@ -198,13 +204,13 @@ class Graphics(Handler):
198
204
  layoutRecord = self.getVariable(command['layout'])
199
205
  widget = command['widget']
200
206
  if widget == 'stretch':
201
- layoutRecord['widget'].addStretch()
207
+ self.getWidget(layoutRecord).addStretch()
202
208
  elif widget == 'spacer':
203
- layoutRecord['widget'].addSpacing(self.getRuntimeValue(command['size']))
209
+ self.getWidget(layoutRecord).addSpacing(self.getRuntimeValue(command['size']))
204
210
  else:
205
211
  widgetRecord = self.getVariable(widget)
206
212
  layoutRecord = self.getVariable(command['layout'])
207
- widget = widgetRecord['widget']
213
+ widget = self.getWidget(widgetRecord)
208
214
  layout = layoutRecord['widget']
209
215
  stretch = 'stretch' in command
210
216
  if widgetRecord['keyword'] == 'layout':
@@ -264,7 +270,8 @@ class Graphics(Handler):
264
270
  return False
265
271
 
266
272
  def r_clear(self, command):
267
- self.getVariable(command['name'])['widget'].clear()
273
+ widget = self.getVariable(command['name'])['widget']
274
+ widget.clear()
268
275
  return self.nextPC()
269
276
 
270
277
  # close {window}
@@ -418,11 +425,7 @@ class Graphics(Handler):
418
425
  self.add(command)
419
426
  return True
420
427
 
421
- def k_createListWidget(self, command):
422
- self.add(command)
423
- return True
424
-
425
- def k_createComboBox(self, command):
428
+ def k_createWidget(self, command):
426
429
  self.add(command)
427
430
  return True
428
431
 
@@ -489,6 +492,7 @@ class Graphics(Handler):
489
492
  command['name'] = record['name']
490
493
  keyword = record['keyword']
491
494
  if keyword == 'window': return self.k_createWindow(command)
495
+ elif keyword in ['listbox', 'combobox', 'widget']: return self.k_createWidget(command)
492
496
  elif keyword == 'layout': return self.k_createLayout(command)
493
497
  elif keyword == 'group': return self.k_createGroupBox(command)
494
498
  elif keyword == 'label': return self.k_createLabel(command)
@@ -496,8 +500,6 @@ class Graphics(Handler):
496
500
  elif keyword == 'checkbox': return self.k_createCheckBox(command)
497
501
  elif keyword == 'lineinput': return self.k_createLineEdit(command)
498
502
  elif keyword == 'multiline': return self.k_createMultiLineEdit(command)
499
- elif keyword == 'listbox': return self.k_createListWidget(command)
500
- elif keyword == 'combobox': return self.k_createComboBox(command)
501
503
  elif keyword == 'dialog': return self.k_createDialog(command)
502
504
  elif keyword == 'messagebox': return self.k_createMessageBox(command)
503
505
  return False
@@ -570,7 +572,7 @@ class Graphics(Handler):
570
572
  c = pushbutton.contentsMargins()
571
573
  w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) + c.left()+c.right()
572
574
  pushbutton.setMaximumWidth(w)
573
- record['widget'] = pushbutton
575
+ self.putSymbolValue(record, pushbutton)
574
576
  return self.nextPC()
575
577
 
576
578
  def r_createCheckBox(self, command, record):
@@ -624,6 +626,10 @@ class Graphics(Handler):
624
626
  record['widget'] = QComboBox()
625
627
  return self.nextPC()
626
628
 
629
+ def r_createWidget(self, command, record):
630
+ record['widget'] = QWidget()
631
+ return self.nextPC()
632
+
627
633
  def r_createDialog(self, command, record):
628
634
 
629
635
  class ECDialog(QDialog):
@@ -706,6 +712,7 @@ class Graphics(Handler):
706
712
  elif keyword == 'multiline': return self.r_createMultiLineEdit(command, record)
707
713
  elif keyword == 'listbox': return self.r_createListWidget(command, record)
708
714
  elif keyword == 'combobox': return self.r_createComboBox(command, record)
715
+ elif keyword == 'widget': return self.r_createWidget(command, record)
709
716
  elif keyword == 'dialog': return self.r_createDialog(command, record)
710
717
  elif keyword == 'messagebox': return self.r_createMessageBox(command, record)
711
718
  return None
@@ -877,14 +884,22 @@ class Graphics(Handler):
877
884
  return False
878
885
 
879
886
  def r_on(self, command):
887
+ def run(widget, record):
888
+ for i, w in enumerate(record['value']):
889
+ if w == widget:
890
+ record['index'] = i
891
+ self.run(command['goto'])
892
+ return
893
+
880
894
  if command['type'] == 'tick':
881
895
  self.runOnTick = command['runOnTick']
882
896
  else:
883
897
  record = self.getVariable(command['name'])
884
- widget = record['widget']
898
+ widget = self.getWidget(record)
885
899
  keyword = record['keyword']
886
900
  if keyword == 'pushbutton':
887
- widget.clicked.connect(lambda: self.run(command['goto']))
901
+ handler = partial(run, widget, record)
902
+ widget.clicked.connect(handler)
888
903
  elif keyword == 'combobox':
889
904
  widget.currentIndexChanged.connect(lambda: self.run(command['goto']))
890
905
  elif keyword == 'listbox':
@@ -1126,7 +1141,6 @@ class Graphics(Handler):
1126
1141
  layout = self.getVariable(command['name'])['widget']
1127
1142
  layout.setSpacing(self.getRuntimeValue(command['value']))
1128
1143
  elif what == 'text':
1129
- record = self.getVariable(command['name'])
1130
1144
  widget = self.getVariable(command['name'])['widget']
1131
1145
  text = self.getRuntimeValue(command['value'])
1132
1146
  keyword = record['keyword']
@@ -1156,19 +1170,23 @@ class Graphics(Handler):
1156
1170
  elif flag == 'center': alignment |= Qt.AlignCenter
1157
1171
  widget.setAlignment(alignment)
1158
1172
  elif what == 'style':
1159
- widget = self.getVariable(command['name'])['widget']
1173
+ record = self.getVariable(command['name'])
1174
+ widget = self.getWidget(record)
1160
1175
  styles = self.getRuntimeValue(command['value'])
1161
1176
  widget.setStyleSheet(styles)
1162
1177
  elif what == 'color':
1163
- widget = self.getVariable(command['name'])['widget']
1178
+ record = self.getVariable(command['name'])
1179
+ widget = self.getWidget(record)
1164
1180
  color = self.getRuntimeValue(command['value'])
1165
1181
  widget.setStyleSheet(f"color: {color};")
1166
1182
  elif what == 'background-color':
1167
- widget = self.getVariable(command['name'])['widget']
1183
+ record = self.getVariable(command['name'])
1184
+ widget = self.getWidget(record)
1168
1185
  bg_color = self.getRuntimeValue(command['value'])
1169
1186
  widget.setStyleSheet(f"background-color: {bg_color};")
1170
1187
  elif what == 'listbox':
1171
- widget = self.getVariable(command['name'])['widget']
1188
+ record = self.getVariable(command['name'])
1189
+ widget = self.getWidget(record)
1172
1190
  value = self.getRuntimeValue(command['value'])
1173
1191
  widget.clear()
1174
1192
  widget.addItems(value)
@@ -1343,7 +1361,7 @@ class Graphics(Handler):
1343
1361
  symbolRecord = self.getVariable(symbolRecord['name'])
1344
1362
  keyword = symbolRecord['keyword']
1345
1363
  if keyword == 'pushbutton':
1346
- pushbutton = symbolRecord['widget']
1364
+ pushbutton = self.getSymbolContent() # symbolRecord['widget']
1347
1365
  v = {}
1348
1366
  v['type'] = 'text'
1349
1367
  v['content'] = pushbutton.accessibleName()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easycoder
3
- Version: 250824.2
3
+ Version: 250826.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=_cfIh6Ck6_0pIwvg1NT2bpdJmGs9irBEUZ_ufwNg2cw,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=6gT4s72x8wmEJ9_CVFleS1jCMLPHkmqlHmGO11Hmk0k,54022
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.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
+ easycoder-250826.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ easycoder-250826.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
18
+ easycoder-250826.1.dist-info/METADATA,sha256=1TGs8P_kbNuJVhELT1honrDIUt3RTOE6mw2arWQ5cVI,6897
19
+ easycoder-250826.1.dist-info/RECORD,,
@@ -1,19 +0,0 @@
1
- easycoder/__init__.py,sha256=FBDKkZRmKr4-4O6k4qlAGQdcF1e9_WuEOOjNatbcRXo,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=PWPaJuTfaWD4-tgT-2WWOgeFV_jXxlxyKCxvXyylCUU,1824
5
- easycoder/ec_compiler.py,sha256=-uuXDbfgFBGXSrr7EneDnnneFOFsU-UuCIpNHsCqY0s,5289
6
- easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
7
- easycoder/ec_core.py,sha256=r0bFQV3LXCCh4CP6289h6UvK6gpq4L0BQDrEWkeVo_0,98040
8
- easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
9
- easycoder/ec_keyboard.py,sha256=ru-HdWolBMZJPyck2s72In9tXFeLJQSPtR1TpjmIo90,18350
10
- easycoder/ec_program.py,sha256=7h2QKGunsiu5l2OKn-sw-Dd70kZJrb4b2idHubeSXDs,9989
11
- easycoder/ec_pyside.py,sha256=0hIyQRWiYu-cTZiekVXg0CuIVWOrFrAI7R1fk12lYMQ,53342
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-250824.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
16
- easycoder-250824.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- easycoder-250824.2.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
18
- easycoder-250824.2.dist-info/METADATA,sha256=vWzjOLuY0i8teLLIPL_NJ3JsoOVOJHVd3A6r3aQl_Wo,6897
19
- easycoder-250824.2.dist-info/RECORD,,