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
| import weakref | |
| class ImplementationError(Exception): | |
| pass | |
| def _implementation_get(cls): | |
| def wrapped(superObject): | |
| attr = "__implementationObject_%s" % cls.owner |
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
| import Quartz | |
| import AppKit | |
| from mojo.UI import CurrentSpaceCenterWindow | |
| # a path where to save the screenshot | |
| path = u"~/Documents/test.png" | |
| # get the space center window | |
| sp = CurrentSpaceCenterWindow() |
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
| amount = 10 | |
| s = 20 | |
| dotInset = 4 | |
| im = ImageObject() | |
| path = BezierPath() | |
| path.moveTo((0, 0)) | |
| path.lineTo((0, s)) | |
| path.lineTo((s, s)) |
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
| class Implementation(object): | |
| def __init__(self, tag): | |
| self._tag = tag | |
| self._instance = None | |
| def __getattr__(self, attr): | |
| attr = "_%s_%s" % (self._tag, attr) | |
| return getattr(self._instance, attr) | |
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
| class Implementation(object): | |
| """ | |
| Implementation object collection all methods for a given implementation | |
| """ | |
| def __init__(self): | |
| self.funcMap = {} | |
| self._currentInstance = None |
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
| # custom directives | |
| from docutils import nodes | |
| from docutils.statemachine import ViewList | |
| from sphinx import addnodes | |
| from sphinx.util import rst | |
| from docutils.parsers.rst import directives | |
| from sphinx.ext.autosummary import Autosummary, import_by_name, get_import_prefixes_from_env, autosummary_table |
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
| class MetaMock(type): | |
| def __getattr__(self, name): | |
| return self | |
| class Mock(object): | |
| __metaclass__ = MetaMock |
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
| import LaunchServices | |
| import AppKit | |
| fileExtension = "thisShouldBeACoolFile" # file extension | |
| UTI = LaunchServices.UTTypeCreatePreferredIdentifierForTag(LaunchServices.kUTTagClassFilenameExtension, fileExtension, None) | |
| r = LaunchServices.LSSetDefaultRoleHandlerForContentType(UTI, LaunchServices.kLSRolesAll, AppKit.NSBundle.mainBundle().bundleIdentifier()) | |
| if r != 0: | |
| print "oeps" |
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
| from ufoLib.pointPen import AbstractPointPen | |
| from defcon.pens.transformPointPen import TransformPointPen | |
| from defcon.objects.component import _defaultTransformation | |
| class DecomposePointPen(object): | |
| def __init__(self, glyphSet, outPointPen): | |
| self._glyphSet = glyphSet | |
| self._outPointPen = outPointPen |
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
| from fontTools.afmLib import AFM | |
| from ufo2fdk.fontInfoData import getFontBounds | |
| from ufo2fdk.fontInfoData import getAttrWithFallback | |
| from robofab.interface.all.dialogs import PutFile | |
| def buildFlatKerningWithGroupsAndKerning(groups, kerning): | |
| flat = {} | |
| keys = sorted(kerning.keys()) |