Skip to content

Commit

Permalink
use a simple loop to load all glyphs during a save as
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Feb 27, 2017
1 parent 2a44345 commit a912b50
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 2 additions & 5 deletions Lib/defcon/objects/layer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import absolute_import
import collections
import os
import weakref
from fontTools.misc.arrayTools import unionRect, calcBounds
Expand All @@ -10,9 +9,6 @@
from defcon.objects.uniData import UnicodeData
from defcon.objects.color import Color

def _consume(iterator):
collections.deque(iterator, maxlen=0)


class Layer(BaseObject):

Expand Down Expand Up @@ -607,7 +603,8 @@ def save(self, glyphSet, saveAs=False, progressBar=None):
# and treat them as dirty in saveGlyph. this could be more
# efficiently handled by os.copy...
if saveAs:
_consume(self)
for glyph in self:
pass
for glyphName, glyph in sorted(self._glyphs.items()):
self.saveGlyph(glyph, glyphSet, saveAs=saveAs)
# remove deleted glyphs
Expand Down
5 changes: 3 additions & 2 deletions Lib/defcon/tools/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def postNotification(self, notification, observable, data=None):
return
if key in self._holds:
n = (notification, observableRef, data)
if not self._holds[key]["notifications"] or self._holds[key]["notifications"][-1] != n:
#if not self._holds[key]["notifications"] or self._holds[key]["notifications"][-1] != n:
if n not in self._holds[key]["notifications"]:
self._holds[key]["notifications"].append(n)
return
# posting
Expand All @@ -150,7 +151,7 @@ def postNotification(self, notification, observable, data=None):
(None, observableRef),
(None, None)
)
for key in registryPossibilities:
for key in reversed(registryPossibilities):
if key not in self._registry:
continue
for observerRef, methodName in list(self._registry[key].items()):
Expand Down

3 comments on commit a912b50

@anthrotype
Copy link
Member

@anthrotype anthrotype commented on a912b50 Feb 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@typemytype ok with the for loop, but what does the changes in Lib/defcon/tools/notifications.py have to do with it? Now it's too late to split the commits or modify the commit message as you pushed to master already.
What was the other change about?

@anthrotype
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I see you just reverted that with 86ff29a. sorry for the noise

@typemytype
Copy link
Member Author

@typemytype typemytype commented on a912b50 Feb 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other change was something I was testing out related to #102

Ive already reverted the commit, have to investigate the logic a bit further :)

Please sign in to comment.