Update user_interaction.py

This commit is contained in:
Dylan M. Taylor 2021-04-22 15:18:59 -04:00 committed by GitHub
parent 935b878c96
commit bd9d2c9125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 11 deletions

View File

@ -130,17 +130,19 @@ def ask_for_additional_users(prompt='Any additional users to install (leave blan
return users, super_users
def ask_for_a_timezone():
timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip()
if timezone == '':
timezone = 'UTC'
if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists():
return timezone
else:
log(
f"Time zone {timezone} does not exist, continuing with system default.",
level=LOG_LEVELS.Warning,
fg='red'
)
exists = False
while not exists:
timezone = input('Enter a valid timezone (examples: Europe/Stockholm, US/Eastern) or press enter to use UTC: ').strip()
if timezone == '':
timezone = 'UTC'
if (pathlib.Path("/usr")/"share"/"zoneinfo"/timezone).exists():
return timezone
else:
log(
f"Specified timezone {timezone} does not exist.",
level=LOG_LEVELS.Warning,
fg='red'
)
def ask_for_audio_selection():
audio = "pulseaudio" # Default for most desktop environments