This file contains hidden or 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
# The GPS issue was fixed quite elegantly with the location module | |
# added in Pythonista v1.4. The code below is not longer required. | |
# gpsForPythonista using BaseHTTPServer and XMLHttpRequest | |
# Source at https://gist.github.com/cclauss/6578926 | |
# Thanks to 'Hvmhvm' of Pythonisa fourm for working code | |
# Thanks to 'Anton2' of Pythonisa fourm for XMLHttpRequest | |
# http://omz-software.com/pythonista/forums/discussion/92/gps-access-solved | |
# usage: from gpsForPythonista import getGPS; print(getGPS()) |
This file contains hidden or 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 scene, os | |
colorLightBlue = scene.Color(.3, .3, 1) | |
colorWhite = scene.Color( 1, 1, 1) | |
fontBlackList = ('AcademyEngraved', 'AppleColorEmoji@2x', | |
'ArialHB', 'Bodoni72', 'ChalkboardSE', | |
'CourierNew', 'DB_LCD_Temp-Black', | |
'EuphemiaCAS', 'Fallback', 'HoeflerText', | |
'LastResort', 'KGPW3UI', 'LockClock', |
This file contains hidden or 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
# sounder.py | |
# play each of the .caf sounds inside the Pythonista.app | |
import os, os.path, scene, sound | |
framesPerSound = 60 | |
pythonistaDir = os.path.expanduser('~/Pythonista.app') | |
#print(os.listdir(pythonistaDir)) | |
soundFileExtention = '.caf' | |
wallpaperAppIcon = ('/AppIcon76x76@2x~ipad.png', '/[email protected]') |
This file contains hidden or 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
# imageCongaLine.py | |
# A Conga line formed out of .png images inside Pythonista.app | |
import os, scene | |
imageWidth = 32 | |
#print(os.getcwd()) | |
os.chdir('../Pythonista.app') # Look at files inside the app | |
#print(os.listdir('.')) |
This file contains hidden or 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 scene, threading, time | |
colorRed = scene.Color(1, 0, 0) | |
colorGreen = scene.Color(0, 1, 0) | |
colorBlue = scene.Color(0, 0, 1) | |
theColors = (colorRed, colorGreen, colorBlue) | |
greyLight = scene.Color(.7, .7, .7) | |
greyMedium = scene.Color(.5, .5, .5) | |
greyDark = scene.Color(.3, .3, .3) |
This file contains hidden or 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
# Update: This looks like a far better solution... | |
# `console.set_idle_timer_disabled(flag)` | |
# Disable or enable the idle timer (which puts the device to sleep after a certain period of inactivity). | |
# noDoze.py -- keep relaunching yourself to prevent | |
# your iOS device from falling asleep. | |
import notification, time, urllib | |
def argsString(argv): |
This file contains hidden or 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
Moved to: https://github.com/cclauss/Pythonista_scene |
This file contains hidden or 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 canvas, scene | |
from contextlib import contextmanager | |
@contextmanager | |
def privateGstate(): | |
"""Save the canvas.gstate and then restore it when leaving the 'with' clause.""" | |
canvas.save_gstate() | |
try: yield None | |
finally: canvas.restore_gstate() |
This file contains hidden or 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 | |
# For details, in Mac OS X Terminal type: man pbcopy | |
import subprocess, sys | |
def getClipboardData(): # Only works for data types: {txt | rtf | ps} | |
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
retcode = p.wait() | |
data = p.stdout.read() |
This file contains hidden or 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
# replace ALL tab characters with four spaces | |
import editor, sys | |
theText = editor.get_text() | |
theCount = theText.count('\t') | |
if not theText.count('\t'): | |
print('no tabs found.') | |
sys.exit() | |
theLength = len(theText) |