Skip to content

Commit 0a72842

Browse files
committed
Show banner only for help in TTY
Avoid building the ASCII/banner art unless help is being requested: parse_args now detects -h/--help and only constructs the help description in that case. At startup, the banner is printed (not logged) only when stdout is a TTY and the terminal is wide enough; failures while building/printing the banner are caught to keep startup robust. Also removed dlclivegui/assets/* from the coverage omit list so those files will be considered by coverage tooling.
1 parent 4c5f8e1 commit 0a72842

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

dlclivegui/main.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def parse_args(argv=None):
6060

6161
default_desc = "Welcome to DeepLabCut-Live GUI!"
6262
no_art_flag = "--no-art" in argv
63-
if not no_art_flag:
63+
wants_help = any(a in ("-h", "--help") for a in argv)
64+
65+
# Only build banner description if we're about to print help
66+
if wants_help and not no_art_flag:
6467
try:
6568
desc = art.build_help_description()
6669
except Exception as e:
@@ -80,11 +83,15 @@ def parse_args(argv=None):
8083
def main() -> None:
8184
args, _unknown = parse_args()
8285

83-
# HiDPI pixmaps - always enabled in Qt 6 so no need to set it explicitly
84-
# QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps, True)
8586
logging.info("Starting DeepLabCut-Live GUI...")
86-
if not args.no_art:
87-
logging.info(art.build_help_description(desc="Welcome to DeepLabCut-Live GUI!"))
87+
88+
# If you want a startup banner, PRINT it (not log), and only in TTY contexts.
89+
if not args.no_art and sys.stdout.isatty() and art.terminal_is_wide_enough():
90+
try:
91+
print(art.build_help_description(desc="Welcome to DeepLabCut-Live GUI!"))
92+
except Exception:
93+
# Keep startup robust; don't fail if banner fails
94+
pass
8895

8996
app = QApplication(sys.argv)
9097
app.setWindowIcon(QIcon(LOGO))

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ exclude_lines = [
135135
]
136136
omit = [
137137
"tests/*",
138-
"dlclivegui/assets/*",
139138
]
140139
[tool.coverage.run]
141140
branch = true

0 commit comments

Comments
 (0)