Reordered functions

This commit is contained in:
2Shirt 2019-09-15 13:33:59 -07:00
parent 8c8eea0f9a
commit b71f1d8d80
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -125,7 +125,7 @@ class Menu():
"""Format display name based on details and args, returns str."""
disabled = details.get('Disabled', False)
checkmark = '*'
if 'DISPLAY' in os.environ or sys.platform == 'darwin':
if 'DISPLAY' in os.environ or platform.system() == 'Darwin':
checkmark = ''
clear_code = COLORS['CLEAR']
color_code = COLORS['YELLOW'] if disabled else ''
@ -672,24 +672,6 @@ def clear_screen():
subprocess.run(cmd, check=False, shell=True, stderr=subprocess.PIPE)
def get_log_filepath():
"""Get the log filepath from the root logger, returns pathlib.Path obj.
NOTE: This will use the first handler baseFilename it finds (if any).
"""
log_filepath = None
root_logger = logging.getLogger()
# Check handlers
for handler in root_logger.handlers:
if hasattr(handler, 'baseFilename'):
log_filepath = pathlib.Path(handler.baseFilename).resolve()
break
# Done
return log_filepath
def generate_debug_report():
"""Generate debug report, returns str."""
import socket
@ -734,6 +716,24 @@ def generate_debug_report():
return '\n'.join(report)
def get_log_filepath():
"""Get the log filepath from the root logger, returns pathlib.Path obj.
NOTE: This will use the first handler baseFilename it finds (if any).
"""
log_filepath = None
root_logger = logging.getLogger()
# Check handlers
for handler in root_logger.handlers:
if hasattr(handler, 'baseFilename'):
log_filepath = pathlib.Path(handler.baseFilename).resolve()
break
# Done
return log_filepath
def input_text(prompt='Enter text'):
"""Get text from user, returns string."""
prompt = str(prompt)