You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
2.0 KiB

# SPDX-FileCopyrightText: 2020 Foundation Devices, Inc. <hello@foundationdevices.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2018 Coinkite, Inc. <coldcardwallet.com>
# SPDX-License-Identifier: GPL-3.0-only
#
# (c) Copyright 2018 by Coinkite Inc. This file is part of Coldcard <coldcardwallet.com>
# and is covered by GPLv3 license found in COPYING.
#
# choosers.py - various interactive menus for setting config values.
#
from common import settings
def shutdown_timeout_chooser():
DEFAULT_SHUTDOWN_TIMEOUT = (2*60) # 2 minutes
timeout = settings.get('shutdown_timeout', DEFAULT_SHUTDOWN_TIMEOUT) # in seconds
ch = [' 1 minute',
' 2 minutes',
' 5 minutes',
'15 minutes',
'30 minutes',
'60 minutes',
'Never']
va = [1*60, 2*60, 5*60, 15*60, 30*60, 60*60, 0]
try:
which = va.index(timeout)
except ValueError:
which = 1
def set_shutdown_timeout(idx, text):
settings.set('shutdown_timeout', va[idx])
return which, ch, set_shutdown_timeout
def brightness_chooser():
screen_brightness = settings.get('screen_brightness', 100)
ch = ['Off', '25%', '50%', '75%', '100%'] # , 'Automatic']
va = [0, 25, 50, 75, 100] # , 999]
try:
which = va.index(screen_brightness)
except ValueError:
which = 4
def set(idx, text):
from common import dis
dis.set_brightness(va[idx])
settings.set('screen_brightness', va[idx])
return which, ch, set
def enable_passphrase_chooser():
# Should the Passphrase menu be enabled in the main menu?
ch = ['Disabled', 'Enabled']
va = [False, True]
assert len(ch) == len(va)
enable_passphrase = settings.get('enable_passphrase', False)
try:
which = va.index(enable_passphrase)
except ValueError:
which = 0
def set_enable_passphrase(idx, text):
settings.set('enable_passphrase', va[idx])
return which, ch, set_enable_passphrase
# EOF