More misc cleanup
This commit is contained in:
parent
11cf75d4a6
commit
b47c214133
4 changed files with 7 additions and 8 deletions
|
|
@ -4,10 +4,9 @@ import subprocess
|
|||
|
||||
from borrowed import acpi
|
||||
from functions.common import *
|
||||
from os import environ
|
||||
|
||||
# Variables
|
||||
SLMGR = r'{}\System32\slmgr.vbs'.format(environ.get('SYSTEMROOT'))
|
||||
SLMGR = r'{}\System32\slmgr.vbs'.format(global_vars['Env']['SYSTEMROOT'])
|
||||
|
||||
def activate_with_bios():
|
||||
"""Attempt to activate Windows with a key stored in the BIOS."""
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class NotInstalledError(Exception):
|
|||
class NoProfilesError(Exception):
|
||||
pass
|
||||
|
||||
class PathNotFoundException(Exception):
|
||||
class PathNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
class UnsupportedOSError(Exception):
|
||||
|
|
@ -174,7 +174,7 @@ def human_readable_size(size, decimals=0):
|
|||
size = convert_to_bytes(size)
|
||||
|
||||
# Verify we have a valid size
|
||||
if size <= 0:
|
||||
if size < 0:
|
||||
return '{size:>{width}} b'.format(size='???', width=width)
|
||||
|
||||
# Convert to sensible units
|
||||
|
|
@ -432,7 +432,7 @@ def try_and_print(message='Trying...',
|
|||
err = traceback.format_exc()
|
||||
|
||||
# Return or raise?
|
||||
if bool(err) and not catch_all:
|
||||
if err and not catch_all:
|
||||
raise
|
||||
else:
|
||||
return {'CS': not bool(err), 'Error': err}
|
||||
|
|
|
|||
|
|
@ -374,7 +374,7 @@ def scan_source_wim(source_wim, dest_path, rel_path=None, interactive=True):
|
|||
|
||||
def select_destination(folder_path, prompt='Select destination'):
|
||||
"""Select destination drive, returns path as string."""
|
||||
disk = select_disk(prompt)
|
||||
disk = select_volume(prompt)
|
||||
if 'fixed' not in disk['Disk'].opts:
|
||||
folder_path = folder_path.replace('\\', '-')
|
||||
path = '{disk}{folder_path}_{Date}'.format(
|
||||
|
|
@ -388,7 +388,7 @@ def select_destination(folder_path, prompt='Select destination'):
|
|||
|
||||
return path
|
||||
|
||||
def select_disk(title='Select disk', auto_select=True):
|
||||
def select_volume(title='Select disk', auto_select=True):
|
||||
"""Select disk from attached disks. returns dict."""
|
||||
actions = [{'Name': 'Quit', 'Letter': 'Q'}]
|
||||
disks = []
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ def get_shell_path(folder, user='current'):
|
|||
if folderid:
|
||||
try:
|
||||
path = knownpaths.get_path(folderid, getattr(knownpaths.UserHandle, user))
|
||||
except PathNotFoundException:
|
||||
except PathNotFoundError:
|
||||
# Folder not found, ignore and return None
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue