Skip to content

Instantly share code, notes, and snippets.

View commandPalette.py
from AppKit import NSApp
from vanilla import FloatingWindow, EditText, List, Button
from lib.tools.shortCutTools import getShortCuts
from lib.UI.fileBrowser import shortKeyToString
class CommandPalette:
def __init__(self):
shortcuts = getShortCuts()
@gferreira
gferreira / InterpolationPreviewSpaceCenter.py
Last active Apr 5, 2020
Preview interpolation result in the Space Center using representations.
View InterpolationPreviewSpaceCenter.py
'''
just a proof of concept, name of the second master is hard-coded at the bottom
'''
from vanilla import FloatingWindow, CheckBox, Slider
from defconAppKit.windows.baseWindow import BaseWindowController
from mojo.events import addObserver, removeObserver
from mojo.UI import CurrentSpaceCenter
import mojo.drawingTools as ctx
@gferreira
gferreira / svg-test.html
Last active Feb 3, 2020
SVG + HTML + CSS + JS example
View svg-test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SVG test</title>
<style>
@keyframes colorChange { from { background-color: yellow; } to { background-color: red; } }
svg { animation: colorChange 3s infinite alternate; }
#circle { fill: grey; } /* cursor: move; */
View auto-set-start-points-terminal.py
import os, operator
from fontParts.world import OpenFont
def autoStartPoints(glyph):
if not glyph.bounds:
return
for contour in glyph:
points = [(pt.x, pt.y, pt) for pt in contour.points if pt.type != 'offcurve']
sortedPoints = sorted(points, key=operator.itemgetter(1, 0))
firstPoint = sortedPoints[0][2]
@gferreira
gferreira / vanilla-move-layers-test.py
Last active Oct 1, 2019
Q: can vanilla windows talk to each other? A: yes they can!
View vanilla-move-layers-test.py
from AppKit import NSApp
from vanilla import *
class LayersWindow(object):
def __init__(self):
self.w = FloatingWindow((123, 200), title='layers')
self.w.layers = List((10, 10, -10, -10), ['foreground', 'background', 'sketches'])
self.w.bind("close", self.closeCallback)
self.w.vanillaWrapper = self
View roboDocsExtensionStream.json
{
"lastUpdate": "2019-09-20 20:56",
"extensions": [
{
"extensionName": "Add Overlap",
"repository": "https://github.com/roboDocs/AddOverlap",
"extensionPath": "AddOverlap.roboFontExt",
"description": "Creates an overlap for the selected points.",
"developer": "Alexandre Saumier Demers",
"developerURL": "http://asaumierdemers.com",
@gferreira
gferreira / bulk-list.py
Last active Aug 6, 2019 — forked from okay-type/bulk-list.py
dropfile-ui
View bulk-list.py
# jackson # ok@yty.pe
import os
from AppKit import NSFilenamesPboardType, NSDragOperationCopy
from vanilla import Window, List, Button
class doThing():
def __init__(self, path):
@gferreira
gferreira / voronoi-drawbot-example.py
Created Jun 20, 2019
Create a Voronoi diagram as a raster image in Python. Converted from PIL to DrawBot.
View voronoi-drawbot-example.py
# http://forum.drawbot.com/topic/148/voronoi-fun/2
import random
import math
def generate_voronoi_diagram(imgx, imgy, num_cells):
nx = []
ny = []
nr = []
View vanillaDragAndDropListItems.py
from vanilla import *
from AppKit import NSDragOperationCopy
genericListPboardType = "genericListPboardType"
class DragAndDropListItemsDemo:
weekdays = {
'Mon' : [],
'Tue' : [],
View animate-varfont-characters.py
'''animate individual characters in a variable font'''
fontName = 'Skia'
txt = 'variablefonts'
# steps between min/max range
steps = 12
# variable font range
variations = listFontVariations(fontName)