easycoder 250820.1__py2.py3-none-any.whl → 250825.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 +2 -1
- easycoder/ec_border.py +63 -0
- easycoder/ec_classes.py +2 -2
- easycoder/ec_compiler.py +3 -0
- easycoder/ec_core.py +3 -3
- easycoder/ec_keyboard.py +2 -61
- easycoder/ec_pyside.py +124 -58
- {easycoder-250820.1.dist-info → easycoder-250825.1.dist-info}/METADATA +1 -1
- easycoder-250825.1.dist-info/RECORD +19 -0
- easycoder-250820.1.dist-info/RECORD +0 -18
- {easycoder-250820.1.dist-info → easycoder-250825.1.dist-info}/WHEEL +0 -0
- {easycoder-250820.1.dist-info → easycoder-250825.1.dist-info}/entry_points.txt +0 -0
- {easycoder-250820.1.dist-info → easycoder-250825.1.dist-info}/licenses/LICENSE +0 -0
easycoder/__init__.py
CHANGED
|
@@ -6,9 +6,10 @@ from .ec_condition import *
|
|
|
6
6
|
from .ec_core import *
|
|
7
7
|
from .ec_handler import *
|
|
8
8
|
from .ec_keyboard import *
|
|
9
|
+
from .ec_border import *
|
|
9
10
|
from .ec_program import *
|
|
10
11
|
from .ec_pyside import *
|
|
11
12
|
from .ec_timestamp import *
|
|
12
13
|
from .ec_value import *
|
|
13
14
|
|
|
14
|
-
__version__ = "
|
|
15
|
+
__version__ = "250825.1"
|
easycoder/ec_border.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from PySide6.QtWidgets import QWidget
|
|
3
|
+
from PySide6.QtGui import QPixmap, QPainter
|
|
4
|
+
from PySide6.QtCore import Qt, Signal, QRect
|
|
5
|
+
|
|
6
|
+
class Border(QWidget):
|
|
7
|
+
tickClicked = Signal()
|
|
8
|
+
closeClicked = Signal()
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__()
|
|
12
|
+
self.size = 40
|
|
13
|
+
self.setFixedHeight(self.size)
|
|
14
|
+
self._drag_active = False
|
|
15
|
+
self._drag_start_pos = None
|
|
16
|
+
|
|
17
|
+
def paintEvent(self, event):
|
|
18
|
+
painter = QPainter(self)
|
|
19
|
+
painter.setRenderHint(QPainter.Antialiasing)
|
|
20
|
+
# Draw the tick icon
|
|
21
|
+
self.tick = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/tick.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
22
|
+
x = 0
|
|
23
|
+
y = 0
|
|
24
|
+
painter.drawPixmap(x, y, self.tick)
|
|
25
|
+
# Draw the close icon
|
|
26
|
+
self.close = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/close.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
27
|
+
x = self.width() - self.close.width()
|
|
28
|
+
y = 0
|
|
29
|
+
painter.drawPixmap(x, y, self.close)
|
|
30
|
+
|
|
31
|
+
def mousePressEvent(self, event):
|
|
32
|
+
# Tick icon
|
|
33
|
+
x = 0
|
|
34
|
+
y = 0
|
|
35
|
+
tickRect = self.tick.rect().translated(x, y)
|
|
36
|
+
# Close icon
|
|
37
|
+
x = self.width() - self.close.width()
|
|
38
|
+
y = 0
|
|
39
|
+
closeRect = self.close.rect().translated(x, y)
|
|
40
|
+
if tickRect.contains(event.pos()):
|
|
41
|
+
self.tickClicked.emit()
|
|
42
|
+
if closeRect.contains(event.pos()):
|
|
43
|
+
self.closeClicked.emit()
|
|
44
|
+
elif QRect(0, 0, self.width(), self.height()).contains(event.pos()):
|
|
45
|
+
if hasattr(self.window().windowHandle(), 'startSystemMove'):
|
|
46
|
+
self.window().windowHandle().startSystemMove()
|
|
47
|
+
else:
|
|
48
|
+
self._drag_active = True
|
|
49
|
+
self._drag_start_pos = event.globalPosition().toPoint()
|
|
50
|
+
self._dialog_start_pos = self.window().pos()
|
|
51
|
+
else:
|
|
52
|
+
super().mousePressEvent(event)
|
|
53
|
+
|
|
54
|
+
def mouseMoveEvent(self, event):
|
|
55
|
+
if self._drag_active:
|
|
56
|
+
delta = event.globalPosition().toPoint() - self._drag_start_pos
|
|
57
|
+
self.window().move(self._dialog_start_pos + delta)
|
|
58
|
+
else:
|
|
59
|
+
super().mouseMoveEvent(event)
|
|
60
|
+
|
|
61
|
+
def mouseReleaseEvent(self, event):
|
|
62
|
+
self._drag_active = False
|
|
63
|
+
super().mouseReleaseEvent(event)
|
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})
|
|
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})
|
|
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
|
-
|
|
544
|
-
|
|
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_keyboard.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import os
|
|
2
1
|
from .ec_handler import Handler
|
|
2
|
+
from .ec_border import Border
|
|
3
3
|
from PySide6.QtWidgets import (
|
|
4
4
|
QDialog,
|
|
5
5
|
QVBoxLayout,
|
|
@@ -18,65 +18,6 @@ from PySide6.QtCore import Qt, QTimer, Signal, QRect
|
|
|
18
18
|
|
|
19
19
|
class Keyboard(Handler):
|
|
20
20
|
iconClicked = Signal()
|
|
21
|
-
|
|
22
|
-
class Border(QWidget):
|
|
23
|
-
tickClicked = Signal()
|
|
24
|
-
closeClicked = Signal()
|
|
25
|
-
|
|
26
|
-
def __init__(self):
|
|
27
|
-
super().__init__()
|
|
28
|
-
self.size = 40
|
|
29
|
-
self.setFixedHeight(self.size)
|
|
30
|
-
self._drag_active = False
|
|
31
|
-
self._drag_start_pos = None
|
|
32
|
-
|
|
33
|
-
def paintEvent(self, event):
|
|
34
|
-
painter = QPainter(self)
|
|
35
|
-
painter.setRenderHint(QPainter.Antialiasing)
|
|
36
|
-
# Draw the tick icon
|
|
37
|
-
self.tick = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/tick.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
38
|
-
x = 0
|
|
39
|
-
y = 0
|
|
40
|
-
painter.drawPixmap(x, y, self.tick)
|
|
41
|
-
# Draw the close icon
|
|
42
|
-
self.close = QPixmap(f'{os.path.dirname(os.path.abspath(__file__))}/close.png').scaled(self.size, self.size, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
43
|
-
x = self.width() - self.close.width()
|
|
44
|
-
y = 0
|
|
45
|
-
painter.drawPixmap(x, y, self.close)
|
|
46
|
-
|
|
47
|
-
def mousePressEvent(self, event):
|
|
48
|
-
# Tick icon
|
|
49
|
-
x = 0
|
|
50
|
-
y = 0
|
|
51
|
-
tickRect = self.tick.rect().translated(x, y)
|
|
52
|
-
# Close icon
|
|
53
|
-
x = self.width() - self.close.width()
|
|
54
|
-
y = 0
|
|
55
|
-
closeRect = self.close.rect().translated(x, y)
|
|
56
|
-
if tickRect.contains(event.pos()):
|
|
57
|
-
self.tickClicked.emit()
|
|
58
|
-
if closeRect.contains(event.pos()):
|
|
59
|
-
self.closeClicked.emit()
|
|
60
|
-
elif QRect(0, 0, self.width(), self.height()).contains(event.pos()):
|
|
61
|
-
if hasattr(self.window().windowHandle(), 'startSystemMove'):
|
|
62
|
-
self.window().windowHandle().startSystemMove()
|
|
63
|
-
else:
|
|
64
|
-
self._drag_active = True
|
|
65
|
-
self._drag_start_pos = event.globalPosition().toPoint()
|
|
66
|
-
self._dialog_start_pos = self.window().pos()
|
|
67
|
-
else:
|
|
68
|
-
super().mousePressEvent(event)
|
|
69
|
-
|
|
70
|
-
def mouseMoveEvent(self, event):
|
|
71
|
-
if self._drag_active:
|
|
72
|
-
delta = event.globalPosition().toPoint() - self._drag_start_pos
|
|
73
|
-
self.window().move(self._dialog_start_pos + delta)
|
|
74
|
-
else:
|
|
75
|
-
super().mouseMoveEvent(event)
|
|
76
|
-
|
|
77
|
-
def mouseReleaseEvent(self, event):
|
|
78
|
-
self._drag_active = False
|
|
79
|
-
super().mouseReleaseEvent(event)
|
|
80
21
|
|
|
81
22
|
def __init__(self, program, keyboardType, receiverLayout, receivers, caller = None, parent=None):
|
|
82
23
|
super().__init__(program.compiler)
|
|
@@ -103,7 +44,7 @@ class Keyboard(Handler):
|
|
|
103
44
|
# Add the keyboard
|
|
104
45
|
layout = QVBoxLayout(dialog)
|
|
105
46
|
|
|
106
|
-
border =
|
|
47
|
+
border = Border()
|
|
107
48
|
border.tickClicked.connect(self.dialog.accept)
|
|
108
49
|
border.closeClicked.connect(self.reject)
|
|
109
50
|
layout.addWidget(border)
|
easycoder/ec_pyside.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
from functools import partial
|
|
2
3
|
from .ec_handler import Handler
|
|
3
4
|
from .ec_classes import RuntimeError
|
|
4
|
-
from
|
|
5
|
-
from PySide6.
|
|
5
|
+
from .ec_border import Border
|
|
6
|
+
from PySide6.QtCore import Qt, QTimer, Signal, QRect
|
|
7
|
+
from PySide6.QtGui import QPixmap, QPainter
|
|
6
8
|
from PySide6.QtWidgets import (
|
|
7
9
|
QApplication,
|
|
8
10
|
QCheckBox,
|
|
@@ -34,7 +36,8 @@ from PySide6.QtWidgets import (
|
|
|
34
36
|
QSizePolicy,
|
|
35
37
|
QDialog,
|
|
36
38
|
QMessageBox,
|
|
37
|
-
QDialogButtonBox
|
|
39
|
+
QDialogButtonBox,
|
|
40
|
+
QGraphicsDropShadowEffect
|
|
38
41
|
)
|
|
39
42
|
|
|
40
43
|
class Graphics(Handler):
|
|
@@ -61,23 +64,12 @@ class Graphics(Handler):
|
|
|
61
64
|
'lineinput',
|
|
62
65
|
'multiline',
|
|
63
66
|
'listbox',
|
|
64
|
-
'combobox'
|
|
67
|
+
'combobox',
|
|
68
|
+
'widget'
|
|
65
69
|
]
|
|
66
70
|
|
|
67
71
|
def dialogTypes(self):
|
|
68
|
-
return ['confirm', 'lineedit', 'multiline']
|
|
69
|
-
|
|
70
|
-
class ECDialog(QDialog):
|
|
71
|
-
def __init__(self, parent, record):
|
|
72
|
-
super().__init__(parent)
|
|
73
|
-
self.record = record
|
|
74
|
-
|
|
75
|
-
def showEvent(self, event):
|
|
76
|
-
super().showEvent(event)
|
|
77
|
-
QTimer.singleShot(100, self.afterShown)
|
|
78
|
-
|
|
79
|
-
def afterShown(self):
|
|
80
|
-
if 'action' in self.record: self.record['action']()
|
|
72
|
+
return ['confirm', 'lineedit', 'multiline', 'generic']
|
|
81
73
|
|
|
82
74
|
class ClickableLineEdit(QLineEdit):
|
|
83
75
|
clicked = Signal()
|
|
@@ -274,7 +266,8 @@ class Graphics(Handler):
|
|
|
274
266
|
return False
|
|
275
267
|
|
|
276
268
|
def r_clear(self, command):
|
|
277
|
-
self.getVariable(command['name'])['widget']
|
|
269
|
+
widget = self.getVariable(command['name'])['widget']
|
|
270
|
+
widget.clear()
|
|
278
271
|
return self.nextPC()
|
|
279
272
|
|
|
280
273
|
# close {window}
|
|
@@ -300,7 +293,7 @@ class Graphics(Handler):
|
|
|
300
293
|
|
|
301
294
|
# Create a window
|
|
302
295
|
def k_createWindow(self, command):
|
|
303
|
-
|
|
296
|
+
title = None
|
|
304
297
|
x = None
|
|
305
298
|
y = None
|
|
306
299
|
w = self.compileConstant(640)
|
|
@@ -309,7 +302,7 @@ class Graphics(Handler):
|
|
|
309
302
|
token = self.peek()
|
|
310
303
|
if token in ['title', 'at', 'size', 'layout']:
|
|
311
304
|
self.nextToken()
|
|
312
|
-
if token == 'title':
|
|
305
|
+
if token == 'title': title = self.nextValue()
|
|
313
306
|
elif token == 'at':
|
|
314
307
|
x = self.nextValue()
|
|
315
308
|
y = self.nextValue()
|
|
@@ -323,6 +316,7 @@ class Graphics(Handler):
|
|
|
323
316
|
command['layout'] = record['name']
|
|
324
317
|
else: return False
|
|
325
318
|
else: break
|
|
319
|
+
command['title'] = title
|
|
326
320
|
command['x'] = x
|
|
327
321
|
command['y'] = y
|
|
328
322
|
command['w'] = w
|
|
@@ -427,11 +421,7 @@ class Graphics(Handler):
|
|
|
427
421
|
self.add(command)
|
|
428
422
|
return True
|
|
429
423
|
|
|
430
|
-
def
|
|
431
|
-
self.add(command)
|
|
432
|
-
return True
|
|
433
|
-
|
|
434
|
-
def k_createComboBox(self, command):
|
|
424
|
+
def k_createWidget(self, command):
|
|
435
425
|
self.add(command)
|
|
436
426
|
return True
|
|
437
427
|
|
|
@@ -456,6 +446,9 @@ class Graphics(Handler):
|
|
|
456
446
|
elif self.peek() == 'value':
|
|
457
447
|
self.nextToken()
|
|
458
448
|
command['value'] = self.nextValue()
|
|
449
|
+
elif self.peek() == 'with':
|
|
450
|
+
self.nextToken()
|
|
451
|
+
command['layout'] = self.nextToken()
|
|
459
452
|
else: break
|
|
460
453
|
if not 'title' in command: command['title'] = self.compileConstant('')
|
|
461
454
|
if not 'value' in command: command['value'] = self.compileConstant('')
|
|
@@ -495,6 +488,7 @@ class Graphics(Handler):
|
|
|
495
488
|
command['name'] = record['name']
|
|
496
489
|
keyword = record['keyword']
|
|
497
490
|
if keyword == 'window': return self.k_createWindow(command)
|
|
491
|
+
elif keyword in ['listbox', 'combobox', 'widget']: return self.k_createWidget(command)
|
|
498
492
|
elif keyword == 'layout': return self.k_createLayout(command)
|
|
499
493
|
elif keyword == 'group': return self.k_createGroupBox(command)
|
|
500
494
|
elif keyword == 'label': return self.k_createLabel(command)
|
|
@@ -502,15 +496,15 @@ class Graphics(Handler):
|
|
|
502
496
|
elif keyword == 'checkbox': return self.k_createCheckBox(command)
|
|
503
497
|
elif keyword == 'lineinput': return self.k_createLineEdit(command)
|
|
504
498
|
elif keyword == 'multiline': return self.k_createMultiLineEdit(command)
|
|
505
|
-
elif keyword == 'listbox': return self.k_createListWidget(command)
|
|
506
|
-
elif keyword == 'combobox': return self.k_createComboBox(command)
|
|
507
499
|
elif keyword == 'dialog': return self.k_createDialog(command)
|
|
508
500
|
elif keyword == 'messagebox': return self.k_createMessageBox(command)
|
|
509
501
|
return False
|
|
510
502
|
|
|
511
503
|
def r_createWindow(self, command, record):
|
|
512
504
|
window = QMainWindow()
|
|
513
|
-
|
|
505
|
+
title = self.getRuntimeValue(command['title'])
|
|
506
|
+
if title == None: title = 'EasyCoder Main Window'
|
|
507
|
+
window.setWindowTitle(title)
|
|
514
508
|
w = self.getRuntimeValue(command['w'])
|
|
515
509
|
h = self.getRuntimeValue(command['h'])
|
|
516
510
|
x = command['x']
|
|
@@ -574,6 +568,7 @@ class Graphics(Handler):
|
|
|
574
568
|
c = pushbutton.contentsMargins()
|
|
575
569
|
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) + c.left()+c.right()
|
|
576
570
|
pushbutton.setMaximumWidth(w)
|
|
571
|
+
self.putSymbolValue(record, pushbutton)
|
|
577
572
|
record['widget'] = pushbutton
|
|
578
573
|
return self.nextPC()
|
|
579
574
|
|
|
@@ -628,33 +623,66 @@ class Graphics(Handler):
|
|
|
628
623
|
record['widget'] = QComboBox()
|
|
629
624
|
return self.nextPC()
|
|
630
625
|
|
|
626
|
+
def r_createWidget(self, command, record):
|
|
627
|
+
record['widget'] = QWidget()
|
|
628
|
+
return self.nextPC()
|
|
629
|
+
|
|
631
630
|
def r_createDialog(self, command, record):
|
|
631
|
+
|
|
632
|
+
class ECDialog(QDialog):
|
|
633
|
+
def __init__(self, parent, record):
|
|
634
|
+
super().__init__(parent)
|
|
635
|
+
self.record = record
|
|
636
|
+
|
|
637
|
+
def showEvent(self, event):
|
|
638
|
+
super().showEvent(event)
|
|
639
|
+
QTimer.singleShot(100, self.afterShown)
|
|
640
|
+
|
|
641
|
+
def afterShown(self):
|
|
642
|
+
if 'action' in self.record: self.record['action']()
|
|
643
|
+
|
|
632
644
|
win = command['window']
|
|
633
645
|
if win != None:
|
|
634
646
|
win = self.getVariable(win)['window']
|
|
635
|
-
dialog =
|
|
636
|
-
mainLayout = QVBoxLayout(dialog)
|
|
637
|
-
dialog.setWindowTitle(self.getRuntimeValue(command['title']))
|
|
647
|
+
dialog = ECDialog(win, record)
|
|
638
648
|
dialogType = command['type'].lower()
|
|
639
649
|
dialog.dialogType = dialogType
|
|
640
|
-
|
|
641
|
-
if dialogType == '
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
dialog.
|
|
646
|
-
dialog.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
650
|
+
mainLayout = QVBoxLayout(dialog)
|
|
651
|
+
if dialogType == 'generic':
|
|
652
|
+
dialog.setFixedWidth(500)
|
|
653
|
+
dialog.setFixedHeight(500)
|
|
654
|
+
dialog.setWindowFlags(Qt.FramelessWindowHint)
|
|
655
|
+
dialog.setModal(True)
|
|
656
|
+
dialog.setStyleSheet('background-color: white;border:1px solid black;')
|
|
657
|
+
|
|
658
|
+
border = Border()
|
|
659
|
+
border.tickClicked.connect(dialog.accept)
|
|
660
|
+
border.closeClicked.connect(dialog.reject)
|
|
661
|
+
mainLayout.addWidget(border)
|
|
662
|
+
if 'layout' in command:
|
|
663
|
+
layout = self.getVariable(command['layout'])['widget']
|
|
664
|
+
mainLayout.addLayout(layout)
|
|
665
|
+
dialog.setLayout(mainLayout)
|
|
666
|
+
else:
|
|
667
|
+
dialog.setWindowTitle(self.getRuntimeValue(command['title']))
|
|
668
|
+
prompt = self.getRuntimeValue(command['prompt'])
|
|
669
|
+
if dialogType == 'confirm':
|
|
670
|
+
mainLayout.addWidget(QLabel(prompt))
|
|
671
|
+
elif dialogType == 'lineedit':
|
|
672
|
+
mainLayout.addWidget(QLabel(prompt))
|
|
673
|
+
dialog.lineEdit = self.ClickableLineEdit(dialog)
|
|
674
|
+
dialog.value = self.getRuntimeValue(command['value'])
|
|
675
|
+
dialog.lineEdit.setText(dialog.value)
|
|
676
|
+
mainLayout.addWidget(dialog.lineEdit)
|
|
677
|
+
elif dialogType == 'multiline':
|
|
678
|
+
mainLayout.addWidget(QLabel(prompt))
|
|
679
|
+
dialog.textEdit = self.ClickablePlainTextEdit(self)
|
|
680
|
+
dialog.textEdit.setText(dialog.value)
|
|
681
|
+
mainLayout.addWidget(dialog.textEdit)
|
|
682
|
+
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
|
683
|
+
buttonBox.accepted.connect(dialog.accept)
|
|
684
|
+
buttonBox.rejected.connect(dialog.reject)
|
|
685
|
+
mainLayout.addWidget(buttonBox, alignment=Qt.AlignHCenter)
|
|
658
686
|
record['dialog'] = dialog
|
|
659
687
|
return self.nextPC()
|
|
660
688
|
|
|
@@ -681,6 +709,7 @@ class Graphics(Handler):
|
|
|
681
709
|
elif keyword == 'multiline': return self.r_createMultiLineEdit(command, record)
|
|
682
710
|
elif keyword == 'listbox': return self.r_createListWidget(command, record)
|
|
683
711
|
elif keyword == 'combobox': return self.r_createComboBox(command, record)
|
|
712
|
+
elif keyword == 'widget': return self.r_createWidget(command, record)
|
|
684
713
|
elif keyword == 'dialog': return self.r_createDialog(command, record)
|
|
685
714
|
elif keyword == 'messagebox': return self.r_createMessageBox(command, record)
|
|
686
715
|
return None
|
|
@@ -852,6 +881,10 @@ class Graphics(Handler):
|
|
|
852
881
|
return False
|
|
853
882
|
|
|
854
883
|
def r_on(self, command):
|
|
884
|
+
def run(widget):
|
|
885
|
+
print(f"Widget {widget} was clicked")
|
|
886
|
+
self.run(command['goto'])
|
|
887
|
+
|
|
855
888
|
if command['type'] == 'tick':
|
|
856
889
|
self.runOnTick = command['runOnTick']
|
|
857
890
|
else:
|
|
@@ -859,7 +892,8 @@ class Graphics(Handler):
|
|
|
859
892
|
widget = record['widget']
|
|
860
893
|
keyword = record['keyword']
|
|
861
894
|
if keyword == 'pushbutton':
|
|
862
|
-
|
|
895
|
+
handler = partial(run, widget)
|
|
896
|
+
widget.clicked.connect(handler)
|
|
863
897
|
elif keyword == 'combobox':
|
|
864
898
|
widget.currentIndexChanged.connect(lambda: self.run(command['goto']))
|
|
865
899
|
elif keyword == 'listbox':
|
|
@@ -938,11 +972,12 @@ class Graphics(Handler):
|
|
|
938
972
|
return self.nextPC()
|
|
939
973
|
|
|
940
974
|
# set [the] width/height [of] {widget} [to] {value}
|
|
941
|
-
# set [the] layout of {window} to {layout}
|
|
975
|
+
# set [the] layout of {window}/{widget} to {layout}
|
|
942
976
|
# set [the] spacing of {layout} to {value}
|
|
943
977
|
# set [the] text [of] {label}/{button}/{lineinput}/{multiline} [to] {text}
|
|
944
978
|
# set [the] color [of] {label}/{button}/{lineinput}/{multiline} [to] {color}
|
|
945
979
|
# set [the] state [of] {checkbox} [to] {state}
|
|
980
|
+
# set [the] style of {widget} to {style}
|
|
946
981
|
# set {listbox} to {list}
|
|
947
982
|
# set blocked true/false
|
|
948
983
|
def k_set(self, command):
|
|
@@ -963,7 +998,8 @@ class Graphics(Handler):
|
|
|
963
998
|
self.skip('of')
|
|
964
999
|
if self.nextIsSymbol():
|
|
965
1000
|
record = self.getSymbolRecord()
|
|
966
|
-
|
|
1001
|
+
keyword = record['keyword']
|
|
1002
|
+
if keyword in ['window', 'widget']:
|
|
967
1003
|
command['name'] = record['name']
|
|
968
1004
|
self.skip('to')
|
|
969
1005
|
if self.nextIsSymbol():
|
|
@@ -996,6 +1032,22 @@ class Graphics(Handler):
|
|
|
996
1032
|
if self.nextIsSymbol():
|
|
997
1033
|
record = self.getSymbolRecord()
|
|
998
1034
|
if record['keyword'] == 'checkbox':
|
|
1035
|
+
command['name'] = record['name']
|
|
1036
|
+
self.skip('to')
|
|
1037
|
+
if self.peek() == 'checked':
|
|
1038
|
+
command['value'] = self.compileConstant(True)
|
|
1039
|
+
self.nextToken()
|
|
1040
|
+
elif self.peek() == 'unchecked':
|
|
1041
|
+
command['value'] = self.compileConstant(False)
|
|
1042
|
+
self.nextToken()
|
|
1043
|
+
else: command['value'] = self.nextValue()
|
|
1044
|
+
self.add(command)
|
|
1045
|
+
return True
|
|
1046
|
+
elif token == 'style':
|
|
1047
|
+
self.skip('of')
|
|
1048
|
+
if self.nextIsSymbol():
|
|
1049
|
+
record = self.getSymbolRecord()
|
|
1050
|
+
if record['extra'] == 'gui':
|
|
999
1051
|
command['name'] = record['name']
|
|
1000
1052
|
self.skip('to')
|
|
1001
1053
|
command['value'] = self.nextValue()
|
|
@@ -1068,16 +1120,21 @@ class Graphics(Handler):
|
|
|
1068
1120
|
widget = self.getVariable(command['name'])['widget']
|
|
1069
1121
|
widget.setFixedWidth(self.getRuntimeValue(command['value']))
|
|
1070
1122
|
elif what == 'layout':
|
|
1071
|
-
window = self.getVariable(command['name'])['window']
|
|
1072
1123
|
content = self.getVariable(command['layout'])['widget']
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
window
|
|
1124
|
+
record = self.getVariable(command['name'])
|
|
1125
|
+
keyword = record['keyword']
|
|
1126
|
+
if keyword == 'window':
|
|
1127
|
+
window = record['widget']
|
|
1128
|
+
container = QWidget()
|
|
1129
|
+
container.setLayout(content)
|
|
1130
|
+
window.setCentralWidget(container)
|
|
1131
|
+
elif keyword == 'widget':
|
|
1132
|
+
widget = record['widget']
|
|
1133
|
+
widget.setLayout(content)
|
|
1076
1134
|
elif what == 'spacing':
|
|
1077
1135
|
layout = self.getVariable(command['name'])['widget']
|
|
1078
1136
|
layout.setSpacing(self.getRuntimeValue(command['value']))
|
|
1079
1137
|
elif what == 'text':
|
|
1080
|
-
record = self.getVariable(command['name'])
|
|
1081
1138
|
widget = self.getVariable(command['name'])['widget']
|
|
1082
1139
|
text = self.getRuntimeValue(command['value'])
|
|
1083
1140
|
keyword = record['keyword']
|
|
@@ -1188,7 +1245,9 @@ class Graphics(Handler):
|
|
|
1188
1245
|
elif 'dialog' in command:
|
|
1189
1246
|
record = self.getVariable(command['dialog'])
|
|
1190
1247
|
dialog = record['dialog']
|
|
1191
|
-
if dialog.dialogType == '
|
|
1248
|
+
if dialog.dialogType == 'generic':
|
|
1249
|
+
record['result'] = dialog.exec()
|
|
1250
|
+
elif dialog.dialogType == 'confirm':
|
|
1192
1251
|
record['result'] = True if dialog.exec() == QDialog.Accepted else False
|
|
1193
1252
|
elif dialog.dialogType == 'lineedit':
|
|
1194
1253
|
if dialog.exec() == QDialog.Accepted:
|
|
@@ -1224,6 +1283,13 @@ class Graphics(Handler):
|
|
|
1224
1283
|
self.app.lastWindowClosed.connect(on_last_window_closed)
|
|
1225
1284
|
self.app.exec()
|
|
1226
1285
|
|
|
1286
|
+
# Declare a widget variable
|
|
1287
|
+
def k_widget(self, command):
|
|
1288
|
+
return self.compileVariable(command, 'gui')
|
|
1289
|
+
|
|
1290
|
+
def r_widget(self, command):
|
|
1291
|
+
return self.nextPC()
|
|
1292
|
+
|
|
1227
1293
|
# Declare a window variable
|
|
1228
1294
|
def k_window(self, command):
|
|
1229
1295
|
return self.compileVariable(command)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250825.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=k6wMyhT4tubgUJLdxalHar_hnllWAD4wm4b78TDE7MY,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=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=GIoGe7m7iqqnjyi6YN2XkGHvxEzrLkkRGHaFyBsQPfw,53588
|
|
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-250825.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
16
|
+
easycoder-250825.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
17
|
+
easycoder-250825.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
18
|
+
easycoder-250825.1.dist-info/METADATA,sha256=9VNsqXu-owlaaJB87c9Y1UHbb3kd2S3n7FqPnh8Kj74,6897
|
|
19
|
+
easycoder-250825.1.dist-info/RECORD,,
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=Fx-I8dMel2dMlYrWHwPOTxrdhFDKZKqLusqRVcva62E,314
|
|
2
|
-
easycoder/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
|
|
3
|
-
easycoder/ec_classes.py,sha256=PWPaJuTfaWD4-tgT-2WWOgeFV_jXxlxyKCxvXyylCUU,1824
|
|
4
|
-
easycoder/ec_compiler.py,sha256=-uuXDbfgFBGXSrr7EneDnnneFOFsU-UuCIpNHsCqY0s,5289
|
|
5
|
-
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
6
|
-
easycoder/ec_core.py,sha256=r0bFQV3LXCCh4CP6289h6UvK6gpq4L0BQDrEWkeVo_0,98040
|
|
7
|
-
easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
|
|
8
|
-
easycoder/ec_keyboard.py,sha256=rXddjgx7N1wQrBMypZ4o0B79atdR-jHZq0_c5ZaMZcU,20765
|
|
9
|
-
easycoder/ec_program.py,sha256=7h2QKGunsiu5l2OKn-sw-Dd70kZJrb4b2idHubeSXDs,9989
|
|
10
|
-
easycoder/ec_pyside.py,sha256=XLDr21RIFBvzqQOR2s2DmQSSRbmIg6KmoPgT_w9QW2g,50887
|
|
11
|
-
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
12
|
-
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
13
|
-
easycoder/tick.png,sha256=OedASXJJTYvnza4J6Kv5m5lz6DrBfy667zX_WGgtbmM,9127
|
|
14
|
-
easycoder-250820.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
15
|
-
easycoder-250820.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
16
|
-
easycoder-250820.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
17
|
-
easycoder-250820.1.dist-info/METADATA,sha256=KUWhbEG06-6MaAZKy3mTyv5UhkCvwjNZV_VXlF6H2Wg,6897
|
|
18
|
-
easycoder-250820.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|