easycoder 250807.2__py2.py3-none-any.whl → 250809.2__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_keyboard.py +43 -14
- easycoder/ec_program.py +1 -1
- easycoder/ec_pyside.py +59 -16
- {easycoder-250807.2.dist-info → easycoder-250809.2.dist-info}/METADATA +1 -1
- {easycoder-250807.2.dist-info → easycoder-250809.2.dist-info}/RECORD +9 -9
- {easycoder-250807.2.dist-info → easycoder-250809.2.dist-info}/LICENSE +0 -0
- {easycoder-250807.2.dist-info → easycoder-250809.2.dist-info}/WHEEL +0 -0
- {easycoder-250807.2.dist-info → easycoder-250809.2.dist-info}/entry_points.txt +0 -0
easycoder/__init__.py
CHANGED
easycoder/ec_keyboard.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
import os
|
|
3
2
|
from .ec_handler import Handler
|
|
4
3
|
from PySide6.QtWidgets import (
|
|
@@ -14,7 +13,7 @@ from PySide6.QtWidgets import (
|
|
|
14
13
|
QSizePolicy,
|
|
15
14
|
QGraphicsDropShadowEffect
|
|
16
15
|
)
|
|
17
|
-
from PySide6.QtGui import QFont, QIcon, QPixmap, QPainter
|
|
16
|
+
from PySide6.QtGui import QFont, QIcon, QPixmap, QPainter
|
|
18
17
|
from PySide6.QtCore import Qt, QTimer, Signal, QRect
|
|
19
18
|
|
|
20
19
|
class Keyboard(Handler):
|
|
@@ -65,12 +64,12 @@ class Keyboard(Handler):
|
|
|
65
64
|
self._drag_active = False
|
|
66
65
|
super().mouseReleaseEvent(event)
|
|
67
66
|
|
|
68
|
-
def __init__(self, program, keyboardType,
|
|
67
|
+
def __init__(self, program, keyboardType, receiverLayout, receivers, caller = None, parent=None):
|
|
69
68
|
super().__init__(program.compiler)
|
|
70
69
|
|
|
71
70
|
self.program = program
|
|
72
71
|
self.keyboardType = keyboardType
|
|
73
|
-
self.
|
|
72
|
+
self.receivers = receivers
|
|
74
73
|
|
|
75
74
|
dialog = QDialog(caller)
|
|
76
75
|
self.dialog = dialog
|
|
@@ -78,9 +77,8 @@ class Keyboard(Handler):
|
|
|
78
77
|
# dialog.setWindowTitle('')
|
|
79
78
|
dialog.setWindowFlags(Qt.FramelessWindowHint)
|
|
80
79
|
dialog.setModal(True)
|
|
81
|
-
dialog.
|
|
80
|
+
dialog.setFixedWidth(500)
|
|
82
81
|
dialog.setStyleSheet('background-color: white;border:1px solid black;')
|
|
83
|
-
self.originalText = receiver.getContent()
|
|
84
82
|
|
|
85
83
|
# Add drop shadow
|
|
86
84
|
shadow = QGraphicsDropShadowEffect(dialog)
|
|
@@ -95,7 +93,19 @@ class Keyboard(Handler):
|
|
|
95
93
|
border = self.Border()
|
|
96
94
|
border.iconClicked.connect(self.reject)
|
|
97
95
|
layout.addWidget(border)
|
|
98
|
-
layout.
|
|
96
|
+
layout.addLayout(receiverLayout)
|
|
97
|
+
self.vk = VirtualKeyboard(keyboardType, 42, receivers[0], dialog.accept)
|
|
98
|
+
layout.addWidget(self.vk)
|
|
99
|
+
|
|
100
|
+
restore = []
|
|
101
|
+
index = 0
|
|
102
|
+
for receiver in receivers:
|
|
103
|
+
receiver.field.setContainer(self)
|
|
104
|
+
receiver.index = index
|
|
105
|
+
restore.append(receiver.getContent())
|
|
106
|
+
index += 1
|
|
107
|
+
self.restore = restore
|
|
108
|
+
self.selectedReceiver = receivers[0]
|
|
99
109
|
|
|
100
110
|
# Position at bottom of parent window
|
|
101
111
|
dialog.show() # Ensure geometry is calculated
|
|
@@ -107,8 +117,24 @@ class Keyboard(Handler):
|
|
|
107
117
|
|
|
108
118
|
dialog.exec()
|
|
109
119
|
|
|
120
|
+
def setClickSource(self, field):
|
|
121
|
+
receivers = self.receivers
|
|
122
|
+
index = 0
|
|
123
|
+
for receiver in receivers:
|
|
124
|
+
if receiver.field == field:
|
|
125
|
+
self.selectedReceiver = receiver
|
|
126
|
+
break
|
|
127
|
+
index += 1
|
|
128
|
+
|
|
110
129
|
def reject(self):
|
|
111
|
-
self.
|
|
130
|
+
selectedReceiver = self.selectedReceiver
|
|
131
|
+
receivers = self.receivers
|
|
132
|
+
index = 0
|
|
133
|
+
for receiver in receivers:
|
|
134
|
+
if receiver == selectedReceiver:
|
|
135
|
+
break
|
|
136
|
+
index += 1
|
|
137
|
+
receiver.setContent(self.restore[index])
|
|
112
138
|
self.dialog.reject()
|
|
113
139
|
|
|
114
140
|
class TextReceiver():
|
|
@@ -184,11 +210,11 @@ class KeyboardView(QVBoxLayout):
|
|
|
184
210
|
self.addLayout(row)
|
|
185
211
|
|
|
186
212
|
class VirtualKeyboard(QStackedWidget):
|
|
187
|
-
def __init__(self, keyboardType, buttonHeight,
|
|
213
|
+
def __init__(self, keyboardType, buttonHeight, receiver, onFinished):
|
|
188
214
|
super().__init__()
|
|
189
215
|
self.keyboardType = keyboardType
|
|
190
216
|
self.buttonHeight = buttonHeight
|
|
191
|
-
self.
|
|
217
|
+
self.receiver = receiver
|
|
192
218
|
self.onFinished = onFinished
|
|
193
219
|
self.setStyleSheet('background-color: #ccc;border:none;')
|
|
194
220
|
|
|
@@ -409,11 +435,14 @@ class VirtualKeyboard(QStackedWidget):
|
|
|
409
435
|
container = QWidget()
|
|
410
436
|
container.setLayout(keyboardView)
|
|
411
437
|
self.addWidget(container)
|
|
438
|
+
|
|
439
|
+
def setClickSource(self, receiver):
|
|
440
|
+
self.receiver = receiver
|
|
412
441
|
|
|
413
442
|
# Callback functions
|
|
414
443
|
def onClickChar(self,keycode):
|
|
415
444
|
# print(f"Key pressed: {keycode}")
|
|
416
|
-
self.
|
|
445
|
+
self.receiver.addCharacter(keycode)
|
|
417
446
|
|
|
418
447
|
def onClickShift(self,keycode):
|
|
419
448
|
# print("Shift pressed")
|
|
@@ -436,13 +465,13 @@ class VirtualKeyboard(QStackedWidget):
|
|
|
436
465
|
|
|
437
466
|
def onClickBack(self,keycode):
|
|
438
467
|
# print("Backspace pressed")
|
|
439
|
-
self.
|
|
468
|
+
self.receiver.backspace()
|
|
440
469
|
|
|
441
470
|
def onClickSpace(self,keycode):
|
|
442
471
|
# print("Space pressed")
|
|
443
|
-
self.
|
|
472
|
+
self.receiver.addCharacter(' ')
|
|
444
473
|
|
|
445
474
|
def onClickEnter(self,keycode):
|
|
446
475
|
# print("Enter pressed")
|
|
447
|
-
if self.keyboardType == 'multiline': self.
|
|
476
|
+
if self.keyboardType == 'multiline': self.receiver.addCharacter('\n')
|
|
448
477
|
else: self.onFinished()
|
easycoder/ec_program.py
CHANGED
easycoder/ec_pyside.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
from .ec_handler import Handler
|
|
3
3
|
from .ec_classes import RuntimeError
|
|
4
|
-
from .
|
|
5
|
-
from PySide6.QtCore import Qt, QTimer
|
|
4
|
+
from PySide6.QtCore import Qt, QTimer, Signal
|
|
6
5
|
from PySide6.QtGui import QPixmap
|
|
7
6
|
from PySide6.QtWidgets import (
|
|
8
7
|
QApplication,
|
|
@@ -80,6 +79,34 @@ class Graphics(Handler):
|
|
|
80
79
|
def afterShown(self):
|
|
81
80
|
if 'action' in self.record: self.record['action']()
|
|
82
81
|
|
|
82
|
+
class ClickableLineEdit(QLineEdit):
|
|
83
|
+
clicked = Signal()
|
|
84
|
+
|
|
85
|
+
def __init__(self):
|
|
86
|
+
super().__init__()
|
|
87
|
+
|
|
88
|
+
def setContainer(self, container):
|
|
89
|
+
self.container = container
|
|
90
|
+
|
|
91
|
+
def mousePressEvent(self, event):
|
|
92
|
+
self.clicked.emit()
|
|
93
|
+
super().mousePressEvent(event)
|
|
94
|
+
if self.container != None: self.container.setClickSource(self)
|
|
95
|
+
|
|
96
|
+
class ClickablePlainTextEdit(QPlainTextEdit):
|
|
97
|
+
clicked = Signal()
|
|
98
|
+
|
|
99
|
+
def __init__(self):
|
|
100
|
+
super().__init__()
|
|
101
|
+
|
|
102
|
+
def setContainer(self, container):
|
|
103
|
+
self.container = container
|
|
104
|
+
|
|
105
|
+
def mousePressEvent(self, event):
|
|
106
|
+
self.clicked.emit()
|
|
107
|
+
super().mousePressEvent(event)
|
|
108
|
+
if self.container != None: self.container.setClickSource(self)
|
|
109
|
+
|
|
83
110
|
#############################################################################
|
|
84
111
|
# Keyword handlers
|
|
85
112
|
|
|
@@ -297,6 +324,7 @@ class Graphics(Handler):
|
|
|
297
324
|
|
|
298
325
|
def k_createLabel(self, command):
|
|
299
326
|
text = self.compileConstant('')
|
|
327
|
+
size = self.compileConstant(20)
|
|
300
328
|
while True:
|
|
301
329
|
token = self.peek()
|
|
302
330
|
if token == 'text':
|
|
@@ -304,7 +332,7 @@ class Graphics(Handler):
|
|
|
304
332
|
text = self.nextValue()
|
|
305
333
|
elif token == 'size':
|
|
306
334
|
self.nextToken()
|
|
307
|
-
|
|
335
|
+
size = self.nextValue()
|
|
308
336
|
elif token == 'align':
|
|
309
337
|
self.nextToken()
|
|
310
338
|
token = self.nextToken()
|
|
@@ -312,6 +340,7 @@ class Graphics(Handler):
|
|
|
312
340
|
command['align'] = token
|
|
313
341
|
else: break
|
|
314
342
|
command['text'] = text
|
|
343
|
+
command['size'] = size
|
|
315
344
|
self.add(command)
|
|
316
345
|
return True
|
|
317
346
|
|
|
@@ -340,11 +369,19 @@ class Graphics(Handler):
|
|
|
340
369
|
return True
|
|
341
370
|
|
|
342
371
|
def k_createLineEdit(self, command):
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
372
|
+
text = self.compileConstant('')
|
|
373
|
+
size = self.compileConstant(40)
|
|
374
|
+
while True:
|
|
375
|
+
token = self.peek()
|
|
376
|
+
if token == 'text':
|
|
377
|
+
self.nextToken()
|
|
378
|
+
text = self.nextValue()
|
|
379
|
+
elif token == 'size':
|
|
380
|
+
self.nextToken()
|
|
381
|
+
size = self.nextValue()
|
|
382
|
+
else: break;
|
|
347
383
|
command['size'] = size
|
|
384
|
+
command['text'] = text
|
|
348
385
|
self.add(command)
|
|
349
386
|
return True
|
|
350
387
|
|
|
@@ -479,6 +516,10 @@ class Graphics(Handler):
|
|
|
479
516
|
|
|
480
517
|
def r_createLabel(self, command, record):
|
|
481
518
|
label = QLabel(str(self.getRuntimeValue(command['text'])))
|
|
519
|
+
label.setStyleSheet("""
|
|
520
|
+
background-color: transparent;
|
|
521
|
+
border: none;
|
|
522
|
+
""")
|
|
482
523
|
if 'size' in command:
|
|
483
524
|
fm = label.fontMetrics()
|
|
484
525
|
c = label.contentsMargins()
|
|
@@ -500,7 +541,7 @@ class Graphics(Handler):
|
|
|
500
541
|
if 'size' in command:
|
|
501
542
|
fm = pushbutton.fontMetrics()
|
|
502
543
|
c = pushbutton.contentsMargins()
|
|
503
|
-
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) +c.left()+c.right()
|
|
544
|
+
w = fm.horizontalAdvance('m') * self.getRuntimeValue(command['size']) + c.left()+c.right()
|
|
504
545
|
pushbutton.setMaximumWidth(w)
|
|
505
546
|
record['widget'] = pushbutton
|
|
506
547
|
return self.nextPC()
|
|
@@ -511,7 +552,8 @@ class Graphics(Handler):
|
|
|
511
552
|
return self.nextPC()
|
|
512
553
|
|
|
513
554
|
def r_createLineEdit(self, command, record):
|
|
514
|
-
lineinput =
|
|
555
|
+
lineinput = self.ClickableLineEdit()
|
|
556
|
+
lineinput.setText(self.getRuntimeValue(command['text']))
|
|
515
557
|
fm = lineinput.fontMetrics()
|
|
516
558
|
m = lineinput.textMargins()
|
|
517
559
|
c = lineinput.contentsMargins()
|
|
@@ -521,7 +563,7 @@ class Graphics(Handler):
|
|
|
521
563
|
return self.nextPC()
|
|
522
564
|
|
|
523
565
|
def r_createMultiLineEdit(self, command, record):
|
|
524
|
-
textinput =
|
|
566
|
+
textinput = self.ClickablePlainTextEdit()
|
|
525
567
|
fontMetrics = textinput.fontMetrics()
|
|
526
568
|
charWidth = fontMetrics.horizontalAdvance('x')
|
|
527
569
|
charHeight = fontMetrics.height()
|
|
@@ -552,13 +594,13 @@ class Graphics(Handler):
|
|
|
552
594
|
mainLayout.addWidget(QLabel(prompt))
|
|
553
595
|
elif dialogType == 'lineedit':
|
|
554
596
|
mainLayout.addWidget(QLabel(prompt))
|
|
555
|
-
dialog.lineEdit =
|
|
597
|
+
dialog.lineEdit = self.ClickableLineEdit(dialog)
|
|
556
598
|
dialog.value = self.getRuntimeValue(command['value'])
|
|
557
599
|
dialog.lineEdit.setText(dialog.value)
|
|
558
600
|
mainLayout.addWidget(dialog.lineEdit)
|
|
559
601
|
elif dialogType == 'multiline':
|
|
560
602
|
mainLayout.addWidget(QLabel(prompt))
|
|
561
|
-
dialog.textEdit =
|
|
603
|
+
dialog.textEdit = self.ClickablePlainTextEdit(self)
|
|
562
604
|
dialog.textEdit.setText(dialog.value)
|
|
563
605
|
mainLayout.addWidget(dialog.textEdit)
|
|
564
606
|
buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
|
@@ -690,7 +732,7 @@ class Graphics(Handler):
|
|
|
690
732
|
def r_multiline(self, command):
|
|
691
733
|
return self.nextPC()
|
|
692
734
|
|
|
693
|
-
# on click {pushbutton}
|
|
735
|
+
# on click {pushbutton}/{lineinput}/{multiline}
|
|
694
736
|
# on select {combobox}/{listbox}
|
|
695
737
|
# on tick
|
|
696
738
|
def k_on(self, command):
|
|
@@ -723,7 +765,7 @@ class Graphics(Handler):
|
|
|
723
765
|
if token == 'click':
|
|
724
766
|
if self.nextIsSymbol():
|
|
725
767
|
record = self.getSymbolRecord()
|
|
726
|
-
if record['keyword']
|
|
768
|
+
if record['keyword'] in ['pushbutton', 'lineinput', 'multiline']:
|
|
727
769
|
command['name'] = record['name']
|
|
728
770
|
setupOn()
|
|
729
771
|
return True
|
|
@@ -895,7 +937,7 @@ class Graphics(Handler):
|
|
|
895
937
|
self.skip('of')
|
|
896
938
|
if self.nextIsSymbol():
|
|
897
939
|
record = self.getSymbolRecord()
|
|
898
|
-
if record['keyword'] in ['label', 'pushbutton', 'lineinput', 'multiline']:
|
|
940
|
+
if record['keyword'] in ['label', 'pushbutton', 'lineinput', 'multiline', 'element']:
|
|
899
941
|
command['name'] = record['name']
|
|
900
942
|
self.skip('to')
|
|
901
943
|
command['value'] = self.nextValue()
|
|
@@ -968,7 +1010,8 @@ class Graphics(Handler):
|
|
|
968
1010
|
widget = self.getVariable(command['name'])['widget']
|
|
969
1011
|
text = self.getRuntimeValue(command['value'])
|
|
970
1012
|
keyword = record['keyword']
|
|
971
|
-
|
|
1013
|
+
setText = getattr(widget, "setText", None)
|
|
1014
|
+
if callable(setText):
|
|
972
1015
|
widget.setText(text)
|
|
973
1016
|
elif keyword == 'multiline':
|
|
974
1017
|
widget.setPlainText(text)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250809.2
|
|
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,17 +1,17 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=
|
|
1
|
+
easycoder/__init__.py,sha256=EGFyNysNl5UBOZuxEa4TXaCnXig6lIPpJaMcVhx-h6A,314
|
|
2
2
|
easycoder/close.png,sha256=3B9ueRNtEu9E4QNmZhdyC4VL6uqKvGmdfeFxIV9aO_Y,9847
|
|
3
3
|
easycoder/ec_classes.py,sha256=PWPaJuTfaWD4-tgT-2WWOgeFV_jXxlxyKCxvXyylCUU,1824
|
|
4
4
|
easycoder/ec_compiler.py,sha256=-uuXDbfgFBGXSrr7EneDnnneFOFsU-UuCIpNHsCqY0s,5289
|
|
5
5
|
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
6
6
|
easycoder/ec_core.py,sha256=r0bFQV3LXCCh4CP6289h6UvK6gpq4L0BQDrEWkeVo_0,98040
|
|
7
7
|
easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
|
|
8
|
-
easycoder/ec_keyboard.py,sha256=
|
|
9
|
-
easycoder/ec_program.py,sha256=
|
|
10
|
-
easycoder/ec_pyside.py,sha256=
|
|
8
|
+
easycoder/ec_keyboard.py,sha256=3ijJSC_lG4Q3tLfYknzBE_UoDoNARBDVfnA1jGKRa40,20307
|
|
9
|
+
easycoder/ec_program.py,sha256=IxebQZtTuoUJitfel-CxTAOdbDEV_aD18adooQWxtfc,9981
|
|
10
|
+
easycoder/ec_pyside.py,sha256=uTDoIQnwTBmsOyfc5_7g0dSDaFEvqAs1ksPj2bF16zg,46825
|
|
11
11
|
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
12
12
|
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
13
|
-
easycoder-
|
|
14
|
-
easycoder-
|
|
15
|
-
easycoder-
|
|
16
|
-
easycoder-
|
|
17
|
-
easycoder-
|
|
13
|
+
easycoder-250809.2.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
14
|
+
easycoder-250809.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
15
|
+
easycoder-250809.2.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
16
|
+
easycoder-250809.2.dist-info/METADATA,sha256=KniIbnGJC-3u35cmtR-qkMdwxxyQbTKPp7oZxrAxNMQ,6875
|
|
17
|
+
easycoder-250809.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|