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 | |
| ''' | |
| Manipulate action (wrench) menu | |
| example: | |
| add_action('/stash/launch_stash.py','monitor') | |
| save_defaults() # so it is stored for next launch | |
| ''' | |
| from objc_util import * |
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 | |
| from objc_util import * | |
| import canvas | |
| import os | |
| def save_canvas_to_png(filename): | |
| rootVC = UIApplication.sharedApplication().keyWindow().rootViewController() | |
| image=rootVC.accessoryViewController().consoleViewController().canvasImageView().image() | |
| if image: | |
| data=ObjCInstance(c.UIImagePNGRepresentation(image)) | |
| data.writeToFile_atomically_(os.path.abspath(filename),True) |
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 | |
| #. objc from http://www.thinkandbuild.it/interactive-notifications-with-notification-actions/ | |
| from objc_util import * | |
| UIUserNotificationSetting=ObjCClass('UIUserNotificationSettings') | |
| #UIUserNotificationType=ObjCClass('UIUserNotificationType') | |
| UIMutableUserNotificationCategory=ObjCClass('UIMutableUserNotificationCategory') | |
| UIMutableUserNotificationAction=ObjCClass('UIMutableUserNotificationAction') | |
| UIUserNotificationSettings=ObjCClass('UIUserNotificationSettings') | |
| UILocalNotification=ObjCClass('UILocalNotification') |
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 | |
| #. objc from http://www.thinkandbuild.it/interactive-notifications-with-notification-actions/ | |
| from objc_util import * | |
| UIUserNotificationSetting = ObjCClass('UIUserNotificationSettings') | |
| UIMutableUserNotificationCategory = ObjCClass('UIMutableUserNotificationCategory') | |
| UIMutableUserNotificationAction = ObjCClass('UIMutableUserNotificationAction') | |
| UIUserNotificationSettings = ObjCClass('UIUserNotificationSettings') | |
| UILocalNotification = ObjCClass('UILocalNotification') |
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 | |
| from objc_util import * | |
| app=UIApplication.sharedApplication() | |
| rootVC = app.keyWindow().rootViewController() | |
| tabVC = rootVC.detailViewController() | |
| tvc=tabVC.selectedTabViewController() | |
| ed=tvc.editorView() | |
| tv=ed.textView() | |
| tv.showLineNumbers=not tv.showLineNumbers() | |
| if tv.gutterView(): |
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
| #!python2 | |
| import editor, ui | |
| import _editor_pythonista | |
| from objc_util import * | |
| @on_main_thread | |
| def create_vertical_line(num_cols=80): | |
| ''' create vertical line at column index specified. | |
| TODO: register for file change notifications, add to all tabs, etc. add ability to remove. | |
| ''' |
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
| #!python2 | |
| import editor, ui | |
| import _editor_pythonista | |
| from objc_util import * | |
| @on_main_thread | |
| def create_column_guide(num_cols=80): | |
| ''' create vertical line at column index specified. | |
| TODO: register for file change notifications, add to all tabs, etc. add ability to remove. | |
| ''' |
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
| from objc_util import * | |
| import ui | |
| def save_text(tv,filename): | |
| '''save the attributed text from tv to an rtf file (provide full path)''' | |
| attribtxt=ObjCInstance(tv).attributedText() | |
| data=attribtxt.RTFFromRange_documentAttributes_(NSRange(0,attribtxt.length()), None) |
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
| #!python2 | |
| # coding: utf-8 | |
| import ui,requests, json, time, console, urllib | |
| # create debuggin delegate code. not necessary, but helpful for debugging | |
| debugjs=''' | |
| // debug_utils.js | |
| // 1) custom console object | |
| console = new Object(); | |
| console.log = function(log) { |
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 ui,time | |
| import bz2 | |
| from base64 import b64decode | |
| import threading | |
| import math | |
| from objc_util import on_main_thread | |
| #https://gist.github.com/b8e6f213d19e9d4668a7f28bbd1efe9f |