partial transcription of Robothon 2012 presentation
© Tal Leming
Robofab was built as a scripting library. It was not built to be fast, it was built to be comfortable.
# jackson # ok@yty.pe | |
import os | |
from AppKit import NSFilenamesPboardType, NSDragOperationCopy | |
from vanilla import Window, List, Button | |
class doThing(): | |
def __init__(self, path): |
# http://forum.drawbot.com/topic/148/voronoi-fun/2 | |
import random | |
import math | |
def generate_voronoi_diagram(imgx, imgy, num_cells): | |
nx = [] | |
ny = [] | |
nr = [] |
from vanilla import * | |
from AppKit import NSDragOperationCopy | |
genericListPboardType = "genericListPboardType" | |
class DragAndDropListItemsDemo: | |
weekdays = { | |
'Mon' : [], | |
'Tue' : [], |
'''draw a range of shapes along a bezier segment''' | |
# converted from: | |
# http://13thparallel.com/archive/bezier-curves/ | |
def B1(t): return t*t*t | |
def B2(t): return 3*t*t*(1-t) | |
def B3(t): return 3*t*(1-t)*(1-t) | |
def B4(t): return (1-t)*(1-t)*(1-t) |
'''find a point in a Bezier segment''' | |
# formulas converted from: | |
# http://13thparallel.com/archive/bezier-curves/ | |
# run this script in DrawBot: http://drawbot.com/ | |
def B1(t): return t*t*t | |
def B2(t): return 3*t*t*(1-t) | |
def B3(t): return 3*t*(1-t)*(1-t) |
from vanilla import HUDFloatingWindow, SquareButton, CheckBox | |
from defconAppKit.windows.baseWindow import BaseWindowController | |
from mojo import drawingTools as ctx | |
from mojo.events import addObserver, removeObserver | |
from mojo.UI import UpdateCurrentGlyphView, getDefault | |
class LockLayerWidthsDialog(BaseWindowController): | |
key = 'com.hipertipo.lockLayerWidths' | |
verbose = True |
from vanilla import Window | |
from lib.UI.stepper import Stepper, EditStepper, SliderEditStepper | |
class StepperDemo(object): | |
def __init__(self): | |
self.w = Window((300, 100), "Stepper Demo") | |
self.w.stepper = Stepper((10, 10, -10, 24), value=100) | |
self.w.open() |
import os | |
from ftplib import FTP | |
def connectToServer(url, login, password, folder, verbose=False): | |
# create FTP connection | |
ftp = FTP(url, login, password) | |
if verbose == True: | |
print "%s" % ftp.getwelcome() | |
# move to folder |
# compare glyphsets of two ufos | |
f1_path = u"/path/to/font1.ufo" | |
f2_path = u"/path/to/font2.ufo" | |
f1 = OpenFont(f1_path, showUI=False) | |
f2 = OpenFont(f2_path, showUI=False) | |
f1_glyphset = set(f1.keys()) | |
f2_glyphset = set(f2.keys()) |
partial transcription of Robothon 2012 presentation
© Tal Leming
Robofab was built as a scripting library. It was not built to be fast, it was built to be comfortable.