Access current glyph collection view externally



  • Is there a way to capture the current doodleGlyphCollectionView without an observer like glyphCollectionDraw? I'd like to manipulate the glyph collection with a button somewhere. Is there something like CurrentGlyphCollectionView?

    Thanks!


  • admin

    multiple ways to access it:

    from mojo.UI import CurrentFontWindow
    
    v = CurrentFontWindow().fontOverview.getGlyphCollection()
    print(v)
    # or
    
    v = CurrentFont().document().getGlyphCollection()
    print(v)
    


  • Perfect, thanks Frederik!

    Is there an easy way to insert a button at the bottom of glyph collection? I've tried some things, but wondering if it would require a fontOverviewWillOpen or something of the like. Perhaps addSubview_()?


  • admin

    hi @ryan have a look at this example (not sure if this is what you mean)



  • Gah, of course I would completely forget that I've asked this before. Apologies for wasting time!


  • admin

    no time wasted :) I will add this example to the docs, so it’s easier to find next time. thanks!



  • Thanks!

    Last question on this now that I see the old thread—anyway to solve for Single Window Mode? Would love for the button to be just below the Font Overview, but subscribing to fontWindowWillOpen seems to anchor it to the whole window. This probably works well for the font overview in Multi-window Mode, but in SWM it's at the very bottom left. (see on top of the layout option buttons)

    009b3042-b86a-4161-86c6-3427c05b42fd-image.png

    The only observer I see firing when Font Overview is opened is glyphCollectionDraw. In my mind, even after I capture the window corresponding to the view: CurrentFontWindow().fontOverview.getGlyphCollection().getGlyphCellView()... I'd need to have an observer for when the Font Overview panel is hidden, so I could then hide the button.

    Hope this makes sense.


  • admin

    A fontOverview has a statusBar which is a vanilla group.

    But be careful: RoboFont post messages in the statusbar, like glyph selection count, ...



  • This is all exactly what I needed, thanks for your patience @frederik @gferreira



  • Just a quick piggyback (sorry), is there a way to get CurrentFontWindow().fontOverview.statusBar.show(False) to work? I would love to add that to this gist: https://gist.github.com/okay-type/e301a1da610bfdbe484787e93f52ef16 My small laptop screen thanks you in advance.



  • This does most of the job, but leaves those two bottom left buttons, which I can't track down.

    from mojo.UI import CurrentFontWindow
    
    fo = CurrentFontWindow().fontOverview
    
    # gradient layer on bottom bar and any subviews
    fo.statusBar.show(0)
    
    # line of text showing what glyphs were selected
    fo.views.selectionStatus.show(0)
    
    # glyph cell size slider
    fo.views.sizeSlider.show(0)
    
    # remove bottom bar (negative space) by changing glyph collection area to full size
    fo.getGlyphCollection().setPosSize((0,0,0,0))
    


  • It was a dig but I got it, in case anyone is following (and sorry for abusing the Robofont UI so much, Frederik):

    https://gist.github.com/okay-type/e301a1da610bfdbe484787e93f52ef16


Log in to reply