Skip to content

Commit

Permalink
fix to pass lists as macros
Browse files Browse the repository at this point in the history
  • Loading branch information
keenanlang committed Jul 1, 2024
1 parent 45dcfca commit 0c6f4c7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
23 changes: 14 additions & 9 deletions gestalt/Type.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def copy(self):
def val(self):
if self.standard:
output = self.value

for macrolist in reversed(self.macros):
try:
output = output.format(**macrolist)
Expand All @@ -66,7 +66,6 @@ def val(self):
if key in self.updates:
output[key] = self.updates[key]
continue


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

return output


elif self.list:
output = copy.deepcopy(self.value)

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

for macrolist in reversed(self.macros):
try:
output[index] = str(output[index]).format(**macrolist)
except:
pass
index_val = DataType("temp", output[index])

for macrolist in self.macros:
index_val.apply(macrolist)

try:
output[index] = str(index_val).val()
except:
pass

return output

Expand Down Expand Up @@ -220,6 +222,10 @@ def val(self):

def __getitem__(self, key):
return int(self.val()[key])

def __repr__(self):
data = self.val()
return "{x}x{y}x{width}x{height}".format(**data)


#######################
Expand Down Expand Up @@ -353,7 +359,6 @@ class List(DataType):
def __init__(self, data):
super().__init__("list", data)


def val(self):
output = []
data = super().val()
Expand Down
10 changes: 8 additions & 2 deletions gestalt/convert/phoebus/CSSGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ def generatePolygon(self, node, macros={}):
output.link("line", "border-color")
output.link("line_width", "border-width")

for point in node.points:
my_points = List(node.points)
my_points.apply(macros)

for point in my_points:
a_point = Rect(point)
a_point.apply(macros)

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

for point in node.points:
my_points = List(node.points)
my_points.apply(macros)

for point in my_points:
a_point = Rect(point)
a_point.apply(macros)

Expand Down
11 changes: 7 additions & 4 deletions gestalt/convert/qt/QtGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ def generatePolygon(self, node, macros={}):

xy_pairs = ""

for point in node.points:
my_points = List(node.points)
my_points.apply(macros)

for point in my_points:
a_point = Rect(point)
a_point.apply(macros)

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

xy_pairs = ""

#my_points = List(node.points)
#my_points.apply(macros)
my_points = List(node.points)
my_points.apply(macros)

for point in node.points:
for point in my_points:
a_point = Rect(point)
a_point.apply(macros)

Expand Down

0 comments on commit 0c6f4c7

Please sign in to comment.