Created
January 29, 2016 16:30
-
-
Save jsbain/bbd5ef7e2e4010a631bd to your computer and use it in GitHub Desktop.
togglelinenumbers.py
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
# 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(): | |
tv.gutterView().backgroundColor=tv.backgroundColor() | |
tv.gutterWidth=20 #adjust per preference. 35 is default | |
#not sure how to force a redraw. changing frame size works | |
oldframe=tv.frame() | |
newframe=oldframe | |
newframe.size.width-=1 | |
tv.frame=newframe | |
import time | |
time.sleep(0.1) | |
tv.frame=oldframe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment