easycoder 250423.2__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 CHANGED
@@ -9,4 +9,4 @@ from .ec_program import *
9
9
  from .ec_timestamp import *
10
10
  from .ec_value import *
11
11
 
12
- __version__ = "250423.2"
12
+ __version__ = "250424.3"
easycoder/ec_core.py CHANGED
@@ -717,7 +717,7 @@ class Core(Handler):
717
717
  try:
718
718
  with open(filename) as f: content = f.read()
719
719
  except:
720
- RuntimeError(self.program, f'File \'{filename}\' not found')
720
+ content = ''
721
721
  try:
722
722
  if filename.endswith('.json'): content = json.loads(content)
723
723
  except:
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
- command['w'] = self.nextValue()
180
- command['h'] = self.nextValue()
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() == 'title':
296
+ if self.peek() == 'on':
264
297
  self.nextToken()
265
- title = self.nextValue()
266
- else: title = ''
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.nextIs('on'):
316
+ if self.peek() == 'on':
317
+ self.nextToken()
273
318
  if self.nextIsSymbol():
274
319
  command['window'] = self.getSymbolRecord()['name']
275
- style = 'question'
276
- title = ''
277
- message = ''
278
- while True:
279
- if self.peek() == 'style':
280
- self.nextToken()
281
- style = self.nextToken()
282
- elif self.peek() == 'title':
283
- self.nextToken()
284
- title = self.nextValue()
285
- elif self.peek() == 'message':
286
- self.nextToken()
287
- message = self.nextValue()
288
- else: break
289
- command['style'] = style
290
- command['title'] = title
291
- command['message'] = message
292
- self.add(command)
293
- return True
294
- return False
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('x') * self.getRuntimeValue(command['size']) +c.left()+c.right()
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('x') * self.getRuntimeValue(command['size']) +c.left()+c.right()
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
 
@@ -601,22 +655,17 @@ class Graphics(Handler):
601
655
  groupbox.setFixedHeight(self.getRuntimeValue(command['value']))
602
656
  return self.nextPC()
603
657
 
604
- # Show something
605
- # show {name} in {window}}
606
- # show {dialog}/{messagebox}
658
+ # show {window}
659
+ # show {dialog}
660
+ # show {messagebox} giving {result}}
607
661
  def k_show(self, command):
608
662
  if self.nextIsSymbol():
609
663
  record = self.getSymbolRecord()
610
664
  keyword = record['keyword']
611
- if keyword == 'layout':
612
- command['layout'] = record['name']
613
- if self.nextIs('in'):
614
- if self.nextIsSymbol():
615
- record = self.getSymbolRecord()
616
- if record['keyword'] == 'window':
617
- command['window'] = record['name']
618
- self.add(command)
619
- return True
665
+ if keyword == 'window':
666
+ command['window'] = record['name']
667
+ self.add(command)
668
+ return True
620
669
  elif keyword == 'dialog':
621
670
  command['dialog'] = record['name']
622
671
  self.add(command)
@@ -631,13 +680,7 @@ class Graphics(Handler):
631
680
  return False
632
681
 
633
682
  def r_show(self, command):
634
- if 'dialog' in command:
635
- dialog = self.getVariable(command['dialog'])['dialog']
636
- b1 = QPushButton("ok",dialog)
637
- b1.move(50,50)
638
- dialog.setWindowModality(Qt.ApplicationModal)
639
- dialog.exec_()
640
- elif 'messagebox' in command:
683
+ if 'messagebox' in command:
641
684
  data = self.getVariable(command['messagebox'])['data']
642
685
  symbolRecord = self.getVariable(command['result'])
643
686
  window = self.getVariable(data['window'])['window']
@@ -657,14 +700,12 @@ class Graphics(Handler):
657
700
  v['type'] = 'text'
658
701
  v['content'] = result
659
702
  self.putSymbolValue(symbolRecord, v)
