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 * | |
class SheetDemo(object): | |
def __init__(self, parentWindow): | |
self.w = Sheet((200, 100), parentWindow) | |
self.w.myButton = Button((10, 10, -10, 20), "My Button") | |
self.w.myTextBox = TextBox((10, 40, -10, 17), "My Text Box") | |
self.w.closeButton = Button((10, -30, 80, 22), "Close", self.closeCallback) | |
self.w.open() |
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 * | |
from vanilla.vanillaBase import _setAttr, _delAttr, VanillaBaseObject | |
_edgeMap = { | |
"left" : NSMinXEdge, | |
"right" : NSMaxXEdge, | |
"top" : NSMinYEdge, | |
"bottom" : NSMaxYEdge | |
} |
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
g = CurrentGlyph() | |
f = CurrentFont() | |
for g in f: | |
box = g.box | |
if box is None: |
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 fontTools.pens.basePen import BasePen | |
class MyPen(BasePen): | |
def _moveTo(self, pt): | |
print "move to", pt | |
def _lineTo(self, pt): | |
print "line to", pt |
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 robofab.pens.pointPen import AbstractPointPen, PrintingPointPen | |
from robofab.pens.adapterPens import SegmentToPointPen | |
from lib.tools.bezierTools import intersectRayRay | |
class ReconvertSplinePointPen(AbstractPointPen): | |
def __init__(self, outPointPen): | |
self.outPointPen = outPointPen | |
def beginPath(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
path = u"path/to/file" | |
from AppKit import * | |
fm = NSFileManager.defaultManager() | |
attr, error = fm.attributesOfItemAtPath_error_(path, None) | |
print attr[NSFileCreationDate] | |
print attr[NSFileModificationDate] |
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 fontTools.pens.basePen import BasePen | |
def pointOnCurve(p1, c1, c2, p2, value): | |
dx = p1[0] | |
cx = (c1[0] - dx) * 3.0 | |
bx = (c2[0] - c1[0]) * 3.0 - cx | |
ax = p2[0] - dx - cx - bx | |
dy = p1[1] | |
cy = (c1[1] - dy) * 3.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
import vanilla | |
from AppKit import * | |
""" | |
for the demo some vanilla objects are subclassed | |
- the main change would be in the VanillaBaseObject | |
- a window, sheet, group, popover (all elements that can set vanillaObjects) could have a addConstraints attribute | |
- map the attribute name and the view automatically whenever the posSize is "auto" | |
- the constraint cannot be a replacement of the posSize cause it the constraint Visual Format Language is a discription of a complete UI. |
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 drawBot import * | |
from drawBot.ui.drawView import DrawView | |
from vanilla import * | |
class Previewer(object): | |
def __init__(self): | |
# setup the window | |
self.w = Window((400, 400), "Previewer", minSize=(200, 200)) |
OlderNewer