Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance work #740

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Lib/glyphsLib/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ def plistValue(self, format_version=2):
)

@classmethod
def read(cls, line):
def read(cls, line, parent=None):
"""Parse a Glyphs node string into a GSNode.

The format of a Glyphs node string (`line`) is:
Expand All @@ -1966,10 +1966,11 @@ def read(cls, line):
parser = Parser()
node._userData = parser.parse(value)

node._parent = parent
return node

@classmethod
def read_v3(cls, lst):
def read_v3(cls, lst, parent=None):
position = (lst[0], lst[1])
smooth = lst[2].endswith("s")
if lst[2][0] == "c":
Expand All @@ -1985,6 +1986,8 @@ def read_v3(cls, lst):
node = cls(position=position, type=node_type, smooth=smooth)
if len(lst) > 3:
node._userData = lst[3]

node._parent = parent
return node

@property
Expand Down Expand Up @@ -2102,10 +2105,7 @@ def _parse_nodes_dict(self, parser, d):
read_node = GSNode.read_v3
else:
read_node = GSNode.read
for x in d:
node = read_node(x)
node._parent = self
self._nodes.append(node)
self.nodes.extend(read_node(x, self) for x in d)

def __init__(self):
self.closed = self._defaultsForName["closed"]
Expand Down