Last active
August 29, 2015 14:00
-
-
Save mekkablue/11042782 to your computer and use it in GitHub Desktop.
Grid Switcher for Glyphs.app
This file contains 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: Grid Switcher | |
# -*- coding: utf-8 -*- | |
"""Turns Grid on and off.""" | |
import vanilla | |
import GlyphsApp | |
class GridOnOff( object ): | |
def __init__( self ): | |
currentGridStep = Glyphs.font.gridMain() | |
self.w = vanilla.FloatingWindow( (170, 80), "Grid Switcher", autosaveName="com.mekkablue.GridOnOff.mainwindow" ) | |
self.w.currentGridStep = vanilla.TextBox( (15, 12+2, -15, 22), "Current Grid Step: %i" % currentGridStep, sizeStyle='regular' ) | |
self.w.switchButton = vanilla.Button((15, -22-15, -15, -15), "Switch Grid", sizeStyle='regular', callback=self.GridOnOffMain ) | |
self.w.setDefaultButton( self.w.switchButton ) | |
self.w.center() | |
self.w.open() | |
def GridOnOffMain( self, sender ): | |
try: | |
gridStep = Glyphs.font.gridMain() | |
if gridStep != 0: | |
newGridStep = 0 | |
else: | |
newGridStep = 1 | |
Glyphs.font.setGridMain_( newGridStep ) | |
self.w.currentGridStep.set( "Current Grid Step: %i" % newGridStep ) | |
except Exception, e: | |
raise e | |
GridOnOff() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment