diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index 17e5972c..45c3ff35 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -54,8 +54,8 @@ if __name__ == '__main__': confirm_selections(args) # Prep UFD - print_info('Prep UFD') if not args['--update']: + print_info('Prep UFD') prep_device(ufd_dev, UFD_LABEL, use_mbr=args['--use-mbr']) # Mount UFD diff --git a/.bin/Scripts/functions/cleanup.py b/.bin/Scripts/functions/cleanup.py index 2723994b..acbd2d65 100644 --- a/.bin/Scripts/functions/cleanup.py +++ b/.bin/Scripts/functions/cleanup.py @@ -1,9 +1,10 @@ -# Wizard Kit: Functions - Cleanup +'''Wizard Kit: Functions - Cleanup''' +# pylint: disable=no-name-in-module,wildcard-import +# vim: sts=2 sw=2 ts=2 from functions.setup import * from settings.cleanup import * - def cleanup_adwcleaner(): """Move AdwCleaner folders into the ClientDir.""" source_path = r'{SYSTEMDRIVE}\AdwCleaner'.format(**global_vars['Env']) @@ -247,7 +248,14 @@ def delete_registry_value(hive, key, value): winreg.DeleteValue(k, value) +def restore_default_uac(): + """Restores default UAC settings via the registry.""" + if global_vars['OS']['Version'] == '10': + write_registry_settings(UAC_DEFAULTS_WIN10, all_users=True) + else: + # Haven't checked Win8 settings, only applying minimum set + write_registry_settings(UAC_DEFAULTS_WIN7, all_users=True) + + if __name__ == '__main__': print("This file is not meant to be called directly.") - -# vim: sts=2 sw=2 ts=2 diff --git a/.bin/Scripts/functions/data.py b/.bin/Scripts/functions/data.py index c359ab6c..222991bb 100644 --- a/.bin/Scripts/functions/data.py +++ b/.bin/Scripts/functions/data.py @@ -218,7 +218,7 @@ def mount_volumes( report[vol_path] = vol_data elif 'children' in vol_data: # Skip LVM/RAID partitions (the real volume is mounted separately) - vol_data['show_data']['data'] = vol_data.get('fstype', 'UNKNOWN') + vol_data['show_data']['data'] = vol_data.get('fstype', 'Unknown') if vol_data.get('label', None): vol_data['show_data']['data'] += ' "{}"'.format(vol_data['label']) vol_data['show_data']['info'] = True diff --git a/.bin/Scripts/functions/hw_diags.py b/.bin/Scripts/functions/hw_diags.py index 8746ed79..da347082 100644 --- a/.bin/Scripts/functions/hw_diags.py +++ b/.bin/Scripts/functions/hw_diags.py @@ -614,6 +614,83 @@ class State(): # Assuming layout definitions changes mid-run, ignoring pass + def build_outer_panes(self): + """Build top and side panes.""" + clear_screen() + + # Top + self.panes['Top'] = tmux_split_window( + behind=True, lines=2, vertical=True, + text=TOP_PANE_TEXT) + + # Started + self.panes['Started'] = tmux_split_window( + lines=SIDE_PANE_WIDTH, target_pane=self.panes['Top'], + text='{BLUE}Started{CLEAR}\n{s}'.format( + s=time.strftime("%Y-%m-%d %H:%M %Z"), + **COLORS)) + + # Progress + self.panes['Progress'] = tmux_split_window( + lines=SIDE_PANE_WIDTH, + watch=self.progress_out) + + def fix_tmux_panes(self): + """Fix pane sizes if the window has been resized.""" + needs_fixed = False + + # Bail? + if not self.panes: + return + + # Check layout + for k, v in self.tmux_layout.items(): + if not v.get('Check'): + # Not concerned with the size of this pane + continue + # Get target + target = None + if k != 'Current': + if k not in self.panes: + # Skip missing panes + continue + else: + target = self.panes[k] + + # Check pane size + x, y = tmux_get_pane_size(pane_id=target) + if v.get('x', False) and v['x'] != x: + needs_fixed = True + if v.get('y', False) and v['y'] != y: + needs_fixed = True + + # Bail? + if not needs_fixed: + return + + # Update layout + for k, v in self.tmux_layout.items(): + # Get target + target = None + if k != 'Current': + if k not in self.panes: + # Skip missing panes + continue + else: + target = self.panes[k] + + # Resize pane + tmux_resize_pane(pane_id=target, **v) + + def fix_tmux_panes_loop(self): + while True: + try: + self.fix_tmux_panes() + sleep(1) + except RuntimeError: + # Assuming layout definitions changes mid-run, ignoring + pass + def init(self): """Remove test objects, set log, and add devices.""" self.disks = [] diff --git a/.bin/Scripts/settings/cleanup.py b/.bin/Scripts/settings/cleanup.py index fd4a595b..15162947 100644 --- a/.bin/Scripts/settings/cleanup.py +++ b/.bin/Scripts/settings/cleanup.py @@ -1,11 +1,18 @@ -# Wizard Kit: Settings - Cleanup +'''Wizard Kit: Settings - Cleanup''' +# vim: sts=2 sw=2 ts=2 +import os import re -import psutil + try: + # pylint: disable=import-error import winreg + HKU = winreg.HKEY_USERS + HKCR = winreg.HKEY_CLASSES_ROOT + HKCU = winreg.HKEY_CURRENT_USER + HKLM = winreg.HKEY_LOCAL_MACHINE except ModuleNotFoundError: - if psutil.WINDOWS: + if os.name == 'nt': raise # d7II @@ -33,10 +40,6 @@ DESKTOP_ITEMS = re.compile( ) # Registry -HKU = winreg.HKEY_USERS -HKCR = winreg.HKEY_CLASSES_ROOT -HKCU = winreg.HKEY_CURRENT_USER -HKLM = winreg.HKEY_LOCAL_MACHINE UAC_DEFAULTS_WIN7 = { r'Software\Microsoft\Windows\CurrentVersion\Policies\System': { 'DWORD Items': { @@ -62,5 +65,3 @@ UAC_DEFAULTS_WIN10 = { if __name__ == '__main__': print("This file is not meant to be called directly.") - -# vim: sts=2 sw=2 ts=2 diff --git a/.bin/Scripts/settings/launchers.py b/.bin/Scripts/settings/launchers.py index ca7ea636..e310c558 100644 --- a/.bin/Scripts/settings/launchers.py +++ b/.bin/Scripts/settings/launchers.py @@ -1,4 +1,6 @@ -# Wizard Kit: Settings - Launchers +'''Wizard Kit: Settings - Launchers''' +# pylint: disable=line-too-long +# vim: sts=2 sw=2 ts=2 LAUNCHERS = { r'(Root)': { @@ -66,6 +68,7 @@ LAUNCHERS = { }, }, r'Data Transfers': { + # pylint: disable=bad-continuation "Fab's Autobackup Pro": { 'L_TYPE': 'Executable', 'L_PATH': 'AutoBackupPro', @@ -278,7 +281,7 @@ LAUNCHERS = { 'L_TYPE': 'Executable', 'L_PATH': 'erunt', 'L_ITEM': 'ERUNT.EXE', - 'L_ARGS': '%client_dir%\Backups\Registry\%iso_date% sysreg curuser otherusers', + 'L_ARGS': r'%client_dir%\Backups\Registry\%iso_date% sysreg curuser otherusers', 'L_ELEV': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Logs', @@ -330,13 +333,13 @@ LAUNCHERS = { r'Drivers': { 'Intel RST (Current Release)': { 'L_TYPE': 'Executable', - 'L_PATH': '_Drivers\Intel RST', + 'L_PATH': r'_Drivers\Intel RST', 'L_ITEM': 'SetupRST_17.2.exe', 'L_7ZIP': 'SetupRST_17.2.exe', }, 'Intel RST (Previous Releases)': { 'L_TYPE': 'Folder', - 'L_PATH': '_Drivers\Intel RST', + 'L_PATH': r'_Drivers\Intel RST', 'L_ITEM': '.', 'L_NCMD': 'True', }, @@ -352,7 +355,7 @@ LAUNCHERS = { }, 'Snappy Driver Installer Origin': { 'L_TYPE': 'Executable', - 'L_PATH': '_Drivers\SDIO', + 'L_PATH': r'_Drivers\SDIO', 'L_ITEM': 'SDIO.exe', }, }, @@ -507,6 +510,20 @@ LAUNCHERS = { 'L_PATH': 'ConEmu', 'L_ITEM': 'ConEmu.exe', }, + 'Disable Windows Updates': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'windows_updates.py', + 'L_ARGS': '--disable', + 'L_ELEV': 'True', + }, + 'Enable Windows Updates': { + 'L_TYPE': 'PyScript', + 'L_PATH': 'Scripts', + 'L_ITEM': 'windows_updates.py', + 'L_ARGS': '--enable', + 'L_ELEV': 'True', + }, 'Enter SafeMode': { 'L_TYPE': 'PyScript', 'L_PATH': 'Scripts', @@ -562,7 +579,7 @@ LAUNCHERS = { 'L_TYPE': 'Executable', 'L_PATH': 'XMPlay', 'L_ITEM': 'xmplay.exe', - 'L_ARGS': '"%bin%\XMPlay\music.7z"', + 'L_ARGS': r'"%bin%\XMPlay\music.7z"', }, }, r'Repairs': { @@ -627,7 +644,7 @@ LAUNCHERS = { 'L_TYPE': 'Executable', 'L_PATH': 'RKill', 'L_ITEM': 'RKill.exe', - 'L_ARGS': '-s -l %log_dir%\Tools\RKill.log', + 'L_ARGS': r'-s -l %log_dir%\Tools\RKill.log', 'L_ELEV': 'True', 'Extra Code': [ r'call "%bin%\Scripts\init_client_dir.cmd" /Logs', @@ -697,5 +714,3 @@ LAUNCHERS = { if __name__ == '__main__': print("This file is not meant to be called directly.") - -# vim: sts=2 sw=2 ts=2 diff --git a/.bin/Scripts/settings/setup.py b/.bin/Scripts/settings/setup.py index 4b402bd7..12d6cef1 100644 --- a/.bin/Scripts/settings/setup.py +++ b/.bin/Scripts/settings/setup.py @@ -170,6 +170,7 @@ SETTINGS_EXPLORER_USER = { }, }, r'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced': { + # Dup path so it Will be applied to all modes 'DWORD Items': { # Launch Folder Windows in a Separate Process 'SeparateProcess': 1,