summaryrefslogtreecommitdiff
path: root/src/streamml/app.py
diff options
context:
space:
mode:
authorEnricoGuccii <partyka.003@proton.me>2026-01-10 22:43:36 +0100
committerEnricoGuccii <partyka.003@proton.me>2026-01-10 22:43:36 +0100
commit6d7410e286ce0fde31f89185c095fe90e85597f3 (patch)
tree5092c99d353382a71f00d8fe18d53b8073cf3f58 /src/streamml/app.py
parentc2f5fbe7fb93ce420caf23c5c0e06144cf953bb8 (diff)
bloat removed
Diffstat (limited to 'src/streamml/app.py')
-rw-r--r--src/streamml/app.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/streamml/app.py b/src/streamml/app.py
new file mode 100644
index 0000000..4c7d1aa
--- /dev/null
+++ b/src/streamml/app.py
@@ -0,0 +1,60 @@
+from textual.app import App, ComposeResult
+from textual.widgets import TabbedContent, TabPane
+from textual.theme import Theme
+
+from pathlib import Path
+import os
+
+from .front.detector_tab import DetectorTab
+from .front.detector_profiles_tab import DetectorProfilesTab
+from .front.options_tab import OptionsTab
+
+from .back.detector_profiles_manager import DetectorProfilesManager
+
+
+XDG_DATA_HOME = Path(os.environ.get("XDG_DATA_HOME", Path.home() / ".local/share"))
+
+theme = Theme(
+ name="pastel_blue_theme",
+ primary="#82A6F2",
+ secondary="#778899",
+ accent="#E0FFFF",
+ # background="#1a1b26",
+ surface="#1e1e20",
+ error="#ffb3ba",
+ success="#baffc9",
+ warning="#ffffba",
+)
+
+class Streamml(App):
+ CSS_PATH = "styles/styles.css"
+
+ def __init__(self):
+ super().__init__()
+ self.detector_profiles_manager = DetectorProfilesManager(profiles_file=f"{XDG_DATA_HOME}/netmonitor/objects/detector_profiles_objects")
+
+ def compose(self) -> ComposeResult:
+ with TabbedContent():
+ with TabPane(title="Detector", id="detector", classes="detector-theme"):
+ with TabbedContent():
+ with TabPane(title="Models"):
+ yield DetectorTab(self.manager.detector_profiles_manager)
+ with TabPane(title="Profiles"):
+ yield DetectorProfilesTab(self.manager.detector_profiles_manager)
+
+ with TabPane(title="Options", id="options", classes="options-theme"):
+ yield OptionsTab(self.detector_profiles_manager)
+
+ def on_mount(self):
+ self.register_theme(theme)
+ self.theme = "pastel_blue_theme"
+
+ @property
+ def manager(self):
+ return self
+
+def main():
+ Streamml().run()
+
+if __name__ == "__main__":
+ main()