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
| # coding: utf-8 | |
| ''' | |
| This is a little helper script to make it easier | |
| to create single-file scripts with Pythonista, while | |
| still taking advantage of the UI editor. | |
| It'll essentially convert the .pyui file to a compact | |
| string representation that you can embed directly | |
| in your script. The code to unpack and load the UI | |
| is also auto-generated for convenience. |
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
| # This script adds a "Webclip" shortcut to your homescreen. | |
| # The shortcut can be used to open a web page in full-screen mode, | |
| # or to launch a custom URL (e.g. a third-party app). | |
| # You'll be asked for a title, a URL, and an icon (from your camera roll) | |
| import plistlib | |
| import BaseHTTPServer | |
| import webbrowser | |
| import uuid | |
| from io import BytesIO |
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
| # File Transfer for Pythonista | |
| # ============================ | |
| # This script allows you to transfer Python files from | |
| # and to Pythonista via local Wifi. | |
| # It starts a basic HTTP server that you can access | |
| # as a web page from your browser. | |
| # When you upload a file that already exists, it is | |
| # renamed automatically. | |
| # From Pythonista's settings, you can add this script | |
| # to the actions menu of the editor for quick access. |
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
| # IMPORTANT SETUP INSTRUCTIONS: | |
| # | |
| # 1. Go to http://www.dropbox.com/developers/apps (log in if necessary) | |
| # 2. Select "Create App" | |
| # 3. Select the following settings: | |
| # * "Dropbox API app" | |
| # * "Files and datastores" | |
| # * "(No) My app needs access to files already on Dropbox" | |
| # * "All file types" | |
| # * (Choose any app name) |
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
| /* | |
| Batch-Rename Layers -- plugin for Sketch 2 (http://www.bohemiancoding.com/sketch/) | |
| INSTALLATION | |
| ------------ | |
| Select "Reveal Plugins Folder..." in the "Plugins" menu, | |
| then put this file in the folder that shows up in the Finder. |
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
| #!python3 | |
| ''' | |
| This is a demo of how you can use the CoreML framework (via objc_util) to classify images in Pythonista. It downloads the trained 'MobileNet' CoreML model from the Internet, and uses it to classify images that are either taken with the camera, or picked from the photo library. | |
| ''' | |
| import requests | |
| import os | |
| import io | |
| import photos | |
| import dialogs |
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
| # Quick workaround for photos module (Pythonista) not downloading photos from iCloud | |
| import photos | |
| from objc_util import ObjCClass, ObjCInstance, ObjCBlock | |
| def download_cloud_asset(asset): | |
| PHImageManager = ObjCClass('PHImageManager') | |
| PHImageRequestOptions = ObjCClass('PHImageRequestOptions') | |
| ph_asset = ObjCInstance(asset) | |
| ph_image_mgr = PHImageManager.defaultManager() |
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
| ''' | |
| This module provides a Python wrapper around CIImage and CIFilter for using CoreImage filters from Pythonista more easily. | |
| How to use: | |
| 1) Create a CImage object. The constructor accepts either a file path, a ui.Image, PIL.Image.Image, or photos.Asset object. Example: | |
| >>> # From a photo: | |
| >>> img = CImage(photos.pick_asset()) | |
| >>> # From a ui.Image: |
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
| # Pythonista script to show the UI Debugging overlay (private API) described in this blog post: | |
| # http://ryanipete.com/blog/ios/swift/objective-c/uidebugginginformationoverlay/ | |
| from objc_util import ObjCClass, on_main_thread | |
| UIDebuggingInformationOverlay = ObjCClass('UIDebuggingInformationOverlay') | |
| @on_main_thread | |
| def toggle_overlay(): | |
| UIDebuggingInformationOverlay.prepareDebuggingOverlay() | |
| UIDebuggingInformationOverlay.overlay().toggleVisibility() |
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
| # `motion` module from Pythonista | |
| # This is missing in the current App Store versions (in Pythonista 3.x, it's only missing in Python 2 mode). | |
| # As a temporary workaround, you can put this file in the "site-packages" folder (under "Modules" or "Modules & Templates"). | |
| import _motion | |
| shared_manager = _motion.MotionManager() | |
| def start_updates(): | |
| shared_manager.start() |
NewerOlder