I have this... But it is buggy. See if you scroll. If you change a glyph the factory doest work, only after scrolling/clicking on the overview.. Here I need a bit help :)
from vanilla import *
from defconAppKit.controls.glyphCollectionView import *
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.UI import SetCurrentGlyphByName
class MyFont(BaseWindowController):
def __init__(self, glyphs):
self.w = Window((900,600), '')
self.w.collectionView = GlyphCollectionView((15, 15, -15, -65), doubleClickCallback=self.double, cellRepresentationName='doodle.GlyphCell')
self.w.collectionView.setCellSize((100, 100))
self.setUpBaseWindowBehavior()
self.w.collectionView.preloadGlyphCellImages()
self.w.collectionView.set(glyphs)
self.updateTitle()
self.w.open()
def updateTitle(self):
title = f.info.familyName +' - '+ f.info.styleName+', '+ str(CurrentGlyph())
self.w.setTitle(title)
def double(self, sender):
order = f.lib.get('public.glyphOrder')
SetCurrentGlyphByName(order[self.w.collectionView.getSelection()[0]])
self.updateTitle()
f = CurrentFont()
g = CurrentGlyph()
glyphs = []
for g in f.lib.get('public.glyphOrder'):
glyphs.append(f[g])
MyFont(glyphs)