def restoreGlyphViewItems(self): pref_as_is = getDefault('glyphZoomViewShowItems') pref_new = dict() for i in pref_as_is: if i in turnOffItems: # global gridWasOn # gridWasOn = pref_as_is[i] pref_new[i] = 1 else: pref_new[i] = pref_as_is[i] setDefault('glyphZoomViewShowItems', pref_new) PostNotification("doodle.preferencesChanged")
def calculateBoundingBox(self, sender=None): xmin = [9999, ""] ymin = [9999, ""] xmax = [-9999, ""] ymax = [-9999, ""] for g in CurrentFont(): if g.bounds: if xmin[0] > g.bounds[0]: xmin[0] = g.bounds[0] xmin[1] = g.name if ymin[0] > g.bounds[1]: ymin[0] = g.bounds[1] ymin[1] = g.name if xmax[0] < g.bounds[2]: xmax[0] = g.bounds[2] xmax[1] = g.name if ymax[0] < g.bounds[3]: ymax[0] = g.bounds[3] ymax[1] = g.name self.xmin = xmin self.ymin = ymin self.xmax = xmax self.ymax = ymax PostNotification('doodle.updateGlyphView') if hasattr(self, 'w'): l = [] # if hasattr(self, 'w'): l.append(dict(B='←', glyphname=xmin[1], value=xmin[0])) l.append(dict(B='↓', glyphname=ymin[1], value=ymin[0])) l.append(dict(B='→', glyphname=xmax[1], value=xmax[0])) l.append(dict(B='↑', glyphname=ymax[1], value=ymax[0])) l.append( dict(B='↔︎', glyphname="full width", value=self.xmax[0] - self.xmin[0])) l.append( dict(B='↕︎', glyphname="full height", value=self.ymax[0] - self.ymin[0])) # {"B": 'a', "glyphname": self.xmin[1], "value": str( # self.xmin[0])} self.w.results.set(l)
def updateView(self, sender): PostNotification('doodle.updateGlyphView')
def _close(self, sender): self.w.hide() removeObserver(self, event) removeObserver(self, "currentGlyphChanged") PostNotification('doodle.updateGlyphView')
def changes(self, sender): PostNotification('doodle.updateGlyphView')
def getUfo(self, sinder): ufoPath = getFile()[0] self.ufo = OpenFont(ufoPath, showUI=False) PostNotification('doodle.updateGlyphView')
def _applyTheme(self, theme): # Do the actual applying of the theme for key, val in theme.items(): setDefault(key, val) PostNotification("doodle.preferencesChanged")
def _set_size(self, value): self._size = value setDefault("glyphViewGridx", value) setDefault("glyphViewGridy", value) PostNotification("doodle.preferencesChanged")