Skip to content

Commit 57790c2

Browse files
committed
wc sync ...
2 parents d1f6ca1 + f4db915 commit 57790c2

27 files changed

+36733
-0
lines changed

editor/custom_editor_font.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# https://gist.github.com/lukaskollmer/0c01b7a27e512db480847fac2cc54103
2+
3+
# in association with script custom-editor-font
4+
5+
# https://forum.omz-software.com/topic/3419/share-code-custom-editor-font
6+
7+
"""
8+
Use custom fonts in the editor
9+
10+
Usage: https://forum.omz-software.com/topic/3419/share-code-custom-editor-font
11+
"""
12+
13+
__author__ = "Lukas Kollmer<[email protected]>"
14+
__copyright__ = "Copyright (c) 2016 Lukas Kollmer<[email protected]>"
15+
16+
from objc_util import *
17+
from ctypes import *
18+
19+
20+
CTFontManagerRegisterFontsForURL = c.CTFontManagerRegisterFontsForURL
21+
CTFontManagerRegisterFontsForURL.argtypes = [c_void_p, c_int, c_void_p]
22+
CTFontManagerRegisterFontsForURL.restype = c_bool
23+
24+
CFURLCreateWithString = c.CFURLCreateWithString
25+
CFURLCreateWithString.argtypes = [c_void_p, c_void_p, c_void_p]
26+
CFURLCreateWithString.restype = c_void_p
27+
28+
29+
30+
def load_custom_font(file):
31+
#https://marco.org/2012/12/21/ios-dynamic-font-loading
32+
font_url = CFURLCreateWithString(None, ns(file), None)
33+
34+
error = c_void_p(None)
35+
# This returns false, but still succeds
36+
CTFontManagerRegisterFontsForURL(ObjCInstance(font_url), 0, byref(error))
37+
38+
def set_editor_font(name, size=15):
39+
"""
40+
NOTE: This still requires a restart
41+
"""
42+
defaults = ObjCClass("NSUserDefaults").standardUserDefaults()
43+
defaults.setObject_forKey_(name, "EditorFontName")
44+
defaults.setObject_forKey_(size, "EditorFontSize")
45+
46+
defaults.synchronize()
47+
48+
def reset_custom_font():
49+
defaults = ObjCClass("NSUserDefaults").standardUserDefaults()
50+
defaults.setObject_forKey_("Menlo-Regular", "EditorFontName")
51+
defaults.setObject_forKey_(15, "EditorFontSize")
52+
53+
54+
if __name__ == "__main__":
55+
import os
56+
font_path = "file://" + os.path.expanduser("~/Documents/Fonts/SFMono/SFMono-Regular.otf")
57+
58+
load_custom_font(font_path)
59+
60+
font_name = "Menlo-Regular"
61+
set_editor_font(font_name, 15)
62+

finder/copy-file-copied.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# coding: utf-8
2+
3+
# https://forum.omz-software.com/topic/2973/file-manager-rename-and-copy-functions/2
4+
5+
import console
6+
import editor
7+
import os
8+
import shutil
9+
10+
DOCUMENTS = os.path.expanduser("~/Documents")
11+
12+
old_name = editor.get_path()
13+
new_name = os.path.join(DOCUMENTS, console.input_alert("Duplicate File", "Enter new name", os.path.relpath(old_name, DOCUMENTS)))
14+
15+
if os.path.exists(new_name):
16+
console.hud_alert("Destination already exists", "error")
17+
else:
18+
shutil.copy(old_name, new_name)
19+
20+
##editor.open_file(os.path.relpath(new_name, DOCUMENTS)) # For old Pythonistas
21+
editor.open_file(new_name)
22+

omz/Platformer Game/.Highscore.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
850

0 commit comments

Comments
 (0)