Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2022-10-01 19:20:19 -07:00
commit 3dbb5431dc
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 30 additions and 11 deletions

View file

@ -11,6 +11,11 @@ BROWSER_PATHS = {
'Opera': 'Opera/launcher.exe',
}
FAB_TIMEFRAME = 14 # If it's been at least this many days don't prompt for an AV scan
DISABLED_ENTRIES_WINDOWS_11 = {
# Group Name: Option Name
'Install Software': 'Open Shell',
'Configure System': 'Open Shell',
}
LIBREOFFICE_XCU_DATA = '''<?xml version="1.0" encoding="UTF-8"?>
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item oor:path="/org.openoffice.Setup/Office/Factories/org.openoffice.Setup:Factory['com.sun.star.presentation.PresentationDocument']"><prop oor:name="ooSetupFactoryDefaultFilter" oor:op="fuse"><value>Impress MS PowerPoint 2007 XML</value></prop></item>

View file

@ -68,14 +68,24 @@ KNOWN_HIVE_NAMES = {
winreg.HKEY_LOCAL_MACHINE: 'HKLM',
winreg.HKEY_USERS: 'HKU',
}
OS_VERSION = platform.win32_ver()[0]
OS_VERSION = 8.1 if OS_VERSION == '8.1' else int(OS_VERSION)
RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory
RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory
REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer'
SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs')
SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE')
# STATIC OS VARIABLES
WIN32_VER = platform.win32_ver()
OS_BUILD_VERSION_FULL = WIN32_VER[1]
OS_BUILD_VERSION = int(OS_BUILD_VERSION_FULL.split('.')[2])
PLATFORM_VER = WIN32_VER[0]
if PLATFORM_VER == '8.1':
OS_VERSION = 8.1
elif OS_BUILD_VERSION >= 22000:
OS_VERSION = 11
else:
OS_VERSION = int(PLATFORM_VER)
# Activation Functions
def activate_with_bios():
@ -267,21 +277,19 @@ def get_os_name(as_list=False, check=True):
outdated or unsupported.
"""
key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion'
build_version = int(reg_read_value("HKLM", key, "CurrentBuild"))
build_version_full = platform.win32_ver()[1]
details = WINDOWS_BUILDS.get(build_version_full, f'Build {build_version}')
details = WINDOWS_BUILDS.get(OS_BUILD_VERSION_FULL, f'Build {OS_BUILD_VERSION}')
display_name = (
f'{reg_read_value("HKLM", key, "ProductName")} {ARCH}-bit {details}'
)
if build_version >= 22000:
if OS_BUILD_VERSION >= 22000:
display_name = display_name.replace('Windows 10', 'Windows 11')
# Check for support issues
if check:
if build_version in OUTDATED_BUILD_NUMBERS:
if OS_BUILD_VERSION in OUTDATED_BUILD_NUMBERS:
raise GenericWarning(f'{display_name} (outdated)')
if build_version < OLDEST_SUPPORTED_BUILD:
if OS_BUILD_VERSION < OLDEST_SUPPORTED_BUILD:
raise GenericError(f'{display_name} (unsupported)')
# Done

View file

@ -14,13 +14,14 @@ import webbrowser
from wk.cfg.main import KIT_NAME_FULL
from wk.cfg.setup import (
BROWSER_PATHS,
DISABLED_ENTRIES_WINDOWS_11,
FAB_TIMEFRAME,
REG_ESET_NOD32_SETTINGS,
LIBREOFFICE_XCU_DATA,
REG_CHROME_UBLOCK_ORIGIN,
REG_WINDOWS_EXPLORER,
REG_OPEN_SHELL_SETTINGS,
REG_ESET_NOD32_SETTINGS,
REG_OPEN_SHELL_LOW_POWER_IDLE,
REG_OPEN_SHELL_SETTINGS,
REG_WINDOWS_EXPLORER,
UBLOCK_ORIGIN_URLS,
)
from wk.exe import kill_procs, run_program, popen_program
@ -167,6 +168,11 @@ def build_menus(base_menus, title, presets):
MENU_PRESETS.add_action('Quit')
MENU_PRESETS.update()
# Disable entries incompatible with Windows 11
if OS_VERSION == 11:
for group_name, entry_name in DISABLED_ENTRIES_WINDOWS_11.items():
menus[group_name].options[entry_name]['Disabled'] = True
# Done
return menus