Forum Archive

console input font size

huub

console.set_font sets the size of the OUTPUT font. I like that a lot as a larger font size is easier on my eyes. However, is there a way to increase the size of the font in the INPUT line ( the line above the keyboard)?

stephen

@huub ive givin this a really good try.. and i cannot seem to get this one.. i know some font is controlled soley on system wide setings and i did not see input font in NSUserDefaults if you change your ios font scalevdoes it change for thevInput Field?

cvp

@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() 

stephen

@cvp

i know im fresh new to Objc but i spent hours tying anything i could find... 🤓😁💪 outstanding!