Expanded Windows power plan sections
* Moved power plan step much earlier in system_setup * System setup now does the following: * Takes backups of all power plans * Restores the default power plan settings * Sets the Balanced plan as active * Added reset_power_plans() * Added set_power_plan()
This commit is contained in:
parent
d2561eb43e
commit
462ae7d4b9
3 changed files with 28 additions and 1 deletions
|
|
@ -140,6 +140,19 @@ def enable_system_restore():
|
|||
run_program(cmd)
|
||||
|
||||
|
||||
def reset_power_plans():
|
||||
"""Reset power plans to default settings."""
|
||||
cmd = ['powercfg', '-RestoreDefaultSchemes']
|
||||
run_program(cmd)
|
||||
|
||||
|
||||
def set_power_plan(name='Balanced'):
|
||||
"""Set power plan by name."""
|
||||
guid = POWER_PLAN_GUIDS[name]
|
||||
cmd = ['powercfg', '-SetActive', guid]
|
||||
run_program(cmd)
|
||||
|
||||
|
||||
def update_clock():
|
||||
"""Set Timezone and sync clock."""
|
||||
run_program(['tzutil', '/s', WINDOWS_TIME_ZONE], check=False)
|
||||
|
|
|
|||
|
|
@ -210,6 +210,13 @@ LIBREOFFICE_XCU_DATA = '''<?xml version="1.0" encoding="UTF-8"?>
|
|||
</oor:items>
|
||||
'''
|
||||
|
||||
# Power Plans
|
||||
POWER_PLAN_GUIDS = {
|
||||
'Power': 'a1841308-3541-4fab-bc81-f71556f20b4a',
|
||||
'Balanced': '381b4222-f694-41f0-9685-ff5bb260df2e',
|
||||
'High Performance': '8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c',
|
||||
}
|
||||
|
||||
# Registry
|
||||
SETTINGS_REGBACK = {
|
||||
# Enable RegBack
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ SETUP_ACTIONS = OrderedDict({
|
|||
'Explorer (system)': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': config_explorer_system, 'Win10 only': True,},
|
||||
'Explorer (user)': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': config_explorer_user, 'Win10 only': True,},
|
||||
'Restart Explorer': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': restart_explorer,},
|
||||
'Power Plans': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': configure_power_plans, 'KWArgs': {'name': 'Balanced'},},
|
||||
'Update Clock': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': update_clock,},
|
||||
|
||||
# Cleanup
|
||||
|
|
@ -100,7 +101,6 @@ SETUP_ACTIONS = OrderedDict({
|
|||
'Exporting system info': {'Info': True},
|
||||
'AIDA64 Report': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': run_aida64,},
|
||||
'File listing': {'New': True, 'Dat': True, 'Cur': True, 'HW': False, 'Function': backup_file_list,},
|
||||
'Power plans': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': backup_power_plans,},
|
||||
'Product Keys': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': run_produkey,},
|
||||
'Registry': {'New': True, 'Dat': True, 'Cur': True, 'HW': True, 'Function': backup_registry,},
|
||||
|
||||
|
|
@ -169,6 +169,13 @@ def check_os_and_abort():
|
|||
abort()
|
||||
|
||||
|
||||
def configure_power_plans(name='Balanced'):
|
||||
"""Meta function to backup, restore defaults, and set the power plan."""
|
||||
backup_power_plans()
|
||||
reset_power_plans()
|
||||
set_power_plan(name)
|
||||
|
||||
|
||||
def get_actions(setup_mode, answers):
|
||||
"""Get actions to perform based on setup_mode, returns OrderedDict."""
|
||||
actions = OrderedDict({})
|
||||
|
|
|
|||
Loading…
Reference in a new issue