Skip to content

Commit 9126b42

Browse files
committed
250423.2
1 parent d7bcdd0 commit 9126b42

10 files changed

+120
-71
lines changed

config.ecs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,12 @@
104104
create Layout type QHBoxLayout
105105
add Layout to Group
106106
create SystemsCombo
107-
add `System 1` to SystemsCombo
108-
add `System 2` to SystemsCombo
109-
add `System 3` to SystemsCombo
110107
add stretch SystemsCombo to Layout
111108
create AddSystemButton text `Add`
112109
on click AddSystemButton go to AddSystem
113110
add AddSystemButton to Layout
114111
create RemoveSystemButton text `Remove`
112+
disable RemoveSystemButton
115113
on click RemoveSystemButton go to RemoveSystem
116114
add RemoveSystemButton to Layout
117115

@@ -233,7 +231,13 @@
233231
show MainPanel in Window
234232

235233
start graphics
236-
log `Graphics running`
234+
235+
PopulateForm:
236+
log `Populate the form`
237+
add `System 1` to SystemsCombo
238+
add `System 2` to SystemsCombo
239+
add `System 3` to SystemsCombo
240+
if the count of SystemsCombo is not 0 enable RemoveSystemButton
237241
stop
238242

239243
ResetConfigFile:
@@ -276,14 +280,15 @@ AddSystem:
276280
stop
277281

278282
RemoveSystem:
279-
log `Remove this system?`
280283
put SystemsCombo into Name
284+
log `Remove ` cat Name cat `?`
281285
create MessageBox on Window
282286
style question
283287
title `Remove system`
284288
message `Are you sure you want to remove ` cat Name cat `?`
285289
show MessageBox giving Value
286-
log Value
290+
if Value is `Yes` remove current item from SystemsCombo
291+
if the count of SystemsCombo is 0 disable RemoveSystemButton
287292
stop
288293

289294
SaveHostInfo:
-37.4 KB
Binary file not shown.
37.6 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__ = "250423.1"
12+
__version__ = "250423.2"

easycoder/ec_compiler.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def getSymbolRecord(self):
114114
def compileLabel(self, command):
115115
return self.compileSymbol(command, self.getToken(), False)
116116

117-
def compileVariable(self, command, valueHolder = False):
118-
return self.compileSymbol(command, self.nextToken(), valueHolder)
117+
def compileVariable(self, command, hasValue = False):
118+
return self.compileSymbol(command, self.nextToken(), hasValue)
119119

120-
def compileSymbol(self, command, name, valueHolder):
120+
def compileSymbol(self, command, name, hasValue):
121121
try:
122122
v = self.symbols[name]
123123
except:
@@ -128,7 +128,7 @@ def compileSymbol(self, command, name, valueHolder):
128128
self.symbols[name] = self.getPC()
129129
command['program'] = self.program
130130
command['type'] = 'symbol'
131-
command['valueHolder'] = valueHolder
131+
command['hasValue'] = hasValue
132132
command['name'] = name
133133
command['elements'] = 1
134134
command['index'] = 0

