easycoder 250722.4__py2.py3-none-any.whl → 250723.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 +3 -3
- easycoder/ec_core.py +2 -1
- easycoder/ec_keyboard.py +392 -0
- easycoder/ec_pyside.py +3 -1
- {easycoder-250722.4.dist-info → easycoder-250723.1.dist-info}/METADATA +3 -2
- easycoder-250723.1.dist-info/RECORD +16 -0
- {easycoder-250722.4.dist-info → easycoder-250723.1.dist-info}/WHEEL +1 -1
- easycoder-250722.4.dist-info/RECORD +0 -15
- {easycoder-250722.4.dist-info → easycoder-250723.1.dist-info}/entry_points.txt +0 -0
- {easycoder-250722.4.dist-info → easycoder-250723.1.dist-info/licenses}/LICENSE +0 -0
easycoder/__init__.py
CHANGED
|
@@ -5,10 +5,10 @@ from .ec_compiler import *
|
|
|
5
5
|
from .ec_condition import *
|
|
6
6
|
from .ec_core import *
|
|
7
7
|
from .ec_handler import *
|
|
8
|
+
from .ec_keyboard import *
|
|
8
9
|
from .ec_program import *
|
|
10
|
+
from .ec_pyside import *
|
|
9
11
|
from .ec_timestamp import *
|
|
10
12
|
from .ec_value import *
|
|
11
|
-
from .ec_pyside import *
|
|
12
|
-
from .ec_keyboard import *
|
|
13
13
|
|
|
14
|
-
__version__ = "
|
|
14
|
+
__version__ = "250723.1"
|
easycoder/ec_core.py
CHANGED
|
@@ -2,7 +2,6 @@ import json, math, hashlib, threading, os, subprocess, sys, time
|
|
|
2
2
|
import numbers, base64, binascii, random, requests, paramiko
|
|
3
3
|
from psutil import Process
|
|
4
4
|
from datetime import datetime
|
|
5
|
-
from random import randrange
|
|
6
5
|
from .ec_classes import FatalError, RuntimeWarning, RuntimeError, AssertionError, NoValueError, NoValueRuntimeError, Condition, Object
|
|
7
6
|
from .ec_handler import Handler
|
|
8
7
|
from .ec_timestamp import getTimestamp
|
|
@@ -1804,6 +1803,8 @@ class Core(Handler):
|
|
|
1804
1803
|
from .ec_pyside import Graphics
|
|
1805
1804
|
self.program.graphics = Graphics
|
|
1806
1805
|
self.program.useClass(Graphics)
|
|
1806
|
+
# from .ec_keyboard import Keyboard
|
|
1807
|
+
# self.program.useClass(Keyboard)
|
|
1807
1808
|
return True
|
|
1808
1809
|
return False
|
|
1809
1810
|
|
easycoder/ec_keyboard.py
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
|
|
2
|
+
from .ec_handler import Handler
|
|
3
|
+
from PySide6.QtWidgets import (
|
|
4
|
+
QDialog,
|
|
5
|
+
QVBoxLayout,
|
|
6
|
+
QHBoxLayout,
|
|
7
|
+
QPushButton,
|
|
8
|
+
QWidget,
|
|
9
|
+
QStackedWidget,
|
|
10
|
+
QSpacerItem,
|
|
11
|
+
QSizePolicy,
|
|
12
|
+
QGraphicsDropShadowEffect
|
|
13
|
+
)
|
|
14
|
+
from PySide6.QtGui import QFont, QIcon
|
|
15
|
+
from PySide6.QtCore import Qt, QTimer
|
|
16
|
+
|
|
17
|
+
class Keyboard(Handler):
|
|
18
|
+
|
|
19
|
+
def __init__(self, program, receiver, parent=None):
|
|
20
|
+
Handler.__init__(self, program.compiler)
|
|
21
|
+
|
|
22
|
+
self.program = program
|
|
23
|
+
|
|
24
|
+
dialog = QDialog()
|
|
25
|
+
|
|
26
|
+
# dialog.setWindowTitle('')
|
|
27
|
+
dialog.setWindowFlags(Qt.FramelessWindowHint)
|
|
28
|
+
dialog.setModal(True)
|
|
29
|
+
dialog.setFixedSize(500, 250)
|
|
30
|
+
dialog.setStyleSheet('background-color: white;border:1px solid black;')
|
|
31
|
+
|
|
32
|
+
# Add drop shadow
|
|
33
|
+
shadow = QGraphicsDropShadowEffect(dialog)
|
|
34
|
+
shadow.setBlurRadius(40)
|
|
35
|
+
shadow.setOffset(0, 4)
|
|
36
|
+
shadow.setColor(Qt.black)
|
|
37
|
+
dialog.setGraphicsEffect(shadow)
|
|
38
|
+
|
|
39
|
+
# Add the keyboard
|
|
40
|
+
layout = QVBoxLayout(dialog)
|
|
41
|
+
layout.addWidget(VirtualKeyboard(42, receiver, dialog.reject))
|
|
42
|
+
|
|
43
|
+
# Position at bottom of parent window
|
|
44
|
+
dialog.show() # Ensure geometry is calculated
|
|
45
|
+
if parent:
|
|
46
|
+
parent_pos = parent.mapToGlobal(parent.rect().bottomLeft())
|
|
47
|
+
x = parent_pos.x() + (parent.width - dialog.width()) / 2
|
|
48
|
+
y = parent_pos.y() - dialog.height() - 40
|
|
49
|
+
dialog.move(x, y)
|
|
50
|
+
|
|
51
|
+
dialog.exec()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class TextReceiver():
|
|
55
|
+
def __init__(self, field):
|
|
56
|
+
self.field = field
|
|
57
|
+
|
|
58
|
+
def add_character(self, char):
|
|
59
|
+
"""
|
|
60
|
+
Add a character to the text field.
|
|
61
|
+
|
|
62
|
+
:param char: A single character to add to the field.
|
|
63
|
+
"""
|
|
64
|
+
char = char.replace('&&', '&')
|
|
65
|
+
if len(char) == 1:
|
|
66
|
+
self.field.setText(self.field.text() + char)
|
|
67
|
+
else:
|
|
68
|
+
raise ValueError("Only single characters are allowed.")
|
|
69
|
+
|
|
70
|
+
def backspace(self):
|
|
71
|
+
"""
|
|
72
|
+
Remove the last character from the text field.
|
|
73
|
+
If the field is already empty, do nothing.
|
|
74
|
+
"""
|
|
75
|
+
current_text = self.field.text()
|
|
76
|
+
if current_text:
|
|
77
|
+
self.field.setText(current_text[:-1])
|
|
78
|
+
|
|
79
|
+
def get_content(self):
|
|
80
|
+
"""
|
|
81
|
+
Return the current content of the text field.
|
|
82
|
+
|
|
83
|
+
:return: The current text in the field.
|
|
84
|
+
"""
|
|
85
|
+
return self.field.text()
|
|
86
|
+
|
|
87
|
+
class KeyboardButton(QPushButton):
|
|
88
|
+
def __init__(self, width, height, onClick, text=None, icon=None):
|
|
89
|
+
if text != None: text = text.replace('&','&&')
|
|
90
|
+
super().__init__(text)
|
|
91
|
+
self.setFixedSize(width, height)
|
|
92
|
+
self.setFont(QFont("Arial", height // 2)) # Font size is half the button height
|
|
93
|
+
self.setStyleSheet(f"""
|
|
94
|
+
QPushButton {{
|
|
95
|
+
background-color: white;
|
|
96
|
+
border: none;
|
|
97
|
+
border-radius: {int(height * 0.2)}px; /* Rounded corners */
|
|
98
|
+
}}
|
|
99
|
+
QPushButton:pressed {{
|
|
100
|
+
background-color: #ddd; /* Slightly darker background when pressed */
|
|
101
|
+
}}
|
|
102
|
+
""")
|
|
103
|
+
|
|
104
|
+
if icon:
|
|
105
|
+
self.setIcon(QIcon(icon))
|
|
106
|
+
self.setIconSize(self.size())
|
|
107
|
+
|
|
108
|
+
self.clicked.connect(lambda: self.animate_button(onClick, text))
|
|
109
|
+
|
|
110
|
+
def animate_button(self, onClick, text):
|
|
111
|
+
# Move the button 2 pixels down and right
|
|
112
|
+
self.move(self.x() + 2, self.y() + 2)
|
|
113
|
+
QTimer.singleShot(200, lambda: self.move(self.x() - 2, self.y() - 2)) # Move back after 200ms
|
|
114
|
+
onClick(text)
|
|
115
|
+
|
|
116
|
+
class KeyboardRow(QHBoxLayout):
|
|
117
|
+
def __init__(self, items):
|
|
118
|
+
super().__init__()
|
|
119
|
+
for item in items:
|
|
120
|
+
if isinstance(item, QWidget):
|
|
121
|
+
self.addWidget(item)
|
|
122
|
+
elif isinstance(item, QSpacerItem):
|
|
123
|
+
self.addSpacerItem(item)
|
|
124
|
+
|
|
125
|
+
class KeyboardView(QVBoxLayout):
|
|
126
|
+
def __init__(self, rows):
|
|
127
|
+
super().__init__()
|
|
128
|
+
for row in rows:
|
|
129
|
+
self.addLayout(row)
|
|
130
|
+
|
|
131
|
+
class VirtualKeyboard(QStackedWidget):
|
|
132
|
+
def __init__(self, buttonHeight, textField, onFinished=None):
|
|
133
|
+
super().__init__()
|
|
134
|
+
self.buttonHeight = buttonHeight
|
|
135
|
+
self.textField = textField
|
|
136
|
+
self.onFinished = onFinished
|
|
137
|
+
self.setStyleSheet('background-color: #ccc;border:none;')
|
|
138
|
+
|
|
139
|
+
# Create the 4 keyboard layouts
|
|
140
|
+
self.addKeyboardLayout0()
|
|
141
|
+
self.addKeyboardLayout1()
|
|
142
|
+
self.addKeyboardLayout2()
|
|
143
|
+
self.addKeyboardLayout3()
|
|
144
|
+
|
|
145
|
+
def addKeyboardLayout0(self):
|
|
146
|
+
rowList = []
|
|
147
|
+
|
|
148
|
+
# Row 1: Numbers
|
|
149
|
+
# row1 = KeyboardRow([KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '1234567890'])
|
|
150
|
+
# rowList.append(row1)
|
|
151
|
+
|
|
152
|
+
# Row 2: qwertyuiop
|
|
153
|
+
row2 = KeyboardRow([
|
|
154
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
155
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'qwertyuiop'],
|
|
156
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
157
|
+
])
|
|
158
|
+
rowList.append(row2)
|
|
159
|
+
|
|
160
|
+
# Row 3: asdfghjkl with horizontal stretches
|
|
161
|
+
row3 = KeyboardRow([
|
|
162
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
163
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'asdfghjkl'],
|
|
164
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
165
|
+
])
|
|
166
|
+
rowList.append(row3)
|
|
167
|
+
|
|
168
|
+
# Row 4: Shift, ZXC..., Backspace
|
|
169
|
+
row4 = KeyboardRow([
|
|
170
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
171
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickShift, None, 'img/up.png'),
|
|
172
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
173
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'zxcvbnm'],
|
|
174
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
175
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickBack, None, 'img/back.png'),
|
|
176
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
177
|
+
])
|
|
178
|
+
rowList.append(row4)
|
|
179
|
+
|
|
180
|
+
# Row 5: Numbers, Space, Enter
|
|
181
|
+
row5 = KeyboardRow([
|
|
182
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
183
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickNumbers, None, 'img/numbers.png'),
|
|
184
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
185
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, ","),
|
|
186
|
+
KeyboardButton(self.buttonHeight * 5, self.buttonHeight, self.onClickSpace, None, 'skeyboard/pace.png'),
|
|
187
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, "."),
|
|
188
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
189
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickEnter, None, 'img/enter.png'),
|
|
190
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
191
|
+
])
|
|
192
|
+
rowList.append(row5)
|
|
193
|
+
|
|
194
|
+
# Add the rows to the KeyboardView
|
|
195
|
+
keyboardView = KeyboardView(rowList)
|
|
196
|
+
container = QWidget()
|
|
197
|
+
container.setLayout(keyboardView)
|
|
198
|
+
self.addWidget(container)
|
|
199
|
+
|
|
200
|
+
def addKeyboardLayout1(self):
|
|
201
|
+
rowList = []
|
|
202
|
+
|
|
203
|
+
# Row 1: Numbers
|
|
204
|
+
# row1 = KeyboardRow([KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '1234567890'])
|
|
205
|
+
# rowList.append(row1)
|
|
206
|
+
|
|
207
|
+
# Row 2: Uppercase QWERTY
|
|
208
|
+
row2 = KeyboardRow([
|
|
209
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
210
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'QWERTYUIOP'],
|
|
211
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
212
|
+
])
|
|
213
|
+
rowList.append(row2)
|
|
214
|
+
|
|
215
|
+
# Row 3: Uppercase ASDFGHJKL with horizontal stretches
|
|
216
|
+
row3 = KeyboardRow([
|
|
217
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
218
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'ASDFGHJKL'],
|
|
219
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
220
|
+
])
|
|
221
|
+
rowList.append(row3)
|
|
222
|
+
|
|
223
|
+
# Row 4: Shift, Uppercase ZXC..., Backspace
|
|
224
|
+
row4 = KeyboardRow([
|
|
225
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
226
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickShift, None, 'img/up.png'),
|
|
227
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
228
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in 'ZXCVBNM'],
|
|
229
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
230
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickBack, None, 'img/back.png'),
|
|
231
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
232
|
+
])
|
|
233
|
+
rowList.append(row4)
|
|
234
|
+
|
|
235
|
+
# Row 5: Numbers, Space, Enter
|
|
236
|
+
row5 = KeyboardRow([
|
|
237
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
238
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickNumbers, None, 'img/numbers.png'),
|
|
239
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
240
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, ","),
|
|
241
|
+
KeyboardButton(self.buttonHeight * 5, self.buttonHeight, self.onClickSpace, None, 'img/space.png'),
|
|
242
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, "."),
|
|
243
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
244
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickEnter, None, 'img/enter.png'),
|
|
245
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
246
|
+
])
|
|
247
|
+
rowList.append(row5)
|
|
248
|
+
|
|
249
|
+
# Add the rows to the KeyboardView
|
|
250
|
+
keyboardView = KeyboardView(rowList)
|
|
251
|
+
container = QWidget()
|
|
252
|
+
container.setLayout(keyboardView)
|
|
253
|
+
self.addWidget(container)
|
|
254
|
+
|
|
255
|
+
def addKeyboardLayout2(self):
|
|
256
|
+
rowList = []
|
|
257
|
+
|
|
258
|
+
# Row 1: Numbers
|
|
259
|
+
row1 = KeyboardRow([
|
|
260
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
261
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '1234567890'],
|
|
262
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
263
|
+
])
|
|
264
|
+
rowList.append(row1)
|
|
265
|
+
|
|
266
|
+
# Row 2: Symbols
|
|
267
|
+
row2 = KeyboardRow([
|
|
268
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
269
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '@#£&_-()=%'],
|
|
270
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
271
|
+
])
|
|
272
|
+
rowList.append(row2)
|
|
273
|
+
|
|
274
|
+
# Row 3: Symbols with horizontal stretches
|
|
275
|
+
row3 = KeyboardRow([
|
|
276
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
277
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickSymbols, None, 'img/symbols.png'),
|
|
278
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
279
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '"*\'/:!?+'],
|
|
280
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
281
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickBack, None, 'img/back.png'),
|
|
282
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
283
|
+
])
|
|
284
|
+
rowList.append(row3)
|
|
285
|
+
|
|
286
|
+
# Row 4: Numbers, Space, Enter
|
|
287
|
+
row4 = KeyboardRow([
|
|
288
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
289
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickLetters, None, 'img/letters.png'),
|
|
290
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
291
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, ","),
|
|
292
|
+
KeyboardButton(self.buttonHeight * 6, self.buttonHeight, self.onClickSpace, None, 'img/space.png'),
|
|
293
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, "."),
|
|
294
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
295
|
+
KeyboardButton(self.buttonHeight * 1.5, self.buttonHeight, self.onClickEnter, None, 'img/enter.png'),
|
|
296
|
+
QSpacerItem(20, 40, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
297
|
+
])
|
|
298
|
+
rowList.append(row4)
|
|
299
|
+
|
|
300
|
+
# Add the rows to the KeyboardView
|
|
301
|
+
keyboardView = KeyboardView(rowList)
|
|
302
|
+
container = QWidget()
|
|
303
|
+
container.setLayout(keyboardView)
|
|
304
|
+
self.addWidget(container)
|
|
305
|
+
|
|
306
|
+
def addKeyboardLayout3(self):
|
|
307
|
+
rowList = []
|
|
308
|
+
|
|
309
|
+
# Row 1: Extended symbols
|
|
310
|
+
row1 = KeyboardRow([
|
|
311
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
312
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '$€¥¢©®µ~¿¡'],
|
|
313
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
314
|
+
])
|
|
315
|
+
rowList.append(row1)
|
|
316
|
+
|
|
317
|
+
# Row 2: Additional symbols
|
|
318
|
+
row2 = KeyboardRow([
|
|
319
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
320
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '¼½¾[]{}<>^'],
|
|
321
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
322
|
+
])
|
|
323
|
+
rowList.append(row2)
|
|
324
|
+
|
|
325
|
+
# Row 3: Symbols with horizontal stretches
|
|
326
|
+
row3 = KeyboardRow([
|
|
327
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
328
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickNumbers, None, 'img/numbers.png'),
|
|
329
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
330
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '`;÷\\∣|¬±'],
|
|
331
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
332
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickBack, None, 'img/back.png'),
|
|
333
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
334
|
+
])
|
|
335
|
+
rowList.append(row3)
|
|
336
|
+
|
|
337
|
+
# Row 4: Numbers, Space, Enter
|
|
338
|
+
row4 = KeyboardRow([
|
|
339
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum),
|
|
340
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickLetters, None, 'img/letters.png'),
|
|
341
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
342
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, ","),
|
|
343
|
+
KeyboardButton(self.buttonHeight * 3, self.buttonHeight, self.onClickSpace, None, 'img/space.png'),
|
|
344
|
+
QSpacerItem(self.buttonHeight * 0.05, 0, QSizePolicy.Fixed, QSizePolicy.Minimum),
|
|
345
|
+
*[KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickChar, char) for char in '✕§¶°'],
|
|
346
|
+
KeyboardButton(self.buttonHeight, self.buttonHeight, self.onClickEnter, None, 'img/enter.png'),
|
|
347
|
+
QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
348
|
+
])
|
|
349
|
+
rowList.append(row4)
|
|
350
|
+
|
|
351
|
+
# Add the rows to the KeyboardView
|
|
352
|
+
keyboardView = KeyboardView(rowList)
|
|
353
|
+
container = QWidget()
|
|
354
|
+
container.setLayout(keyboardView)
|
|
355
|
+
self.addWidget(container)
|
|
356
|
+
|
|
357
|
+
# Callback functions
|
|
358
|
+
def onClickChar(self,keycode):
|
|
359
|
+
# print(f"Key pressed: {keycode}")
|
|
360
|
+
self.textField.add_character(keycode)
|
|
361
|
+
|
|
362
|
+
def onClickShift(self,keycode):
|
|
363
|
+
# print("Shift pressed")
|
|
364
|
+
if self.currentIndex() == 0:
|
|
365
|
+
self.setCurrentIndex(1)
|
|
366
|
+
elif self.currentIndex() == 1:
|
|
367
|
+
self.setCurrentIndex(0)
|
|
368
|
+
|
|
369
|
+
def onClickLetters(self,keycode):
|
|
370
|
+
# print("Letters pressed")
|
|
371
|
+
self.setCurrentIndex(0)
|
|
372
|
+
|
|
373
|
+
def onClickNumbers(self,keycode):
|
|
374
|
+
# print("Numbers pressed")
|
|
375
|
+
self.setCurrentIndex(2)
|
|
376
|
+
|
|
377
|
+
def onClickSymbols(self,keycode):
|
|
378
|
+
# print("Symbols pressed")
|
|
379
|
+
self.setCurrentIndex(3)
|
|
380
|
+
|
|
381
|
+
def onClickBack(self,keycode):
|
|
382
|
+
# print("Backspace pressed")
|
|
383
|
+
self.textField.backspace()
|
|
384
|
+
|
|
385
|
+
def onClickSpace(self,keycode):
|
|
386
|
+
# print("Space pressed")
|
|
387
|
+
self.textField.add_character(' ')
|
|
388
|
+
|
|
389
|
+
def onClickEnter(self,keycode):
|
|
390
|
+
# print("Enter pressed")
|
|
391
|
+
# print(self.textField.get_content())
|
|
392
|
+
if self.onFinished: self.onFinished()
|
easycoder/ec_pyside.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
from
|
|
2
|
+
from .ec_handler import Handler
|
|
3
|
+
from .ec_classes import RuntimeError
|
|
4
|
+
from .ec_keyboard import Keyboard
|
|
3
5
|
from PySide6.QtCore import Qt, QTimer
|
|
4
6
|
from PySide6.QtGui import QPixmap
|
|
5
7
|
from PySide6.QtWidgets import (
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: easycoder
|
|
3
|
-
Version:
|
|
3
|
+
Version: 250723.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>
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
License-File: LICENSE
|
|
9
10
|
Requires-Dist: pytz
|
|
10
11
|
Requires-Dist: requests
|
|
11
12
|
Requires-Dist: psutil
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
easycoder/__init__.py,sha256=Mxb07mPgCCThrDez6IyWZ5nHId70pSgjmRiLAM4wOyc,314
|
|
2
|
+
easycoder/ec_classes.py,sha256=PWPaJuTfaWD4-tgT-2WWOgeFV_jXxlxyKCxvXyylCUU,1824
|
|
3
|
+
easycoder/ec_compiler.py,sha256=9byLqJZgMHAyFFyD8eGhY77oTsY1GY1aVcVrU4JAbd4,5287
|
|
4
|
+
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
5
|
+
easycoder/ec_core.py,sha256=U1iOw0FKqAAvSShiDyFmBc9LlPyDRxzvgXlioSEK-KI,99679
|
|
6
|
+
easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
|
|
7
|
+
easycoder/ec_keyboard.py,sha256=BqqGGdY5fa4aw3zPxdhzeH7FHwzm9H3r76O59BwsaEQ,17027
|
|
8
|
+
easycoder/ec_program.py,sha256=SHg8NV9g-DclSWz8pQzgAiElreoYrI1FR1NrZS4_hIA,9968
|
|
9
|
+
easycoder/ec_pyside.py,sha256=15-brpZnAZTkR111KYllbo7k3qbbqr4Umww_ngzhsmk,42243
|
|
10
|
+
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
11
|
+
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
12
|
+
easycoder-250723.1.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
13
|
+
easycoder-250723.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
14
|
+
easycoder-250723.1.dist-info/WHEEL,sha256=Dyt6SBfaasWElUrURkknVFAZDHSTwxg3PaTza7RSbkY,100
|
|
15
|
+
easycoder-250723.1.dist-info/METADATA,sha256=vzujrGHNWxlC5TOhVRPwFjfuAFkdqLVprnlGadH6GkA,6897
|
|
16
|
+
easycoder-250723.1.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
easycoder/__init__.py,sha256=uWGufotCp7AXWc9VsFY-PxT1EhZ5qsYbuVLv3bE9y5Y,314
|
|
2
|
-
easycoder/ec_classes.py,sha256=PWPaJuTfaWD4-tgT-2WWOgeFV_jXxlxyKCxvXyylCUU,1824
|
|
3
|
-
easycoder/ec_compiler.py,sha256=9byLqJZgMHAyFFyD8eGhY77oTsY1GY1aVcVrU4JAbd4,5287
|
|
4
|
-
easycoder/ec_condition.py,sha256=YXvSBQKEzKGCcgUGo3Qp8iHolXmm2BpEm0NimSDszIM,785
|
|
5
|
-
easycoder/ec_core.py,sha256=6fBZYfX93563xqkpORovNpYdOkdQ3GZyn95WPm61WKg,99606
|
|
6
|
-
easycoder/ec_handler.py,sha256=ohf3xUuWw_Qb5SZnulGtDhvCb11kvWtYfgbQTiOXpIY,2261
|
|
7
|
-
easycoder/ec_program.py,sha256=SHg8NV9g-DclSWz8pQzgAiElreoYrI1FR1NrZS4_hIA,9968
|
|
8
|
-
easycoder/ec_pyside.py,sha256=DkTw8SIEutDti7crhWQeMd-7ybErdR9L-IbQS7UVUbg,42184
|
|
9
|
-
easycoder/ec_timestamp.py,sha256=myQnnF-mT31_1dpQKv2VEAu4BCcbypvMdzq7_DUi1xc,277
|
|
10
|
-
easycoder/ec_value.py,sha256=zgDJTJhIg3yOvmnnKIfccIizmIhGbtvL_ghLTL1T5fg,2516
|
|
11
|
-
easycoder-250722.4.dist-info/entry_points.txt,sha256=JXAZbenl0TnsIft2FcGJbJ-4qoztVu2FuT8PFmWFexM,44
|
|
12
|
-
easycoder-250722.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
13
|
-
easycoder-250722.4.dist-info/WHEEL,sha256=ssQ84EZ5gH1pCOujd3iW7HClo_O_aDaClUbX4B8bjKY,100
|
|
14
|
-
easycoder-250722.4.dist-info/METADATA,sha256=5IETx8v0NEMVXnfGBCi-XnHpWwYQxbV8eT3pLtgOEsI,6875
|
|
15
|
-
easycoder-250722.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|