Skip to content

Commit 2873b0c

Browse files
committed
250725.3
1 parent 45a4ab0 commit 2873b0c

File tree

7 files changed

+30
-16
lines changed

7 files changed

+30
-16
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__ = "250725.2"
14+
__version__ = "250725.3"

easycoder/ec_compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def add(self, command):
8282
self.code.append(command)
8383

8484
def isSymbol(self):
85-
token=self.getToken()
85+
token = self.getToken()
8686
try:
8787
self.symbols[token]
8888
except:

easycoder/ec_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2196,7 +2196,7 @@ def v_datime(self, v):
21962196
fmt = self.getRuntimeValue(fmt)
21972197
value = {}
21982198
value['type'] = 'text'
2199-
value['content'] = datetime.fromtimestamp(ts/1000).strftime(fmt)
2199+
value['content'] = datetime.fromtimestamp(ts).strftime(fmt)
22002200
return value
22012201

22022202
def v_decode(self, v):

easycoder/ec_pyside.py

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,44 @@ def afterShown(self):
7373
# (2) add {widget} to {layout}
7474
# (3) add stretch {widget} to {layout}
7575
# (4) add stretch to {layout}
76+
# (5) add spacer {size} to {layout}
7677
def k_add(self, command):
7778
def addToLayout():
7879
if self.nextIsSymbol():
7980
record = self.getSymbolRecord()
80-
command['layout'] = record['name']
81-
self.add(command)
82-
return True
81+
if record['keyword'] in ['layout', 'groupbox', 'element']:
82+
command['layout'] = record['name']
83+
self.add(command)
84+
return True
8385
return False
84-
85-
command['stretch'] = False
86-
if self.nextIs('stretch'):
87-
# It's either (3) or (4)
86+
87+
token = self.peek()
88+
if token == 'stretch':
8889
self.nextToken()
89-
if self.tokenIs('to'):
90+
# It's either (3) or (4)
91+
if self.nextIs('to'):
9092
# (4)
93+
command['stretch'] = False
9194
command['widget'] = 'stretch'
9295
return addToLayout()
93-
# (3)
9496
if self.isSymbol():
97+
# (3)
9598
record = self.getSymbolRecord()
9699
command['widget'] = record['name']
97100
command['stretch'] = True
98101
if self.nextIs('to'):
99102
return addToLayout()
100103
return False
104+
105+
elif token == 'spacer':
106+
self.nextToken()
107+
command['widget'] = 'spacer'
108+
command['size'] = self.nextValue()
109+
self.skip('to')
110+
return addToLayout()
101111

102112
# Here it's either (1) or (2)
103-
elif self.isSymbol():
113+
elif self.nextIsSymbol():
104114
record = self.getSymbolRecord()
105115
if record['extra'] == 'gui':
106116
if self.isWidget(record['keyword']):
@@ -134,12 +144,14 @@ def r_add(self, command):
134144
widget = command['widget']
135145
if widget == 'stretch':
136146
layoutRecord['widget'].addStretch()
147+
elif widget == 'spacer':
148+
layoutRecord['widget'].addSpacing(self.getRuntimeValue(command['size']))
137149
else:
138150
widgetRecord = self.getVariable(widget)
139151
layoutRecord = self.getVariable(command['layout'])
140152
widget = widgetRecord['widget']
141153
layout = layoutRecord['widget']
142-
stretch = command['stretch']
154+
stretch = 'stretch' in command
143155
if widgetRecord['keyword'] == 'layout':
144156
if layoutRecord['keyword'] == 'groupbox':
145157
if widgetRecord['keyword'] == 'layout':
@@ -432,7 +444,7 @@ def r_createGroupBox(self, command, record):
432444
return self.nextPC()
433445

434446
def r_createLabel(self, command, record):
435-
label = QLabel(self.getRuntimeValue(command['text']))
447+
label = QLabel(str(self.getRuntimeValue(command['text'])))
436448
if 'size' in command:
437449
fm = label.fontMetrics()
438450
c = label.contentsMargins()

testrc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/python3
22

3+
import os
34
from easycoder import Program
45

5-
Program('../../rbr/rbrconf.ecs').start()
6+
os.chdir('../../rbr/roombyroom/Controller/ui')
7+
Program('rbrconf.ecs').start()

0 commit comments

Comments
 (0)