Some difficult (for me) questions about Pythonista
@JonB said:
console.disable_idle_timer
should fix the 2 minute thing.
not quite but i found the Solution see below.
but Thanks for your Help :)
on_main_thread(console.set_idle_timer_disabled)(True)
https://forum.omz-software.com/topic/6489/set_idle_timer_disabled-bug
@JonB said:
Are you using ui, or scene?
I'm using UI
@JonB said:
Re FaceId, I believe this is the same as touchid in iOS. The code below should work with face for devices that have face instead of touch.
https://github.com/tdamdouni/Pythonista/blob/master/omz/touchid.py
No, this did not work.... on my iPad and iPhone (no touchid) they ask me for my code....
@mikael said:
@DavinE, so, yea to all except the last one, where I do not understand the question yet.
Sry for my bad english :(
I'm using a Synology with an MYSQL Server.
My Synology go in Sleep Mode for like 15min...
I want to tell the MSQL Server i'm online till i Leave my App
i hope it's better so
is it not possible to Fix/Lock the Orientation in fullscreen Mode ?
set_idle_timer_disabled bug ?
import console
from objc_util import on_main_thread
on_main_thread(console.set_idle_timer_disabled)(flag)
set_idle_timer_disabled bug ?
Greetings,
I’m having an issue with the following
code, it simply crashes my Pythonista since the latest update. Does it work on your devices ?
Thanks!
import console
console.set_idle_timer_disabled(True)
Triggering code on Pythonista focus lost
Here u go!
console.set_idle_timer_disabled(flag):
Disable or enable the idle timer (which puts the device to sleep after a certain period of inactivity).
console.is_in_background():
Return True if the app is currently running in the background, False otherwise.
Data logging in the background
I'm playing with Pythonista, and it's a very nice tool.
I found also many suggestion on the forum, thanks.
I'm trying now to do accelerometer logging.
Issue is when the phone idles logging stops.
Searching around it looks like there is no viable solution, but I found an hint about the use of
console.set_idle_timer_disabled(flag)
I placed it in the Today widget and ran it, but unfortunately it's not working.
Is there any hope?
I'm attaching the code.
Thanks in advance,
Massimo
#!python3
import appex, ui
import location
import motion
import csv
import time
import sys
import console
from functools import partial
count=0
i=0
#@ui.in_background
def avvialog(sender):
global count
global i
console.set_idle_timer_disabled(True)
motion.start_updates()
location.start_updates()
if (count<10):
ui.delay(partial(avvialog,sender),1)
label.text="partito"+str(i)
i=i+1
v.add_subview(label)
a=motion.get_user_acceleration()
b=location.get_location()
with open('filelogc.csv','a') as csvfile:
fh = csv.writer(csvfile,delimiter=',')
fh.writerow([time.clock(),time.asctime(),b["latitude"],b["longitude"],b["speed"],(a[0]**2+a[1]**2+a[2]**2)**0.5])
else:
motion.stop_updates()
location.stop_updates()
label.text="stop"
v.add_subview(label)
console.set_idle_timer_disabled(False)
count=0
i=0
def fermalog(sender):
global count
count=100
# button setup
v = ui.View(frame=(0, 0, 300, 150))
label = ui.Label(frame=(0, 0, 150, 90), flex='lwh', font=('<System>', 24), alignment=ui.ALIGN_CENTER, name='result_label',text="in pausa")
v.add_subview(label)
button1 = ui.Button(title='start', font=('<System>', 24), flex='rwh', action=avvialog)
button1.frame = (0, 50, 100, 100)
button2 = ui.Button(title='stop', font=('<System>', 24), flex='rwh', action=fermalog)
button2.frame = (120, 50, 220, 100)
v.add_subview(button1)
v.add_subview(button2)
appex.set_widget_view(v)
Running in background / preventing auto-lock?
@Snaresman, the link took me on a bit of a run-around, so here’s the workaround for the bug:
import console
from objc_util import on_main_thread
on_main_thread(console.set_idle_timer_disabled)(flag)
console.set_idle_timer_disabled crashes Pythonista
@ccc said:
https://forum.omz-software.com/search/set_idle_timer_disabled?in=titlesposts
Thank you. It was driving me mad. :-)
console.set_idle_timer_disabled crashes Pythonista
I am calling console.set_idle_timer_disabled(True) in my program and it crashes Pythonista. Is this a known issue?
Thanks