onboarding work, now waits to start daemon timers
This commit is contained in:
parent
fb975dc52c
commit
1de668a9e5
9 changed files with 102 additions and 28 deletions
|
@ -21,6 +21,8 @@
|
|||
import os, json, logger
|
||||
import filepaths
|
||||
|
||||
from . import onboarding
|
||||
|
||||
_configfile = filepaths.config_file
|
||||
_config = {}
|
||||
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
Setup config from onboarding choices
|
||||
"""
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from filepaths import onboarding_mark_file
|
||||
import onionrtypes
|
||||
from onionrtypes import JSONSerializable
|
||||
from onionrtypes import OnboardingConfig
|
||||
import config
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -23,8 +26,29 @@ import onionrtypes
|
|||
"""
|
||||
|
||||
|
||||
def set_config_from_onboarding(config_settings: onionrtypes.OnboardingConfig):
|
||||
return
|
||||
def _get_val_or_none(json: dict, key: str) -> Union[None, JSONSerializable]:
|
||||
try:
|
||||
return json['configInfo'][key]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
def set_config_from_onboarding(config_settings: OnboardingConfig):
|
||||
|
||||
network_security_level = 0
|
||||
theme = "dark"
|
||||
|
||||
if _get_val_or_none(config_settings, 'stateTarget') == True:
|
||||
config.set('general.security_level', 1)
|
||||
|
||||
if _get_val_or_none(config_settings, 'useDark') == False:
|
||||
config.set('ui.theme', 'light')
|
||||
|
||||
config.set('general.store_plaintext_blocks',
|
||||
_get_val_or_none(config_settings, 'plainContrib'))
|
||||
|
||||
|
||||
config.set('onboarding.done', True, savefile=True)
|
||||
|
||||
def set_onboarding_finished():
|
||||
"""Create the onboarding completed setting file"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue