Created
November 12, 2024 00:44
-
-
Save okay-type/8b744c595fdf501f094cad9b287b9001 to your computer and use it in GitHub Desktop.
easily switch between the current glyph edit window and the current font overview window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# menuTitle : Current UFO to Front | |
# shortCut : command+control+] | |
from AppKit import * | |
from mojo.UI import CurrentWindow, CurrentGlyphWindow, AllFontWindows, AllGlyphWindows | |
def current_to_front(): | |
current_window = CurrentWindow() | |
if current_window.doodleWindowName == 'SpaceCenter': | |
sc = current_window.getSpaceCenter() | |
d_font = sc.font | |
# could pull glyph windows to the front also/instead... | |
all_font_windows = AllFontWindows() | |
for window in all_font_windows: | |
if window.document.font == d_font: | |
window.w.show() | |
elif current_window.doodleWindowName == 'FontWindow': | |
d_font = current_window.document.font | |
all_glyph_windows = AllGlyphWindows(currentFontOnly=False) | |
for window in all_glyph_windows: | |
if window.getGlyph().font == d_font: | |
window.w.show() | |
elif current_window.doodleWindowName in ['GlyphWindow']: | |
d_glyph = current_window.getGlyph() | |
d_font = d_glyph.getParent() | |
g_window = CurrentGlyphWindow() | |
all_font_windows = AllFontWindows() | |
for window in all_font_windows: | |
if window.document.font == d_font: | |
window.w.show() | |
current_to_front() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment