Adjusted get_actions()
* Handle 'If answer' & 'Win10 Only' options
This commit is contained in:
parent
9553cbcbc8
commit
de247c919b
1 changed files with 16 additions and 7 deletions
|
|
@ -124,12 +124,10 @@ SETUP_ACTIONS = OrderedDict({
|
|||
})
|
||||
SETUP_ACTION_KEYS = (
|
||||
'Function',
|
||||
'If answer',
|
||||
'If not activated',
|
||||
'Just run',
|
||||
'KWArgs',
|
||||
'Pause',
|
||||
'Win10 only',
|
||||
)
|
||||
SETUP_QUESTIONS = {
|
||||
# AV
|
||||
|
|
@ -149,11 +147,22 @@ SETUP_QUESTIONS = {
|
|||
|
||||
|
||||
# Functions
|
||||
def get_actions(setup_mode):
|
||||
def get_actions(setup_mode, answers):
|
||||
"""Get actions to perform based on setup_mode, returns OrderedDict."""
|
||||
actions = OrderedDict({})
|
||||
for _key, _val in SETUP_ACTIONS.items():
|
||||
_action = {'Enabled': _val.get(setup_mode, False)}
|
||||
_action = {}
|
||||
_if_answer = _val.get('If answer', False)
|
||||
_win10_only = _val.get('Win10 only', False)
|
||||
|
||||
# Set enabled status
|
||||
_action['Enabled'] = _val.get(setup_mode, False)
|
||||
if _if_answer:
|
||||
_action['Enabled'] &= answers[_if_answer]
|
||||
if _win10_only:
|
||||
_action['Enabled'] &= global_vars['OS']['Version'] == '10'
|
||||
|
||||
# Set other keys
|
||||
for _sub_key in SETUP_ACTION_KEYS:
|
||||
_action[_sub_key] = _val.get(_sub_key, None)
|
||||
actions[_key] = _action
|
||||
|
|
@ -258,12 +267,12 @@ def main():
|
|||
# Get setup mode
|
||||
setup_mode = get_mode()
|
||||
|
||||
# Get actions to perform
|
||||
actions = get_actions(setup_mode)
|
||||
|
||||
# Get answers to setup questions
|
||||
answers = get_answers(setup_mode)
|
||||
|
||||
# Get actions to perform
|
||||
actions = get_actions(setup_mode, answers)
|
||||
|
||||
# Perform actions
|
||||
# TODO
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue