Reordered functions
This commit is contained in:
parent
8c8eea0f9a
commit
b71f1d8d80
1 changed files with 19 additions and 19 deletions
|
|
@ -125,7 +125,7 @@ class Menu():
|
||||||
"""Format display name based on details and args, returns str."""
|
"""Format display name based on details and args, returns str."""
|
||||||
disabled = details.get('Disabled', False)
|
disabled = details.get('Disabled', False)
|
||||||
checkmark = '*'
|
checkmark = '*'
|
||||||
if 'DISPLAY' in os.environ or sys.platform == 'darwin':
|
if 'DISPLAY' in os.environ or platform.system() == 'Darwin':
|
||||||
checkmark = '✓'
|
checkmark = '✓'
|
||||||
clear_code = COLORS['CLEAR']
|
clear_code = COLORS['CLEAR']
|
||||||
color_code = COLORS['YELLOW'] if disabled else ''
|
color_code = COLORS['YELLOW'] if disabled else ''
|
||||||
|
|
@ -672,24 +672,6 @@ def clear_screen():
|
||||||
subprocess.run(cmd, check=False, shell=True, stderr=subprocess.PIPE)
|
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():
|
def generate_debug_report():
|
||||||
"""Generate debug report, returns str."""
|
"""Generate debug report, returns str."""
|
||||||
import socket
|
import socket
|
||||||
|
|
@ -734,6 +716,24 @@ def generate_debug_report():
|
||||||
return '\n'.join(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'):
|
def input_text(prompt='Enter text'):
|
||||||
"""Get text from user, returns string."""
|
"""Get text from user, returns string."""
|
||||||
prompt = str(prompt)
|
prompt = str(prompt)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue