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
from AppKit import NSPoint | |
from mojo.events import MeasurementTool | |
measurement = MeasurementTool.measurementClass() | |
measurement.startPoint = NSPoint(100, 100) | |
measurement.endPoint = NSPoint(200, 200) | |
g = CurrentGlyph() | |
g.naked().measurements.append(measurement) | |
g.update() |
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
from vanilla import * | |
import vanilla | |
from vanilla.vanillaBase import VanillaError | |
class ScrollView(vanilla.ScrollView): | |
def __init__(self, posSize, nsView, hasHorizontalScroller=True, hasVerticalScroller=True, | |
autohidesScrollers=False, backgroundColor=None, clipView=None, | |
drawsBackground=True): |
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
from AppKit import * | |
icon = NSApp().applicationIconImage() | |
w, h = icon.size() | |
new = NSImage.alloc().initWithSize_((w, h)) | |
imageRect = NSMakeRect(0, 0, w, h) | |
new.lockFocus() |
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
f = CurrentFont() | |
print f |
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
from lib.settings import defaultFontInfoAttributes | |
defaultFontInfoAttributes["descender"] = -200 | |
defaultFontInfoAttributes["ascender"] = 800 |
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
import os | |
from fontTools.ttLib import TTFont | |
from mojo.events import addObserver | |
from ufo2fdk.fontInfoData import getAttrWithFallback | |
from ufo2fdk.outlineOTF import _roundInt | |
class FixBinaryOutput(object): | |
def __init__(self): |
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
Variable([ | |
dict(name="myVariable", ui="Slider", | |
args=dict( # add some vanilla Slider specific attributes | |
value=10, | |
minValue=0, | |
maxValue=100, | |
tickMarkCount=11, | |
stopOnTickMarks=True)), | |
], globals()) |
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
# DrawBot example | |
import urllib2 | |
import json | |
searchTerm = 'DrawBot app is AWESOME' | |
## get data from google | |
fetcher = urllib2.build_opener() | |
startIndex = "0" |
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
from mojo.UI import OpenGlyphWindow | |
from mojo.events import addObserver | |
class BaseGlyphJumper(object): | |
def __init__(self): | |
# add observer on key down | |
addObserver(self, "keyDown", "keyDown") | |
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
from mojo.events import addObserver | |
from AppKit import NSSound, NSURL | |
path = u"http://soundbible.com/grab.php?id=1995&type=mp3" | |
url = NSURL.URLWithString_(path) | |
sound = NSSound.alloc().initWithContentsOfURL_byReference_(url, False) | |
class SomeMotivation(object): | |