Skip to content

Commit 706effd

Browse files
committed
250807.1
1 parent b039880 commit 706effd

File tree

7 files changed

+39
-39
lines changed

7 files changed

+39
-39
lines changed
Binary file not shown.

easycoder/__init__.py

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

14-
__version__ = "250805.1"
14+
__version__ = "250807.1"

easycoder/ec_core.py

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -593,39 +593,29 @@ def r_if(self, command):
593593
self.program.pc += 1
594594
return self.program.pc
595595

596+
# Import one or more variables
596597
def k_import(self, command):
597-
if self.peek() == 'plugin':
598-
# Import a plugin
598+
imports = []
599+
while True:
600+
keyword = self.nextToken()
601+
name = self.nextToken()
602+
item = [keyword, name]
603+
imports.append(item)
604+
self.symbols[name] = self.getPC()
605+
variable = {}
606+
variable['domain'] = None
607+
variable['name'] = name
608+
variable['keyword'] = keyword
609+
variable['import'] = None
610+
variable['used'] = False
611+
variable['hasValue'] = True if keyword == 'variable' else False
612+
self.add(variable)
613+
if self.peek() != 'and':
614+
break
599615
self.nextToken()
600-
clazz = self.nextToken()
601-
if self.nextIs('from'):
602-
source = self.nextToken()
603-
self.program.importPlugin(f'{source}:{clazz}')
604-
return True
605-
return False
606-
else:
607-
# Import one or more variables
608-
imports = []
609-
while True:
610-
keyword = self.nextToken()
611-
name = self.nextToken()
612-
item = [keyword, name]
613-
imports.append(item)
614-
self.symbols[name] = self.getPC()
615-
variable = {}
616-
variable['domain'] = None
617-
variable['name'] = name
618-
variable['keyword'] = keyword
619-
variable['import'] = None
620-
variable['used'] = False
621-
variable['hasValue'] = True if keyword == 'variable' else False
622-
self.add(variable)
623-
if self.peek() != 'and':
624-
break
625-
self.nextToken()
626-
command['imports'] = json.dumps(imports)
627-
self.add(command)
628-
return True
616+
command['imports'] = json.dumps(imports)
617+
self.add(command)
618+
return True
629619

630620
def r_import(self, command):
631621
exports = self.program.exports
@@ -1763,8 +1753,16 @@ def r_unlock(self, command):
17631753

17641754
# Use a plugin module
17651755
def k_use(self, command):
1766-
self.skip('plugin')
1767-
if self.nextIs('graphics'):
1756+
if self.peek() == 'plugin':
1757+
# Import a plugin
1758+
self.nextToken()
1759+
clazz = self.nextToken()
1760+
if self.nextIs('from'):
1761+
source = self.nextToken()
1762+
self.program.importPlugin(f'{source}:{clazz}')
1763+
return True
1764+
return False
1765+
elif self.nextIs('graphics'):
17681766
print('Loading graphics module')
17691767
from .ec_pyside import Graphics
17701768
self.program.graphics = Graphics
@@ -2476,7 +2474,7 @@ def v_random(self, v):
24762474
limit = self.getRuntimeValue(v['content'])
24772475
value = {}
24782476
value['type'] = 'int'
2479-
value['content'] = randrange(0, limit)
2477+
value['content'] = random.randrange(0, limit)
24802478
return value
24812479

24822480
def v_right(self, v):

easycoder/ec_program.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, argv):
2222
if len(argv) == 0:
2323
print('No script supplied')
2424
exit()
25+
if argv in ['-v', '--version']: return
2526
scriptName = argv
2627

2728
f = open(scriptName, 'r')
@@ -47,6 +48,7 @@ def __init__(self, argv):
4748
self.externalControl = False
4849
self.ticker = 0
4950
self.running = True
51+
self.start()
5052

5153
# This is called at 10msec intervals by the GUI code
5254
def flushCB(self):
@@ -388,9 +390,9 @@ def handleMessage(self, message):
388390
# This is the program launcher
389391
def Main():
390392
if (len(sys.argv) > 1):
391-
Program(sys.argv[1]).start()
393+
Program(sys.argv[1])
392394
else:
393-
print('Syntax: easycoder <scriptname> [plugins]')
395+
Program('-v')
394396

395397
if __name__ == '__main__':
396398
Main()

testrc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from easycoder import Program
55

66
os.chdir('../../rbr/')
7-
Program('rbrconf.ecs').start()
7+
Program('rbrconf.ecs')

testui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
from easycoder import Program
55

66
os.chdir('../../rbr/roombyroom/Controller/ui')
7-
Program('rbr_ui.ecs').start()
7+
Program('rbr_ui.ecs')

0 commit comments

Comments
 (0)