Skip to content

Commit fd4e7d3

Browse files
committed
250520.1
1 parent ddac89f commit fd4e7d3

9 files changed

+45
-16
lines changed

backdrop.jpg

118 KB
Loading
-39.8 KB
Binary file not shown.
40 KB
Binary file not shown.
Binary file not shown.

easycoder/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
from .ec_timestamp import *
1010
from .ec_value import *
1111

12-
__version__ = "250518.1"
12+
__version__ = "250520.1"

easycoder/ec_compiler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def __init__(self, program):
1616
self.program.compiler = self
1717
self.addCommand = self.program.add
1818
self.compileConstant = self.value.compileConstant
19+
self.debugCompile = False
1920

2021
def getPC(self):
2122
return len(self.program.code)
@@ -174,7 +175,7 @@ def compileToken(self):
174175
self.rewindTo(mark)
175176
else:
176177
self.rewindTo(mark)
177-
FatalError(self, f'Unable to compile this "{token}" command. Perhaps a syntax error?')
178+
FatalError(self, f'Unable to compile this "{token}" command')
178179

179180
# Compile a single command
180181
def compileOne(self):
@@ -196,7 +197,7 @@ def compileFrom(self, index, stopOn):
196197
while True:
197198
token = self.tokens[self.index]
198199
keyword = token.token
199-
# line = self.script.lines[token.lino]
200+
if self.debugCompile: print(self.script.lines[token.lino])
200201
# print(f'{keyword} - {line}')
201202
# if keyword != 'else':
202203
if self.compileOne() == True:

easycoder/ec_core.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ def r_create(self, command):
202202
# Debug the script
203203
def k_debug(self, command):
204204
token = self.peek()
205-
if token in ['step', 'stop', 'program', 'custom']:
205+
if token == 'compile':
206+
self.compiler.debugCompile = True
207+
self.nextToken()
208+
return True
209+
elif token in ['step', 'stop', 'program', 'custom']:
206210
command['mode'] = token
207211
self.nextToken()
208212
elif token == 'stack':
@@ -222,7 +226,9 @@ def k_debug(self, command):
222226
return True
223227

224228
def r_debug(self, command):
225-
if command['mode'] == 'step':
229+
if command['mode'] == 'compile':
230+
self.program.debugStep = True
231+
elif command['mode'] == 'step':
226232
self.program.debugStep = True
227233
elif command['mode'] == 'stop':
228234
self.program.debugStep = False
@@ -1455,6 +1461,7 @@ def r_split(self, command):
14551461
content = value['content'].split(self.getRuntimeValue(command['on']))
14561462
elements = len(content)
14571463
target['elements'] = elements
1464+
target['index'] = 0
14581465
target['value'] = [None] * elements
14591466

14601467
for index, item in enumerate(content):

easycoder/ec_pyside.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class Graphics(Handler):
3939

4040
def __init__(self, compiler):
4141
Handler.__init__(self, compiler)
42+
self.blocked = False
4243

4344
def getName(self):
4445
return 'graphics'
@@ -83,13 +84,14 @@ def addToLayout():
8384
elif self.isSymbol():
8485
record = self.getSymbolRecord()
8586
if record['extra'] == 'gui':
86-
if self.peek() == 'to':
87-
# (2)
88-
record = self.getSymbolRecord()
89-
command['widget'] = record['name']
90-
self.nextToken()
91-
return addToLayout()
92-
return False
87+
if record['keyword'] in ['layout', 'groupbox', 'label', 'pushbutton', 'checkbox', 'lineinput', 'listbox', 'combobox']:
88+
if self.peek() == 'to':
89+
# (2)
90+
record = self.getSymbolRecord()
91+
command['widget'] = record['name']
92+
self.nextToken()
93+
return addToLayout()
94+
else: return False
9395
# (1)
9496
command['value'] = self.getValue()
9597
self.skip('to')
@@ -705,10 +707,12 @@ def r_select(self, command):
705707

706708
# set [the] width/height [of] {widget} [to] {value}
707709
# set [the] layout of {window} to {layout}
710+
# set [the] spacing of {layout} to {value}
708711
# set [the] text [of] {label}/{button}/{lineinput} [to] {text}
709712
# set [the] color [of] {label}/{button}/{lineinput} [to] {color}
710713
# set [the] state [of] {checkbox} [to] {color}
711714
# set {listbox} to {list}
715+
# set blocked true/false
712716
def k_set(self, command):
713717
self.skip('the')
714718
token = self.nextToken()
@@ -735,6 +739,16 @@ def k_set(self, command):
735739
command['layout'] = record['name']
736740
self.add(command)
737741
return True
742+
elif token == 'spacing':
743+
self.skip('of')
744+
if self.nextIsSymbol():
745+
record = self.getSymbolRecord()
746+
if record['keyword'] == 'layout':
747+
command['name'] = record['name']
748+
self.skip('to')
749+
command['value'] = self.nextValue()
750+
self.add(command)
751+
return True
738752
elif token == 'text':
739753
self.skip('of')
740754
if self.nextIsSymbol():
@@ -776,6 +790,9 @@ def k_set(self, command):
776790
command['value'] = self.nextValue()
777791
self.add(command)
778792
return True
793+
elif token == 'blocked':
794+
self.blocked = True if self.nextToken() == 'true' else False
795+
return True
779796
elif self.isSymbol():
780797
record = self.getSymbolRecord()
781798
if record['keyword'] == 'listbox':
@@ -797,11 +814,13 @@ def r_set(self, command):
797814
widget.setFixedWidth(self.getRuntimeValue(command['value']))
798815
elif what == 'layout':
799816
window = self.getVariable(command['name'])['window']
800-
layout = self.getVariable(command['layout'])
801817
content = self.getVariable(command['layout'])['widget']
802818
container = QWidget()
803819
container.setLayout(content)
804820
window.setCentralWidget(container)
821+
elif what == 'spacing':
822+
layout = self.getVariable(command['name'])['widget']
823+
layout.setSpacing(self.getRuntimeValue(command['value']))
805824
elif what == 'text':
806825
record = self.getVariable(command['name'])
807826
widget = self.getVariable(command['name'])['widget']
@@ -891,14 +910,14 @@ def k_start(self, command):
891910
def r_start(self, command):
892911
def on_last_window_closed():
893912
self.program.kill()
894-
def resume():
913+
def init():
895914
self.program.flush(self.nextPC())
896915
def flush():
897-
self.program.flushCB()
916+
if not self.blocked: self.program.flushCB()
898917
timer = QTimer()
899918
timer.timeout.connect(flush)
900919
timer.start(10)
901-
QTimer.singleShot(500, resume)
920+
QTimer.singleShot(500, init)
902921
self.app.lastWindowClosed.connect(on_last_window_closed)
903922
self.app.exec()
904923

testrc.py

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/python3
2+
13
from easycoder import Program
24

35
Program('../../rbr/rbrconf.ecs').start()

0 commit comments

Comments
 (0)