Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Maximize console view
-
Encouraged by the good and solid responses for my previous question I will dare another one here :)
Is there a way to maximize the console scriptually?
I have a script which I call through Siri Shortcuts, and prints the output to the console, but the state of the console/editor view is as Pythonista was left, so my thinking was to maximize the console view through the script.
-
@boegh sorry for the delay but I needed some time to solve it
from objc_util import * import ui @on_main_thread def setConsoleFullScreen(): global next_OMTextView_is_console win = ObjCClass('UIApplication').sharedApplication().keyWindow() main_view = win.rootViewController().view() ret = '' next_OMTextView_is_console = False def analyze(v,indent): global next_OMTextView_is_console, console_width ret = None for sv in v.subviews(): #print(indent,sv._get_objc_classname()) if 'UILabel' in str(sv._get_objc_classname()): next_OMTextView_is_console = str(sv.text()) == '>' elif 'OMTextView' in str(sv._get_objc_classname()): if next_OMTextView_is_console: # this sv is the console TextView console_width = sv.size().width elif 'UIImageView' in str(sv._get_objc_classname()): # <UIImage:0x281108240 named(main: DockAccessoryPanel) {28, 28}> #print(sv.image()) if 'DockAccessoryPanel' in str(sv.image()): b = sv.superview() # button of ImageView if console_width < (ui.get_screen_size()[0]/3): # simulate tap the partial/full console button UIControlEventTouchUpInside = 255 b.sendActionsForControlEvents_(UIControlEventTouchUpInside) return True ret = analyze(sv,indent+' ') if ret: return ret ret = analyze(main_view,'') return ret if __name__ == '__main__': #print('ici') setConsoleFullScreen()
-
Some variable name errors, corrected in above script
-
@cvp, you apologize for the delay while I did not yet even understand the problem description. :-) What is ”fullscreen” in this case?
Also, I tried your code on iPhone, and it does not (seem to) do anything.
-
@mikael Perhaps I did not understand the question 😢
But, if Pythonista is in mode where console uses only 1/3 of the screen on iPad and you run my code, il simulates you tap on the button which resets the full screen console. Remove the # in front of my print('ici') and watch the miracle
-
@boegh I begin to doubt that I understood your request ... Tell me if I understood correctly and if my function resolves it.
-
@cvp, now I might understand why I did not understand... On iPhone this does nothing and is simply not relevant – console is shown ”fullscreen” when something is printed to it (and nothing is
present
ed). -
@cvp said:
sorry for the delay but I needed some time to solve it
Please don't be sorry. I assume you are a volunteer contributor, and even if not, the response times are quite a bit lower, than what I have experienced from paid professionals :)
As for your question on wether or not you have understood the question, I can't answer that with exact certainty, but the solution you have provided does exactly what I was looking for, so I'd say that you most likely figured out what I meant. Sorry if I was not clear - English is not a first language for me, and the Python terminology is also a bit new for me.
-
@boegh English is not my mother language either and I'm happy that I had correctly understood but I always forget that presentation is different on an iPhone because I only work on iPad.
And I was perturbed by @mikael post because he didn't see anything on his iDevice, until I read the word iPhone...Thus, everybody is happy 😀