Hey Guys,
Is Pythonista able to block the call function ?
My problem is when i'm in my app and i get a call (normal or WhatsApp) it hang up my App and i need to begin at Start.
Hey Guys,
Is Pythonista able to block the call function ?
My problem is when i'm in my app and i get a call (normal or WhatsApp) it hang up my App and i need to begin at Start.
@DavinE not sure that helps but you could start a shortcut which sets the airplane mode
@cvp
I need WIFI xD
can Pythonista set the airplane mode ?
@DavinE I don't know for Pythonista, but since iOS 11, desactivating airplane does not désactivante wifi nor Bluetooth. Thus if you launch a shortcut from Pythonista, you could thus stop your telephone activity
See here
@cvp said:
@DavinE I don't know for Pythonista, but since iOS 11, desactivating airplane does not désactivante wifi nor Bluetooth. Thus if you launch a shortcut from Pythonista, you could thus stop your telephone activity
hehe ^^
okay nice Idea perfect!
Thanks again @cvp
@DavinE said:
Is it possible go back to Pythonista ?
I don't think so but your shortcut could relaunch Pythonista with an argument telling to your Pythonista script that it is called back
@DavinE said:
can Pythonista set the airplane mode
I think that it could be possible in Objectivec, but it could be not allowed by an Apple rule because it uses a private API.
Code to get airplane mode but set does not work
from objc_util import *
RadiosPreferences = ObjCClass('RadiosPreferences').alloc().init()
print(RadiosPreferences.airplaneMode())
# set does not work
RadiosPreferences.setAirplaneMode_(False)
RadiosPreferences.synchronize()
Perhaps one solution.
YOu can, with the Shortcuts app, create an automatic shortcut "activate airplane mode" when you receive a mail from your-self with a particular subject.
And your Pythonista script has only to send tHis mail when you want to set airplane mode.
I'm proud of me 😂 but I did not test it.
There is also an automation, when App is open.
@7upser yes but perhaps you don't want it each time you open Pythonista, for instance during development.
good argument
@7upser finally, when you work on Pythonista and you don't want To be interrupted by a phone call, why not use control center, this one does not interrupt your Pythonista App.
@7upser I read one more time your initial post, and you speak also about WhatsApp, and this one works in wifi, thus will still function if Airplane mode is activated.
@cvp It wasn't my Thread 😛
But you are right Phone calls and WhatsApp are different things.
Maybe there is a url scheme for whats app, or a action for Shortcuts.
But back to what i'm interested in (call shortcut and return to pythonista)
This could work:
import ui
import webbrowser
class cUIView(ui.View):
def __init__(self, *args, **kwargs):
self.width, self.height = 200, 200
self.background_color = 'silver'
self.vBtn = ui.Button(title = 'test', name = 'btntest')
self.vBtn.frame = (50, 50, 100, 100)
self.vBtn.background_color = 'white'
self.vBtn.action = self.btnAction
self.add_subview(self.vBtn)
def btnAction(self, vSender):
url = 'shortcuts://x-callback-url/run-shortcut?name=testBluetoothOff&x-success=pythonista3://'
webbrowser.open(url)
vView = cUIView()
vView.present('sheet')
@7upser said:
It wasn't my Thread
I'm very sorry, sincerely
@7upser said:
This could work:
Sure but as you can start the same app normally or launched by Shortcuts, you have to check arguments to differentiate both types of calls
@cvp said:
@7upser said:
It wasn't my Thread
I'm very sorry, sincerely
that was mine xD
@7upser said:
@cvp It wasn't my Thread 😛
But you are right Phone calls and WhatsApp are different things.
Maybe there is a url scheme for whats app, or a action for Shortcuts.But back to what i'm interested in (call shortcut and return to pythonista)
This could work:```
import ui
import webbrowserclass cUIView(ui.View):
def init(self, args, *kwargs):
self.width, self.height = 200, 200
self.background_color = 'silver'self.vBtn = ui.Button(title = 'test', name = 'btntest') self.vBtn.frame = (50, 50, 100, 100) self.vBtn.background_color = 'white' self.vBtn.action = self.btnAction self.add_subview(self.vBtn)def btnAction(self, vSender):
url = 'shortcuts://x-callback-url/run-shortcut?name=testBluetoothOff&x-success=pythonista3://'
webbrowser.open(url)vView = cUIView()
vView.present('sheet')
```
Thats nice xD
Thanks