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 exportPreferences | |
import os.path | |
homeDir = os.path.expanduser("~") | |
exportPreferences("%s/Library/Mobile Documents/com~apple~CloudDocs/Preferences/Robofont/settings" %homeDir) |
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
Show hidden characters
{ | |
"cmd": ["robofont", "-p", "$file"], | |
"file_regex": "^[ ]File \"(...?)\", line ([0-9]*)", | |
"selector": "source.python", | |
} |
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, removeObserver | |
from vanilla import Window | |
class RoboFontDefconExample(): | |
def __init__(self): | |
self.w = Window((300, 120), "Debuggin window") | |
self.fonts = {} | |
for f in AllFonts(): | |
self._addFont(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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Sublime Text 3 Pipenv virtualenv helper. | |
1. Automatically find and set Pipenv virtualenv for each opened Python file. | |
- It uses `pipenv --venv` command to find the virtualenv. | |
- It will add a 'virtualenv' setting, which is the full path to the virtualenv, |
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 AppKit | |
from vanilla import * | |
myHotKeys = {'⌘s', '⇧⌘s', '⌘q', '⇧⌘q'} | |
MODIFIER_INT_TO_STR = { | |
1048840: '⌘', | |
262401: '⌃', | |
524576: '⌥', | |
131330: '⇧', |
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 ctypes | |
import ctypes.util | |
import objc | |
import CoreFoundation | |
""" | |
Find currently availabe keyboard layout input sources in Mac OSX using pyobjc. Based on: | |
https://gist.github.com/tiann/f85e89bef4b6e9b83f2a | |
""" |
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
""" | |
You can use this to get the window name if it has become the key window in | |
RoboFont. But the same data model can be used to create notifications inside | |
objc apps. | |
""" | |
from objc import python_method | |
import AppKit | |
from vanilla import FloatingWindow | |
from lib.tools.debugTools import ClassNameIncrementer |
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 time | |
def timeit(method): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = method(*args, **kw) | |
te = time.time() | |
if 'log_time' in kw: | |
name = kw.get('log_name', method.__name__.upper()) | |
kw['log_time'][name] = int((te - ts) * 1000) | |
else: |
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
""" | |
RoboFont Script | |
- Type: UI/start up | |
- Purpose: Runs on RF start up and adds a function to mojo.UI module: | |
CurrentSelection() which returns the selected RGlyph object(s) | |
based on what window is active. | |
- Specifications: | |
- Find which window is active using mojo.UI.CurrentWindow then return the Glyph(s) | |
- Publish Date: 20 April 2020 | |
- Author: Bahman Eslami |
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 fontParts.fontshell.font import RFont | |
from fontTools.pens.cocoaPen import CocoaPen | |
f = RFont("expand-stroke.ufo") # a ufo with one line path for a glyph (no closed contours) | |
canvasSize = 800 | |
numFrames = 200 | |
def getGlyphPath(glyph): | |
pen = CocoaPen(glyph.font) |
OlderNewer