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.
Check if Pythonista is in background
-
It looks like if Scene is run in SceneView... it doesn't receive the pause/resume...
import ui, scene class scTest(scene.Scene): def pause(self): print 'pause' def resume(self): print 'resume' if False: scene.run(scTest()) else: v = ui.View() sv = scene.SceneView() sv.scene = scTest() #sv.hidden = True v.add_subview(sv) v.present('panel')
-
Yes. That is documented at: http://omz-software.com/pythonista/docs/ios/scene.html#integration-with-the-ui-module
-
There is no guarantee that your script will continue to run once you launch safari. In fact, there is a guarantee that in a few minutes, the background timer will expire, and your script will be unceremoniously killed.
If you just want to do something on a webpage, it is better to do it within a webview since you could make it modal for example, and continue only when the dialog is closed. Someone should really make a webview based clone of a full browser, with address bar, navigation, reload, stop, etc, in which case you'd never have to launch safari.
-
I am trying to open Google Authenticator for 2FA - I want to send them there and then when they return I would fill a prompt with
clipboard.get()
- so in this case a webview doesn't really help me.(To keep my script running I could use
console.set_idle_timer_disabled(flag)
like cclaus has shown.) -
The idea in NoDoze.py is that you setup a notification to wake yourself back up just before you shut yourself down. An interesting departure point. ;-)
-
@JonB I started working on something like that a while ago. I got history and bookmarks working as well. I don't really know how to get tabs working though.
-
@hyshai It looks like this might do it....
import ui, scene def AmIBack(): global gbGone if gbGone and not sv.paused: gbGone = False print "Back here" else: if sv.paused: gbGone = True ui.delay(AmIBack, 1) gbGone = False v = ui.View() sv = scene.SceneView() sv.hidden = True v.add_subview(sv) v.present('panel') AmIBack()
Edit: no need to set the scene... just SceneView will do
-
@sebastian. Post to github, others will contrib.
@hyshai. Ok, you originally said you wanted to open safari, not that you wanted to launch the authenticator app. Presumably you want to open a page which has an otpauth:// URI
See this.
Seems like you could create your own implementation in python, no external app required... After all, google authenticator is open source.
You could implement the custom uri handler for this in webview, and even autofill it, or have a little counter on the page showing the code in real time. -
-
@JonB - I just realized that you were giving me a solution for the opposite problem - I wasn't clear, my bad. I want for them to get the 2FA token so that they can login to their account. So implementing my own Google Authenticator app isn't a great solution because then I would have to store their secret in order to generate the token each time - and that's way too scary for me.