Skip to content

Commit 0c6f4c7

Browse files
committed
fix to pass lists as macros
1 parent 45dcfca commit 0c6f4c7

File tree

3 files changed

+29
-15
lines changed

3 files changed

+29
-15
lines changed

gestalt/Type.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def copy(self):
5050
def val(self):
5151
if self.standard:
5252
output = self.value
53-
53+
5454
for macrolist in reversed(self.macros):
5555
try:
5656
output = output.format(**macrolist)
@@ -66,7 +66,6 @@ def val(self):
6666
if key in self.updates:
6767
output[key] = self.updates[key]
6868
continue
69-
7069

7170
for macrolist in reversed(self.macros):
7271
try:
@@ -76,7 +75,6 @@ def val(self):
7675

7776
return output
7877

79-
8078
elif self.list:
8179
output = copy.deepcopy(self.value)
8280

@@ -85,11 +83,15 @@ def val(self):
8583
output[index] = self.updates[index]
8684
continue
8785

88-
for macrolist in reversed(self.macros):
89-
try:
90-
output[index] = str(output[index]).format(**macrolist)
91-
except:
92-
pass
86+
index_val = DataType("temp", output[index])
87+
88+
for macrolist in self.macros:
89+
index_val.apply(macrolist)
90+
91+
try:
92+
output[index] = str(index_val).val()
93+
except:
94+
pass
9395

9496
return output
9597

@@ -220,6 +222,10 @@ def val(self):
220222

221223
def __getitem__(self, key):
222224
return int(self.val()[key])
225+
226+
def __repr__(self):
227+
data = self.val()
228+
return "{x}x{y}x{width}x{height}".format(**data)
223229

224230

225231
#######################
@@ -353,7 +359,6 @@ class List(DataType):
353359
def __init__(self, data):
354360
super().__init__("list", data)
355361

356-
357362
def val(self):
358363
output = []
359364
data = super().val()

gestalt/convert/phoebus/CSSGenerator.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ def generatePolygon(self, node, macros={}):
185185
output.link("line", "border-color")
186186
output.link("line_width", "border-width")
187187

188-
for point in node.points:
188+
my_points = List(node.points)
189+
my_points.apply(macros)
190+
191+
for point in my_points:
189192
a_point = Rect(point)
190193
a_point.apply(macros)
191194

@@ -200,7 +203,10 @@ def generatePolyline(self, node, macros={}):
200203
output.link("line", "border-color")
201204
output.link("line_width", "border-width")
202205

203-
for point in node.points:
206+
my_points = List(node.points)
207+
my_points.apply(macros)
208+
209+
for point in my_points:
204210
a_point = Rect(point)
205211
a_point.apply(macros)
206212

gestalt/convert/qt/QtGenerator.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,10 @@ def generatePolygon(self, node, macros={}):
171171

172172
xy_pairs = ""
173173

174-
for point in node.points:
174+
my_points = List(node.points)
175+
my_points.apply(macros)
176+
177+
for point in my_points:
175178
a_point = Rect(point)
176179
a_point.apply(macros)
177180

@@ -193,10 +196,10 @@ def generatePolyline(self, node, macros={}):
193196

194197
xy_pairs = ""
195198

196-
#my_points = List(node.points)
197-
#my_points.apply(macros)
199+
my_points = List(node.points)
200+
my_points.apply(macros)
198201

199-
for point in node.points:
202+
for point in my_points:
200203
a_point = Rect(point)
201204
a_point.apply(macros)
202205

0 commit comments

Comments
 (0)