@huub Quick and dirty as usual, but seems to work. You can surely make it nicer and use it as Pythonista tool.
from objc_util import *
@on_main_thread
def FindConsoleInput():
global console_tv
win = ObjCClass('UIApplication').sharedApplication().keyWindow()
main_view = win.rootViewController().view()
ret = ''
next_is_console = False
def analyze(v,indent):
global next_is_console
ret = None
for sv in v.subviews():
if 'UILabel' in str(sv._get_objc_classname()):
if str(sv.text()) == '>':
next_is_console = sv
else:
next_is_console = False
elif 'OMTextEditorView' in str(sv._get_objc_classname()):
if next_is_console:
return sv
ret = analyze(sv,indent+' ')
if ret:
return ret
ret = analyze(main_view,'')
return ret
@on_main_thread
def main():
ev = FindConsoleInput()
PA2UITheme = ObjCClass('PA2UITheme')
theme_dict = PA2UITheme.sharedTheme().themeDict().mutableCopy()
theme_dict.autorelease()
theme_dict['font-family'] = 'Menlo-Regular'
theme_dict['font-size'] = 40
OMSyntaxHighlighterTheme = ObjCClass('OMSyntaxHighlighterTheme')
theme = OMSyntaxHighlighterTheme.alloc().initWithDictionary_(theme_dict)
theme.autorelease()
ev.setTheme_(theme)
if __name__ == '__main__':
main()
