artemis_framework 0.4.0__tar.gz → 0.4.1__tar.gz

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.
Files changed (29) hide show
  1. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/PKG-INFO +1 -1
  2. artemis_framework-0.4.1/artemis_framework/asphodel/tui/widgets/operation_log.py +115 -0
  3. artemis_framework-0.4.1/artemis_framework/elysium/__init__.py +0 -0
  4. artemis_framework-0.4.1/artemis_framework/tartarus/__init__.py +0 -0
  5. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/pyproject.toml +1 -1
  6. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/LICENSE +0 -0
  7. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/README.md +0 -0
  8. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/__init__.py +0 -0
  9. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/__main__.py +0 -0
  10. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/__init__.py +0 -0
  11. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/__main__.py +0 -0
  12. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/__init__.py +0 -0
  13. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/_gpg_binary.py +0 -0
  14. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/armor_binary.py +0 -0
  15. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/encrypt_decrypt.py +0 -0
  16. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/gpg_context.py +0 -0
  17. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/key_management.py +0 -0
  18. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/macos_shim.py +0 -0
  19. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/core/sign_verify.py +0 -0
  20. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/__init__.py +0 -0
  21. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/app.py +0 -0
  22. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/modals/__init__.py +0 -0
  23. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/screens/__init__.py +0 -0
  24. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/screens/app_config.py +0 -0
  25. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/settings.py +0 -0
  26. {artemis_framework-0.4.0 → artemis_framework-0.4.1}/artemis_framework/asphodel/tui/widgets/__init__.py +0 -0
  27. /artemis_framework-0.4.0/artemis_framework/elysium/__ini → /artemis_framework-0.4.1/artemis_framework/asphodel/tui/widgets/key_detail.py +0 -0
  28. /artemis_framework-0.4.0/artemis_framework/elysium/__init__.py → /artemis_framework-0.4.1/artemis_framework/asphodel/tui/widgets/key_list.py +0 -0
  29. /artemis_framework-0.4.0/artemis_framework/tartarus/__init__.py → /artemis_framework-0.4.1/artemis_framework/elysium/__ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: artemis_framework
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: A package for doing great things!
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -0,0 +1,115 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from pathlib import Path
5
+ from typing import Literal
6
+
7
+ from rich.text import Text
8
+ from textual.app import ComposeResult
9
+ from textual.binding import Binding
10
+ from textual.widgets import RichLog
11
+
12
+
13
+ Level = Literal["OK", "ERR", "WARN", "INFO"]
14
+
15
+
16
+ _LEVEL_STYLE: dict[str, tuple[str, str]] = {
17
+ "OK": ("[OK] ", "green"),
18
+ "ERR": ("[ERR] ", "bold red"),
19
+ "WARN": ("[WARN] ", "yellow"),
20
+ "INFO": ("[INFO] ", "dim white"),
21
+ }
22
+
23
+ _LEVEL_ALIASES: dict[str, str] = {
24
+ "ok": "OK",
25
+ "err": "ERR",
26
+ "error": "ERR",
27
+ "warn": "WARN",
28
+ "warning": "WARN",
29
+ "info": "INFO",
30
+ }
31
+
32
+
33
+ def _normalize_level(level: str) -> str:
34
+ return _LEVEL_ALIASES.get(level.lower(), _LEVEL_ALIASES.get(level, "INFO"))
35
+
36
+
37
+ class OperationLogWidget(RichLog):
38
+ DEFAULT_CSS = ""
39
+ COMPONENT_CLASSES = {"operation-log"}
40
+
41
+ def __init__(self, **kwargs) -> None:
42
+ super().__init__(
43
+ highlight=False,
44
+ markup=False,
45
+ wrap=True,
46
+ **kwargs
47
+ )
48
+ self._plain_lines: list[str] = []
49
+
50
+ def log(self, message: str, level: str = "INFO") -> None:
51
+ canonical = _normalize_level(level)
52
+ prefix, color = _LEVEL_STYLE[canonical]
53
+ timestamp = _timestamp()
54
+
55
+ line = Text()
56
+ line.append(timestamp, style="dim")
57
+ line.append(" "*3)
58
+ line.append(prefix, style=color)
59
+ line.append(" "*3)
60
+ line.append(message, style=color if canonical == "ERR" else "")
61
+
62
+ plain = f"[{timestamp}] {prefix} {message}"
63
+ self._plain_lines.append(plain)
64
+
65
+ self.write(line)
66
+
67
+ def log_result(
68
+ self,
69
+ ok: bool,
70
+ label: str,
71
+ detail: str | None = None
72
+ ) -> None:
73
+ self.log(label, level="OK" if ok else "ERR")
74
+ if detail:
75
+ self.log(detail, level="INFO")
76
+
77
+ def log_separator(self, label: str = "") -> None:
78
+ width = 60
79
+ if label:
80
+ pad = max(0, (width - len(label) - 2) // 2)
81
+ text = f"{'-' * pad} {label} {'-'* pad}"
82
+ else:
83
+ text = "-" * width
84
+
85
+ line = Text(text, style="dim")
86
+ self._plain_lines.append(text)
87
+ self.write(line)
88
+
89
+ def clear(self) -> None:
90
+ super().clear()
91
+ self._plain_lines.clear()
92
+
93
+ def save(self, path: Path | str | None = None) -> Path | None:
94
+ if not self._plain_lines:
95
+ self.log("Log is empty - nothing to save.", level="WARN")
96
+ return None
97
+
98
+ if path is None:
99
+ stamp = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
100
+ path = Path.cwd() / f"asphodel_pgp_log_{stamp}.log"
101
+
102
+ dest = Path(path)
103
+ try:
104
+ dest.parent.mkdir(parents=True, exist_ok=True)
105
+ dest.write_text("\n".join(self._plain_lines) + "\n", encoding="utf-8")
106
+
107
+ self.log(f"Log saved » {dest}", level="OK")
108
+ return dest
109
+ except OSError as exc:
110
+ self.log(f"Failed to save log: {exc}", level="ERR")
111
+ return None
112
+
113
+
114
+ def _timestamp() -> str:
115
+ return datetime.datetime.now().strftime("%H:%M:%S")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "artemis_framework"
3
- version = "0.4.0"
3
+ version = "0.4.1"
4
4
  description = "A package for doing great things!"
5
5
  authors = ["Dylan Garrett"]
6
6
  license = "MIT"