# Wizard Kit: Post-d7II items

import os
import sys

# Init
os.chdir(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(os.getcwd())
from functions.browsers import *
from functions.cleanup import *
from functions.setup import *
init_global_vars()
os.system('title {}: Post-d7II Work'.format(KIT_NAME_FULL))
set_log_file('Post-d7II Work.log')

if __name__ == '__main__':
  try:
    stay_awake()
    clear_screen()
    print_info('{}: Post-d7II Work\n'.format(KIT_NAME_FULL))
    other_results = {
      'Warning': {
        'NotInstalledError': 'Not installed',
        'NoProfilesError': 'No profiles found',
      }}

    # Scan for Firefox browsers
    print_info('Scanning for Firefox browsers')
    scan_for_browsers(just_firefox=True)

    # Install uBlock Origin
    print_info('Installing uBlock Origin')
    install_adblock(just_firefox=True)
    print_standard('Please enable uBlock Origin in Firefox.')
    pause()

    # Cleanup
    print_info('Cleanup')
    try_and_print(message='d7II...',
      function=cleanup_d7ii, cs='Done')
    try_and_print(message='{}...'.format(KIT_NAME_FULL),
      function=delete_empty_folders, cs='Done',
      folder_path=global_vars['ClientDir'])

    # Run speedtest
    popen_program(['start', '', 'https://fast.com'], shell=True)

    # Done
    print_standard('\nDone.')
    pause('Press Enter to exit...')
    exit_script()
  except SystemExit as sys_exit:
    exit_script(sys_exit.code)
  except:
    major_exception()

# vim: sts=2 sw=2 ts=2