easycoder/ec_core.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def k_add(self, command):
2626
if self.nextToken() == 'to':
2727
if self.nextIsSymbol():
2828
symbolRecord = self.getSymbolRecord()
29-
if symbolRecord['valueHolder']:
29+
if symbolRecord['hasValue']:
3030
if self.peek() == 'giving':
3131
# This variable must be treated as a second value
3232
command['value2'] = self.getValue()
@@ -57,7 +57,7 @@ def r_add(self, command):
5757
except:
5858
value2 = None
5959
target = self.getVariable(command['target'])
60-
if not target['valueHolder']:
60+
if not target['hasValue']:
6161
self.variableDoesNotHoldAValueError(target['name'])
6262
targetValue = self.getSymbolValue(target)
6363
if targetValue == None:
@@ -87,7 +87,7 @@ def k_append(self, command):
8787
if self.nextIs('to'):
8888
if self.nextIsSymbol():
8989
symbolRecord = self.getSymbolRecord()
90-
if symbolRecord['valueHolder']:
90+
if symbolRecord['hasValue']:
9191
command['target'] = symbolRecord['name']
9292
self.add(command)
9393
return True
@@ -149,7 +149,7 @@ def k_begin(self, command):
149149
def k_clear(self, command):
150150
if self.nextIsSymbol():
151151
target = self.getSymbolRecord()
152-
if target['valueHolder']:
152+
if target['hasValue']:
153153
command['target'] = target['name']
154154
self.add(command)
155155
return True
@@ -245,7 +245,7 @@ def r_debug(self, command):
245245
def k_decrement(self, command):
246246
if self.nextIsSymbol():
247247
symbolRecord = self.getSymbolRecord()
248-
if symbolRecord['valueHolder']:
248+
if symbolRecord['hasValue']:
249249
command['target'] = self.getToken()
250250
self.add(command)
251251
return True
@@ -325,7 +325,7 @@ def r_divide(self, command):
325325
except:
326326
value2 = None
327327
target = self.getVariable(command['target'])
328-
if not target['valueHolder']:
328+
if not target['hasValue']:
329329
self.variableDoesNotHoldAValueError(target['name'])
330330
return None
331331
value = self.getSymbolValue(target)
@@ -400,7 +400,7 @@ def r_fork(self, command):
400400
def k_get(self, command):
401401
if self.nextIsSymbol():
402402
symbolRecord = self.getSymbolRecord()
403-
if symbolRecord['valueHolder']:
403+
if symbolRecord['hasValue']:
404404
command['target'] = self.getToken()
405405
else:
406406
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
@@ -610,7 +610,7 @@ def r_import(self, command):
610610
def k_increment(self, command):
611611
if self.nextIsSymbol():
612612
symbolRecord = self.getSymbolRecord()
613-
if symbolRecord['valueHolder']:
613+
if symbolRecord['hasValue']:
614614
command['target'] = self.getToken()
615615
self.add(command)
616616
return True
@@ -701,7 +701,7 @@ def k_load(self, command):
701701
return True
702702
elif self.isSymbol():
703703
symbolRecord = self.getSymbolRecord()
704-
if symbolRecord['valueHolder']:
704+
if symbolRecord['hasValue']:
705705
command['target'] = symbolRecord['name']
706706
if self.nextIs('from'):
707707
command['file'] = self.nextValue()
@@ -785,7 +785,7 @@ def r_multiply(self, command):
785785
except:
786786
value2 = None
787787
target = self.getVariable(command['target'])
788-
if not target['valueHolder']:
788+
if not target['hasValue']:
789789
self.variableDoesNotHoldAValueError(target['name'])
790790
return None
791791
value = self.getSymbolValue(target)
@@ -810,7 +810,7 @@ def r_multiply(self, command):
810810
def k_negate(self, command):
811811
if self.nextIsSymbol():
812812
symbolRecord = self.getSymbolRecord()
813-
if symbolRecord['valueHolder']:
813+
if symbolRecord['hasValue']:
814814
command['target'] = self.getToken()
815815
self.add(command)
816816
return True
@@ -819,7 +819,7 @@ def k_negate(self, command):
819819

820820
def r_negate(self, command):
821821
symbolRecord = self.getVariable(command['target'])
822-
if not symbolRecord['valueHolder']:
822+
if not symbolRecord['hasValue']:
823823
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
824824
return None
825825
value = self.getSymbolValue(symbolRecord)
@@ -921,7 +921,7 @@ def k_pop(self, command):
921921

922922
def r_pop(self, command):
923923
symbolRecord = self.getVariable(command['target'])
924-
if not symbolRecord['valueHolder']:
924+
if not symbolRecord['hasValue']:
925925
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
926926
stackRecord = self.getVariable(command['from'])
927927
stack = self.getSymbolValue(stackRecord)
@@ -1060,7 +1060,7 @@ def k_put(self, command):
10601060
if self.nextIsSymbol():
10611061
symbolRecord = self.getSymbolRecord()
10621062
command['target'] = symbolRecord['name']
1063-
if 'valueholder' in symbolRecord and symbolRecord['valueHolder'] == False:
1063+
if 'hasValue' in symbolRecord and symbolRecord['hasValue'] == False:
10641064
FatalError(self.compiler, f'Symbol {symbolRecord["name"]} is not a value holder')
10651065
else:
10661066
self.add(command)
@@ -1074,7 +1074,7 @@ def r_put(self, command):
10741074
if value == None:
10751075
return -1
10761076
symbolRecord = self.getVariable(command['target'])
1077-
if not symbolRecord['valueHolder']:
1077+
if not symbolRecord['hasValue']:
10781078
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
10791079
return -1
10801080
self.putSymbolValue(symbolRecord, value)
@@ -1090,7 +1090,7 @@ def k_read(self, command):
10901090
command['line'] = False
10911091
if self.nextIsSymbol():
10921092
symbolRecord = self.getSymbolRecord()
1093-
if symbolRecord['valueHolder']:
1093+
if symbolRecord['hasValue']:
10941094
if self.peek() == 'from':
10951095
self.nextToken()
10961096
if self.nextIsSymbol():
@@ -1259,7 +1259,7 @@ def r_send(self, command):
12591259
def k_set(self, command):
12601260
if self.nextIsSymbol():
12611261
target = self.getSymbolRecord()
1262-
if target['valueHolder']:
1262+
if target['hasValue']:
12631263
command['type'] = 'set'
12641264
command['target'] = target['name']
12651265
self.add(command)
@@ -1384,7 +1384,7 @@ def r_set(self, command):
13841384
def k_split(self, command):
13851385
if self.nextIsSymbol():
13861386
symbolRecord = self.getSymbolRecord()
1387-
if symbolRecord['valueHolder']:
1387+
if symbolRecord['hasValue']:
13881388
command['target'] = symbolRecord['name']
13891389
value = {}
13901390
value['type'] = 'text'
@@ -1423,7 +1423,7 @@ def r_split(self, command):
14231423
def k_shuffle(self, command):
14241424
if self.nextIsSymbol():
14251425
symbolRecord = self.getSymbolRecord()
1426-
if symbolRecord['valueHolder']:
1426+
if symbolRecord['hasValue']:
14271427
command['target'] = self.getToken()
14281428
self.add(command)
14291429
return True
@@ -1432,7 +1432,7 @@ def k_shuffle(self, command):
14321432

