예제 #1
0
class spaceCenterFlipButton(object):
    def __init__(self):
        addObserver(self, "spaceCenterDidOpen", "spaceCenterDidOpen")
        self.bundle = ExtensionBundle("SpaceFlip")
        self.path1 = self.bundle.resourcesPath() + '/flipButton.pdf'
        self.path2 = self.bundle.resourcesPath() + '/flipButton2.pdf'
        self.flipped = False
        
    def spaceCenterDidOpen(self, notification):
        
        s = notification["window"].window()
        s.flipButton = ImageButton((10, 10, 26, 22), imagePath=self.path1, title=None, bordered=0, callback=self.flip)
        
        preLine = s.spacingView.top.glyphLinePreInput
        line = s.spacingView.top.glyphLineInput
        for view in [preLine, line]:
            l, t, w, h = view.getPosSize()
            view.setPosSize((l+32, t, w, h))

        self.s = s
            
    def flip(self, sender=None):
        sp = CurrentSpaceCenter()
        sp.glyphLineView.contentView().setDisplayMode_("Upside Down")

        if not self.flipped:
            self.s.flipButton.setImage(imagePath=self.path2)
            self.flipped = True
        else:
            self.s.flipButton.setImage(imagePath=self.path1)
            self.flipped = False
예제 #2
0
class spaceCenterFlipButton(object):
    def __init__(self):
        addObserver(self, "spaceCenterDidOpen", "spaceCenterDidOpen")
        self.bundle = ExtensionBundle("SpaceFlip")
        self.path1 = self.bundle.resourcesPath() + '/flipButton.pdf'
        self.path2 = self.bundle.resourcesPath() + '/flipButton2.pdf'
        self.flipped = False

    def spaceCenterDidOpen(self, notification):

        s = notification["window"].window()
        s.flipButton = ImageButton((10, 10, 26, 22),
                                   imagePath=self.path1,
                                   title=None,
                                   bordered=0,
                                   callback=self.flip)

        preLine = s.spacingView.top.glyphLinePreInput
        line = s.spacingView.top.glyphLineInput
        for view in [preLine, line]:
            l, t, w, h = view.getPosSize()
            view.setPosSize((l + 32, t, w, h))

        self.s = s

    def flip(self, sender=None):
        sp = CurrentSpaceCenter()
        sp.glyphLineView.contentView().setDisplayMode_("Upside Down")

        if not self.flipped:
            self.s.flipButton.setImage(imagePath=self.path2)
            self.flipped = True
        else:
            self.s.flipButton.setImage(imagePath=self.path1)
            self.flipped = False
예제 #3
0
import AppKit
from mojo.extensions import ExtensionBundle
from mojo.events import installTool, EditingTool
from mojo.drawingTools import *
from mojo.UI import UpdateCurrentGlyphView, getDefault
import merz
from merz.tools.drawingTools import NSImageDrawingTools

#     A visualisation for RoboFont 4 XX
#     Show the ratio between the length of outgoing and incoming sections of bcps and tangents.
#     Show the angle
#     Draw in active and inactive views so we can compare different glyphs
#     [email protected]

angleRatioToolBundle = ExtensionBundle("AngleRatioTool")
toolbarIconPath = os.path.join(angleRatioToolBundle.resourcesPath(), "icon.pdf")
toolbarIcon = AppKit.NSImage.alloc().initWithContentsOfFile_(toolbarIconPath)





def dotSymbolFactory(
        size,
        color,
        strokeColor,
        strokeWidth=0,
        ):
    # create a image draw bot 
    bot = NSImageDrawingTools((size, size))