File: android-deltas-sync/_etc/termux-widget-shims/sync-changes.py

#!/data/data/com.termux/files/usr/bin/python3 
#!/usr/bin/env python3  # fails in widget, termux-exec or not

"""
========================================================================
Sync changes: a simple Python 'shim' script for Termux:Widget.  

Run by home-screen widget taps, this starts another Python script
located outside the widget's shortcuts folder, and named by the 
"runee" setting below.  Change this if needed for your install path.

See ./initial-copy.py's docstring for more info common to all shims.
See ../../_README.html for license, attribution, version, and docs.
========================================================================
"""

# EDIT if needed
runee = '/sdcard/Download/android-deltas-sync/sync-changes-part2-phone.py'

import sys, os
trace = lambda *args: None
auto_wakelock = True

if auto_wakelock:
    trace('(acquiring wakelock)')
    os.system('termux-wake-lock &')        # keep cpu running (but don't wait)

os.system(sys.executable + ' ' + runee)    # run package's main script 

if auto_wakelock:
    trace('(releasing wakelock)')
    os.system('termux-wake-unlock &')      # release wake lock (but don't wait)

input('Bye (press enter)')                 # keep console open till enter/return



[Home page] Books Code Blog Python Author Train Find ©M.Lutz