660
- else:
661
- layoutRecord = self.getVariable(command['layout'])
662
- windowRecord = self.getVariable(command['window'])
663
- window = windowRecord['window']
664
- container = QWidget()
665
- container.setLayout(layoutRecord['widget'])
666
- window.setCentralWidget(container)
703
+ elif 'window' in command:
704
+ window = self.getVariable(command['window'])['window']
667
705
  window.show()
706
+ elif 'dialog' in command:
707
+ dialog = self.getVariable(command['dialog'])['dialog']
708
+ dialog.exec()
668
709
  return self.nextPC()
669
710
 
670
711
  # Start the graphics
@@ -734,7 +775,13 @@ class Graphics(Handler):
734
775
  def v_symbol(self, symbolRecord):
735
776
  symbolRecord = self.getVariable(symbolRecord['name'])
736
777
  keyword = symbolRecord['keyword']
737
- if keyword == 'combobox':
778
+ if keyword == 'lineinput':
779
+ lineinput = symbolRecord['widget']
780
+ v = {}
781
+ v['type'] = 'text'
782
+ v['content'] = lineinput.displayText()
783
+ return v
784
+ elif keyword == 'combobox':
738
785
  combobox = symbolRecord['widget']
739
786
  v = {}
740
787
  v['type'] = 'text'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: easycoder
3
- Version: 250423.2
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>
@@ -1,18 +1,18 @@
1
1
  easycoder/README.md,sha256=BVXmYphcTJ6q6RN_9L6HtQukgCnOjSLVIsTM3lk-9aM,587
2
- easycoder/__init__.py,sha256=rXpc2iuRmzM8KsgUZWefLoHMii_uABr61154GK0iZ_0,262
2
+ easycoder/__init__.py,sha256=U91pzIS30xf6fU78HzxaL0kYq6R3saY-_c-EAacke8w,262
3
3
  easycoder/ec_classes.py,sha256=xnWBNak8oKydkFoxHLlq9wo3lIsB3aMnTDrqbtCfoWo,1512
4
4
  easycoder/ec_compiler.py,sha256=WN4DMTU66kzOAwOGJe3KDoXj2nPvq19ACegQ-RSMglo,4780
5
5
  easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
6
- easycoder/ec_core.py,sha256=X66TBECPnp-82lEcCpaiJuXSy4Ex519iBK2BM-wGHaQ,90611
6
+ easycoder/ec_core.py,sha256=RHFdEMgudlLPUOisbzj_sdvrWfokoPOYKv_T8oV19ag,90563
7
7
  easycoder/ec_graphics.py,sha256=WXxKMB4GJSmxvk-FVbOTyufiUx4TYIzyDoB1PCAO3JY,16067
8
8
  easycoder/ec_gutils.py,sha256=yqu4RRQ6VdRkC5B2ADBYsXzgNu76dLnekd9aUjdEgPw,6399
9
9
  easycoder/ec_handler.py,sha256=K7nBuQTH8l0k8hX1o2b4KhTnhZHGdf2fkEuX4FJXJs8,2277
10
10
  easycoder/ec_program.py,sha256=ZCcvI36iq9HG4o8rFwFxzVElzZ7PEeNOPMr8eqwz8ns,10010
11
- easycoder/ec_pyside6.py,sha256=0Z-uWrCq7Uz_C6WjN-9E0TDI-IHny14-j5sTc1a3LLg,26627
11
+ easycoder/ec_pyside6.py,sha256=Ii3k3UV8nrmv_QqE6FrZuDSjnBXVTzhPy65k0KlvcGE,28339
12
12
  easycoder/ec_timestamp.py,sha256=_3QFJPzIWZ9Rzk3SQOQJ-gwmvB07pg78k23SPntoZtY,288
13
13
  easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
14
- easycoder-250423.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
15
- easycoder-250423.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
16
- easycoder-250423.2.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
17
- easycoder-250423.2.dist-info/METADATA,sha256=XZhRQ-0z-KpgImt8Nvyk46I6V_lZ1M2aet5VoR8hHYs,5617
18
- easycoder-250423.2.dist-info/RECORD,,
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,,