Allow multiple lines of text before presenting radio options

Former-commit-id: 46751c0b67133a277612c46086b21f5c2477cf48
Former-commit-id: db8800da451d469e1d42dae19a4ca77bf657c947
This commit is contained in:
2023-07-08 18:53:37 -04:00
parent 1344aa23f6
commit 5fb5b5b108
+12 -12
View File
@@ -32,7 +32,7 @@ def curses_radio(_options, _pretext):
stdscr.clear() stdscr.clear()
stdscr.addstr(0, 0, _pretext) stdscr.addstr(0, 0, _pretext)
for _i, _option in enumerate(_options): for _i, _option in enumerate(_options):
_y = _i + 2 _y = _i + _pretext.count('\n') + 2
if _i == _selected: if _i == _selected:
stdscr.addstr(_y, 0, "[*] " + _option, A_REVERSE) stdscr.addstr(_y, 0, "[*] " + _option, A_REVERSE)
else: else:
@@ -206,13 +206,14 @@ def quick_unlock_config(_default):
if _default: if _default:
_enabled = 'false' _enabled = 'false'
else: else:
_quick_unlock_sel = curses_radio(('no', 'yes'), 'enable quick-unlock?\n\n\n\n\nquick-unlock allows you to use ' _quick_unlock_sel = curses_radio(('no', 'yes'), 'WARNING: quick-unlock is only as secure as the environment you'
'a shorter version of your gpg key passphrase and\nrequires a ' ' use it in\n\nquick-unlock allows you to use a shorter version'
'constant connection to your sshyp server to authenticate\n\n' ' of your gpg key passphrase and\nrequires a constant '
'WARNING: quick-unlock is only as secure as the environment' 'connection to your sshyp server to authenticate\n\na '
' you use it in\n\na compromised program on your computer could' 'compromised program on your computer could scan the process '
' scan the process list in the\nbrief period during decryption ' 'list in the\nbrief period during decryption to retrieve the '
'to retrieve the necessary information to decrypt your entries') 'necessary information to decrypt your entries\n\nenable '
'quick-unlock?')
if _quick_unlock_sel == 1: if _quick_unlock_sel == 1:
_enabled = 'true' _enabled = 'true'
else: else:
@@ -229,10 +230,9 @@ def refresh_encryption():
_directory = sshyp_data.get('SSHYNC', 'local_dir').rstrip('/') _directory = sshyp_data.get('SSHYNC', 'local_dir').rstrip('/')
# warn the user of potential data loss and prompt to continue # warn the user of potential data loss and prompt to continue
_proceed = curses_radio(('no', 'yes'), "are you sure you wish to re-encrypt all entries?\n\n\n\n\nWARNING: " _proceed = curses_radio(('no', 'yes'), "WARNING: proceeding with this action will remove/overwrite any directories"
"proceeding with this action will remove/overwrite any directories matching" f" matching the following:\n\n{home}/.local/share/sshyp.old\n{home}/.local/"
" the following:\n\n" "share/sshyp.new\n\nare you sure you wish to re-encrypt all entries?")
f"{home}/.local/share/sshyp.old\n{home}/.local/share/sshyp.new\n\n")
if _proceed != 1: if _proceed != 1:
return 3 return 3