aboutsummaryrefslogtreecommitdiffstats
path: root/equalize_sidebearings.py
blob: 8460ad3003abea19086468c67e2a391baaf19a10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from AppKit import NSUserDefaults

from mojo.events import addObserver
from lib.doodleMenus import SpaceCenterMenuForGlyph


class CustomSpaceCenterMenuForGlyph(SpaceCenterMenuForGlyph):

    def __init__(self, glyph):
        self._glyph = glyph
        super(SpaceCenterMenuForGlyph, self).__init__()


class EqualizeSidebearings(object):
    def __init__(self):
        addObserver(self, 'center', 'spaceCenterKeyUp')

    def center(self, info):
        if info['event'].characters() == 'a':
            space_center_menu = CustomSpaceCenterMenuForGlyph(
                info['glyph'].naked())
            space_center_menu.equalSideBearings_(self)


EqualizeSidebearings()