14331433
def r_shuffle(self, command):
14341434
symbolRecord = self.getVariable(command['target'])
1435-
if not symbolRecord['valueHolder']:
1435+
if not symbolRecord['hasValue']:
14361436
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
14371437
return None
14381438
value = self.getSymbolValue(symbolRecord)
@@ -1495,7 +1495,7 @@ def k_take(self, command):
14951495
if self.nextToken() == 'from':
14961496
if self.nextIsSymbol():
14971497
symbolRecord = self.getSymbolRecord()
1498-
if symbolRecord['valueHolder']:
1498+
if symbolRecord['hasValue']:
14991499
if self.peek() == 'giving':
15001500
# This variable must be treated as a second value
15011501
command['value2'] = self.getValue()
@@ -1530,7 +1530,7 @@ def r_take(self, command):
15301530
except:
15311531
value2 = None
15321532
target = self.getVariable(command['target'])
1533-
if not target['valueHolder']:
1533+
if not target['hasValue']:
15341534
self.variableDoesNotHoldAValueError(target['name'])
15351535
return None
15361536
value = self.getSymbolValue(target)
@@ -1552,7 +1552,7 @@ def r_take(self, command):
15521552
def k_toggle(self, command):
15531553
if self.nextIsSymbol():
15541554
target = self.getSymbolRecord()
1555-
if target['valueHolder']:
1555+
if target['hasValue']:
15561556
command['target'] = target['name']
15571557
self.add(command)
15581558
return True
@@ -1712,7 +1712,7 @@ def r_write(self, command):
17121712

17131713
def incdec(self, command, mode):
17141714
symbolRecord = self.getVariable(command['target'])
1715-
if not symbolRecord['valueHolder']:
1715+
if not symbolRecord['hasValue']:
17161716
RuntimeError(self.program, f'{symbolRecord["name"]} does not hold a value')
17171717
return None
17181718
value = self.getSymbolValue(symbolRecord)
@@ -1781,7 +1781,7 @@ def compileValue(self):
17811781
if self.nextToken() == 'of':
17821782
if self.nextIsSymbol():
17831783
symbolRecord = self.getSymbolRecord()
1784-
if symbolRecord['valueHolder']:
1784+
if symbolRecord['hasValue']:
17851785
value['target'] = symbolRecord['name']
17861786
return value
17871787
self.warning(f'Core.compileValue: Token \'{self.getToken()}\' does not hold a value')
@@ -1792,7 +1792,7 @@ def compileValue(self):
17921792
if self.nextToken() == 'of':
17931793
if self.nextIsSymbol():
17941794
symbolRecord = self.getSymbolRecord()
1795-
if symbolRecord['valueHolder']:
1795+
if symbolRecord['hasValue']:
17961796
value['target'] = symbolRecord['name']
17971797
return value
17981798
FatalError(self.compiler, 'Variable does not hold a value')
@@ -1838,8 +1838,9 @@ def compileValue(self):
18381838
if token == 'count':
18391839
if self.nextIs('of'):
18401840
if self.nextIsSymbol():
1841-
value['name'] = self.getToken()
1842-
return value
1841+
if self.getSymbolRecord()['hasValue']:
1842+
value['name'] = self.getToken()
1843+
return value
18431844
return None
18441845

18451846
if token == 'index':

easycoder/ec_graphics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ def r_frame(self, command):
165165
def k_get(self, command):
166166
if self.nextIsSymbol():
167167
symbolRecord = self.getSymbolRecord()
168-
if symbolRecord['valueHolder']:
168+
if symbolRecord['hasValue']:
169169
command['target'] = self.getToken()
170170
else:
171171
FatalError(self.compiler, f'Variable "{symbolRecord["name"]}" does not hold a value')
172-
if symbolRecord['valueHolder']:
172+
if symbolRecord['hasValue']:
173173
if self.nextIs('from'):
174174
if self.nextIs('popup'):
175175
command['ptype'] = self.nextToken()

easycoder/ec_program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def doValue(self, value):
149149
elif valType == 'symbol':
150150
name = value['name']
151151
symbolRecord = self.getSymbolRecord(name)
152-
if symbolRecord['valueHolder']:
152+
if symbolRecord['hasValue']:
153153
handler = self.domainIndex[symbolRecord['domain']].valueHandler('symbol')
154154
result = handler(symbolRecord)
155155
else:

0 commit comments

Comments
 (0)