maxson-gui-utils 0.1.2__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.
- maxson_gui_utils/VERSION +2 -0
- maxson_gui_utils/__init__.py +80 -0
- maxson_gui_utils/__main__.py +7 -0
- maxson_gui_utils/_version.py +23 -0
- maxson_gui_utils/cli.py +152 -0
- maxson_gui_utils/config.py +9 -0
- maxson_gui_utils/context.py +17 -0
- maxson_gui_utils/core.py +3 -0
- maxson_gui_utils/data/__init__.py +0 -0
- maxson_gui_utils/data/icons/max-green.icns +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_128x128.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_16x16.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_16x16@2x.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_256x256.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_256x256@2x.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_512x512.png +0 -0
- maxson_gui_utils/data/icons/max-green.iconset/icon_512x512@2x.png +0 -0
- maxson_gui_utils/data/icons/max-green_256x256.ico +0 -0
- maxson_gui_utils/data/icons/water-green.svg +7 -0
- maxson_gui_utils/data/icons/water-green_1024x1024.png +0 -0
- maxson_gui_utils/data/icons/water-green_256x256.png +0 -0
- maxson_gui_utils/data/themes/forest/__init__.py +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/border-accent-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/border-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/border-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/border-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/border-invalid.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/card.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-tri-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-tri-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-tri-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-unsel-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-unsel-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-unsel-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/check-unsel-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/combo-button-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/combo-button-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/combo-button-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/down.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/empty.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/hor-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/hor-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/hor-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/notebook.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/off-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/off-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/off-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/on-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/on-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/on-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-tri-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-tri-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-tri-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-unsel-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-unsel-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-unsel-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/radio-unsel-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/rect-accent-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/rect-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/rect-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/rect-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/right.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/scale-hor.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/scale-vert.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/separator.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/sizegrip.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/spin-button-down-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/spin-button-down-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/spin-button-up.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/tab-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/tab-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/tab-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-hor-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-hor-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-hor-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-vert-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-vert-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/thumb-vert-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/tree-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/tree-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/up.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/vert-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/vert-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark/vert-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-dark.tcl +536 -0
- maxson_gui_utils/data/themes/forest/forest-light/border-accent-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/border-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/border-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/border-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/border-invalid.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/card.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-tri-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-tri-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-tri-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-unsel-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-unsel-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-unsel-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/check-unsel-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/combo-button-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/combo-button-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/combo-button-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/down-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/down.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/empty.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/hor-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/hor-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/hor-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/notebook.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/off-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/off-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/off-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/on-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/on-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/on-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-tri-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-tri-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-tri-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-unsel-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-unsel-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-unsel-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/radio-unsel-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/rect-accent-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/rect-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/rect-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/rect-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/right-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/right.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/scale-hor.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/scale-vert.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/separator.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/sizegrip.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/spin-button-down-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/spin-button-down-focus.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/spin-button-up.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/tab-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/tab-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/tab-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-hor-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-hor-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-hor-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-vert-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-vert-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/thumb-vert-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/tree-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/tree-pressed.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/up.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/vert-accent.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/vert-basic.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light/vert-hover.png +0 -0
- maxson_gui_utils/data/themes/forest/forest-light.tcl +544 -0
- maxson_gui_utils/gui.py +191 -0
- maxson_gui_utils/helpers.py +3 -0
- maxson_gui_utils/logging_setup.py +177 -0
- maxson_gui_utils-0.1.2.dist-info/METADATA +45 -0
- maxson_gui_utils-0.1.2.dist-info/RECORD +171 -0
- maxson_gui_utils-0.1.2.dist-info/WHEEL +5 -0
- maxson_gui_utils-0.1.2.dist-info/entry_points.txt +3 -0
- maxson_gui_utils-0.1.2.dist-info/licenses/LICENSE +10 -0
- maxson_gui_utils-0.1.2.dist-info/top_level.txt +1 -0
maxson_gui_utils/VERSION
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# src/maxson_gui_utils/__init__.py
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
from ._version import __version__
|
|
8
|
+
|
|
9
|
+
# 1. Clean public-facing mapping
|
|
10
|
+
__all__ = [
|
|
11
|
+
"__version__",
|
|
12
|
+
|
|
13
|
+
"__gui_easteregg_enabled__",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _check_easteregg_env() -> bool:
|
|
18
|
+
"""Helper to dynamically read environment state at call-time."""
|
|
19
|
+
env_flag = os.environ.get("MGU_GUI_EASTEREGG", "").strip().lower()
|
|
20
|
+
return env_flag in ("true", "1", "yes", "on")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# 2. Fully dynamic attribute routing
|
|
24
|
+
def __getattr__(name: str):
|
|
25
|
+
|
|
26
|
+
# Dynamic boolean evaluation for the breadcrumb attribute
|
|
27
|
+
if name == "__gui_easteregg_enabled__":
|
|
28
|
+
return _check_easteregg_env()
|
|
29
|
+
|
|
30
|
+
# Dynamic lookups for the GUI function invocation
|
|
31
|
+
if name == "start_gui":
|
|
32
|
+
|
|
33
|
+
def _missing_gui():
|
|
34
|
+
raise RuntimeError(
|
|
35
|
+
"start_gui requires pyhabitat and a Tkinter-capable environment"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
_missing_gui.__name__ = "start_gui"
|
|
39
|
+
_missing_gui.__doc__ = (
|
|
40
|
+
"GUI support is unavailable in this environment."
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
if _check_easteregg_env():
|
|
44
|
+
try:
|
|
45
|
+
import pyhabitat
|
|
46
|
+
|
|
47
|
+
if pyhabitat.tkinter_is_available():
|
|
48
|
+
from .gui import start_gui
|
|
49
|
+
|
|
50
|
+
return start_gui
|
|
51
|
+
except ImportError:
|
|
52
|
+
pass
|
|
53
|
+
|
|
54
|
+
return _missing_gui
|
|
55
|
+
|
|
56
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
# 3. Dynamic introspection reflecting runtime changes
|
|
60
|
+
def __dir__():
|
|
61
|
+
exported = list(__all__)
|
|
62
|
+
if _check_easteregg_env():
|
|
63
|
+
exported.append("start_gui")
|
|
64
|
+
|
|
65
|
+
return sorted(
|
|
66
|
+
exported
|
|
67
|
+
+ [
|
|
68
|
+
"__builtins__",
|
|
69
|
+
"__cached__",
|
|
70
|
+
"__doc__",
|
|
71
|
+
"__file__",
|
|
72
|
+
"__getattr__",
|
|
73
|
+
"__dir__",
|
|
74
|
+
"__loader__",
|
|
75
|
+
"__name__",
|
|
76
|
+
"__package__",
|
|
77
|
+
"__path__",
|
|
78
|
+
"__spec__",
|
|
79
|
+
]
|
|
80
|
+
)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
# src/maxson_gui_utils/_version.py
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from .context import APP_NAME
|
|
5
|
+
def get_version() -> str:
|
|
6
|
+
try:
|
|
7
|
+
version_file = Path(__file__).parent / "VERSION"
|
|
8
|
+
if version_file.exists():
|
|
9
|
+
return version_file.read_text(encoding="utf-8").strip()
|
|
10
|
+
except Exception:
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
# Try metadata (Installed)
|
|
14
|
+
try:
|
|
15
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
16
|
+
return version(APP_NAME)
|
|
17
|
+
except (ImportError, PackageNotFoundError):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
return "0.0.0-unknown"
|
|
22
|
+
|
|
23
|
+
__version__ = get_version()
|
maxson_gui_utils/cli.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# src/maxson_gui_utils/cli.py
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
import os
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
import pyhabitat
|
|
11
|
+
import typer
|
|
12
|
+
from typer.models import OptionInfo
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from typer_helptree import add_typer_helptree
|
|
15
|
+
|
|
16
|
+
from ._version import __version__
|
|
17
|
+
from .context import APP_NAME, DESCRIPTION_STR
|
|
18
|
+
from .logging_setup import (
|
|
19
|
+
configure_logging_all_debug,
|
|
20
|
+
configure_logging_for_application,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
console_stderr = Console(stderr=True)
|
|
26
|
+
console_stdout = Console()
|
|
27
|
+
|
|
28
|
+
# Force Rich to always enable colors, even when running from a .pyz bundle.
|
|
29
|
+
os.environ["FORCE_COLOR"] = "1"
|
|
30
|
+
|
|
31
|
+
# Optional but helpful for full terminal feature detection.
|
|
32
|
+
os.environ["TERM"] = "xterm-256color"
|
|
33
|
+
|
|
34
|
+
app = typer.Typer(
|
|
35
|
+
name=APP_NAME,
|
|
36
|
+
help=f"{DESCRIPTION_STR} (v{__version__})",
|
|
37
|
+
add_completion=False,
|
|
38
|
+
invoke_without_command=True,
|
|
39
|
+
no_args_is_help=True,
|
|
40
|
+
context_settings={
|
|
41
|
+
"ignore_unknown_options": True,
|
|
42
|
+
"allow_extra_args": True,
|
|
43
|
+
"help_option_names": ["-h", "--help"],
|
|
44
|
+
},
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@app.callback(invoke_without_command=True)
|
|
49
|
+
def main(
|
|
50
|
+
ctx: typer.Context,
|
|
51
|
+
version: bool = typer.Option(
|
|
52
|
+
False,
|
|
53
|
+
"--version",
|
|
54
|
+
"-V",
|
|
55
|
+
help="Show application version and exit.",
|
|
56
|
+
),
|
|
57
|
+
debug: bool = typer.Option(
|
|
58
|
+
False,
|
|
59
|
+
"--debug",
|
|
60
|
+
"-d",
|
|
61
|
+
help="Enable debug level logs for app.",
|
|
62
|
+
),
|
|
63
|
+
all_debug: bool = typer.Option(
|
|
64
|
+
False,
|
|
65
|
+
"--all-debug",
|
|
66
|
+
help="Enable debug logs for app AND dependencies.",
|
|
67
|
+
),
|
|
68
|
+
verbose: bool = typer.Option(
|
|
69
|
+
False,
|
|
70
|
+
"--verbose",
|
|
71
|
+
"-v",
|
|
72
|
+
help="Enable verbose info level logs.",
|
|
73
|
+
),
|
|
74
|
+
log_file: Path | None = typer.Option(
|
|
75
|
+
None,
|
|
76
|
+
"--log-file",
|
|
77
|
+
help="Custom path to output log file.",
|
|
78
|
+
),
|
|
79
|
+
):
|
|
80
|
+
if version:
|
|
81
|
+
typer.echo(__version__)
|
|
82
|
+
raise typer.Exit()
|
|
83
|
+
|
|
84
|
+
if all_debug:
|
|
85
|
+
configure_logging_all_debug()
|
|
86
|
+
else:
|
|
87
|
+
configure_logging_for_application(
|
|
88
|
+
debug=debug,
|
|
89
|
+
verbose=verbose,
|
|
90
|
+
log_to_file=log_file is not None,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
logger.debug("Executing command: %s", " ".join(sys.argv))
|
|
94
|
+
|
|
95
|
+
if ctx.invoked_subcommand is None and not ctx.resilient_parsing:
|
|
96
|
+
typer.echo(ctx.get_help())
|
|
97
|
+
raise typer.Exit()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
add_typer_helptree(
|
|
101
|
+
app=app,
|
|
102
|
+
console=console_stderr,
|
|
103
|
+
version=__version__,
|
|
104
|
+
hidden=False,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
@app.command(name="gui")
|
|
108
|
+
def gui_command(
|
|
109
|
+
auto_close: int = typer.Option(0,
|
|
110
|
+
"--auto-close", "-c",
|
|
111
|
+
help = "Delay in milliseconds after which the GUI window will close (for automated testing). Use 0 to disable auto-closing.",
|
|
112
|
+
min=0)
|
|
113
|
+
)->None:
|
|
114
|
+
"""
|
|
115
|
+
Launch tkinter-based GUI.
|
|
116
|
+
"""
|
|
117
|
+
assured_auto_close_value = 0
|
|
118
|
+
|
|
119
|
+
# --- Helper, consistent gui failure message. ---
|
|
120
|
+
def _gui_failure_msg():
|
|
121
|
+
console_stderr.print("[bold red]GUI failed to launch[/bold red]")
|
|
122
|
+
console_stderr.print("Use 'pdflinkcheck analyze CLI' instead.")
|
|
123
|
+
console_stderr.print(f"pyhabitat.tkinter_is_available() = {pyhabitat.tkinter_is_available()}")
|
|
124
|
+
console_stderr.print(f"pyhabitat.on_termux() = {pyhabitat.on_termux()}")
|
|
125
|
+
|
|
126
|
+
if isinstance(auto_close, OptionInfo):
|
|
127
|
+
# Case 1: Called implicitly from main() (pdflinkcheck with no args)
|
|
128
|
+
# We received the metadata object, so use the function's default value (0).
|
|
129
|
+
# We don't need to do anything here since final_auto_close_value is already 0.
|
|
130
|
+
pass
|
|
131
|
+
else:
|
|
132
|
+
# Case 2: Called explicitly by Typer (pdflinkcheck gui -c 3000)
|
|
133
|
+
# Typer has successfully converted the command line argument, and auto_close is an int.
|
|
134
|
+
assured_auto_close_value = int(auto_close)
|
|
135
|
+
|
|
136
|
+
if not pyhabitat.tkinter_is_available():
|
|
137
|
+
_gui_failure_msg()
|
|
138
|
+
return
|
|
139
|
+
|
|
140
|
+
from .gui import start_gui
|
|
141
|
+
start_gui(time_auto_close = assured_auto_close_value)
|
|
142
|
+
|
|
143
|
+
@app.command(name="placeholder")
|
|
144
|
+
def placeholder(
|
|
145
|
+
path: Path = Path("path"),
|
|
146
|
+
):
|
|
147
|
+
"""Placeholder."""
|
|
148
|
+
console_stderr.print(f"{path=}")
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
if __name__ == "__main__":
|
|
152
|
+
app()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# src/maxson_gui_utils/context.py
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
PACKAGE_DIR = Path(__file__).resolve().parent
|
|
7
|
+
SRC_DIR = PACKAGE_DIR.parent
|
|
8
|
+
PROJECT_ROOT = SRC_DIR.parent
|
|
9
|
+
|
|
10
|
+
APP_NAME = "maxson-gui-utils"
|
|
11
|
+
APP_NAME_PRETTY = "Maxson Gui Utils"
|
|
12
|
+
IMPORT_NAME = "maxson_gui_utils"
|
|
13
|
+
SRC_FOLDER_NAME = "maxson_gui_utils"
|
|
14
|
+
DESCRIPTION_STR = "A Python application."
|
|
15
|
+
APP_DIR = Path.home() / ".maxson-gui-utils"
|
|
16
|
+
LOG_FILE_PATH = "/home/oolong/.maxson-gui-utils/maxson-gui-utils.log"
|
|
17
|
+
SERVICE = APP_NAME
|
maxson_gui_utils/core.py
ADDED
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
2
|
+
|
|
3
|
+
<svg version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="800px" height="800px" viewBox="0 0 512 512" xml:space="preserve" fill="#1b6333">
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|