descriptron-gui 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
descriptron_gui/cli.py ADDED
@@ -0,0 +1,41 @@
1
+ """
2
+ descriptron_gui.cli — launch the annotation GUI
3
+ ===============================================
4
+
5
+ The GUI drives the analysis programs directly, so this package depends on core
6
+ *and* vision; it is not a thin front end over them.
7
+
8
+ tkinter is in the standard library but is not always packaged with Python on
9
+ Linux, so a missing import is caught here and explained rather than presented as
10
+ a traceback.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import os
15
+ import runpy
16
+ import sys
17
+ from importlib.resources import files
18
+ from pathlib import Path
19
+
20
+
21
+ def main() -> None:
22
+ try:
23
+ import tkinter # noqa: F401
24
+ except ImportError as exc:
25
+ raise SystemExit(
26
+ "tkinter is missing. It ships with Python on Windows and macOS; on Linux:\n"
27
+ " Debian/Ubuntu: sudo apt install python3-tk\n"
28
+ " Fedora/RHEL: sudo dnf install python3-tkinter\n"
29
+ f"(original error: {exc})") from exc
30
+
31
+ tools = Path(str(files("descriptron_gui") / "tools"))
32
+ candidates = sorted(tools.glob("descriptron-v2-*.py"), reverse=True)
33
+ if not candidates:
34
+ raise SystemExit(f"no GUI program found in {tools} — "
35
+ "was sync_sources.py run before building?")
36
+ path = candidates[0]
37
+ sys.path.insert(0, str(tools))
38
+ os.environ.setdefault("DESCRIPTRON_GUI_DATA",
39
+ str(Path(str(files("descriptron_gui") / "data"))))
40
+ sys.argv = [str(path), *sys.argv[1:]]
41
+ runpy.run_path(str(path), run_name="__main__")
Binary file