Skip to content

Instantly share code, notes, and snippets.

Last active May 4, 2020 18:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
toggle font window toolbar in robofont
# menuTitle : Toggle Font Toolbar
# shortCut : command+alt+`
from mojo.UI import AllFontWindows
toggle the visibility of the toolbar and the status bar in robofont's font overview window
sorry, i haven't tested this in single window mode or anything
def toggleFontWindowToolbar():
# get first window state and use that for the other windows so they all stay in sync
w1 = AllFontWindows()[0].window().getNSWindow()
w1state = w1._toolbarIsShown()
for window in AllFontWindows():
if window is None:
w = window.window().getNSWindow()
(wX, wY), (wW, wH) = w.frame()
if w1state == 1:
show = False
show = True
w.setFrame_display_animate_(((wX, wY), (wW, wH)), True, False)
fo = window.fontOverview
fo.getGlyphCollection().setPosSize((0, 0, 0, -20))
if show is False:
fo.getGlyphCollection().setPosSize((0, 0, 0, 0))
# the view mode buttons, there has to be a better way
vmb = fo.views.collectionSplitView.getSplitView().subviews()[1]
Copy link

quick fix to make sure all windows have the same toolbar state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment