Stufe 1: Hauptreiter FUNK und AKTE, Stil in theme.py (3.4)
- Farben, Schriften, ttk-Stil und Pegelanzeige liegen jetzt in theme.py, damit mehrere Module denselben Stil nutzen, ohne sich gegenseitig zu importieren - Zwei Reiterebenen: FUNK (Mikrofon, Tasten und Verhalten) und AKTE; die Statusleiste bleibt fuer alle Module sichtbar - Zuletzt gewaehlter Hauptreiter wird gespeichert - akte.py als Platzhalter, damit das Update 3.3 -> 3.4 bereits neue Dateien mitliefert - clam-Innenabstand fuer gewaehlte Hauptreiter festgesetzt, die Schrift sprang sonst um 4 Pixel - Build nimmt theme.py und akte.py mit; Doku nachgezogen Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
ae30f47ba5
commit
f49e9a3ed0
8 changed files with 295 additions and 189 deletions
26
PLAN-AKTE.md
26
PLAN-AKTE.md
|
|
@ -1,6 +1,6 @@
|
|||
# Plan: Modul „Akte"
|
||||
|
||||
Stand: 10. September 2026 · Entwurf, noch nicht umgesetzt
|
||||
Stand: 10. September 2026 · Stufe 0 und 1 umgesetzt, Stufe 2 folgt
|
||||
|
||||
Eine Personalakte für den eigenen Squad-Charakter: Name, Callsign, Rang,
|
||||
Porträt, Nation, Teilstreitkraft, Einheit, Werdegang. Reines Rollenspiel —
|
||||
|
|
@ -147,7 +147,7 @@ Eine Akte ist ein Ordner mit JSON-Datei und Porträt:
|
|||
| Stufe | Inhalt | Umfang |
|
||||
|---|---|---|
|
||||
| **0** | Fehlende Pakete werden beim Start nachinstalliert — **erledigt in 3.3** | klein |
|
||||
| **1** | `theme.py` auslagern, Hauptreiter *Funk* / *Akte*, Akte noch leer — Version 3.4 | mittel |
|
||||
| **1** | `theme.py` auslagern, Hauptreiter *Funk* / *Akte*, Akte noch leer — **erledigt in 3.4** | mittel |
|
||||
| **2** | Akte vollständig: Liste, Formular, Dokumentansicht, Porträt, Vorbelegungen — Version 4.0 | groß |
|
||||
| **3** | Teilen: Akte als PNG-Karte für Discord, Export/Import als `.akte`-Datei | mittel |
|
||||
|
||||
|
|
@ -181,17 +181,19 @@ erweitern, falls du dafür wieder Claude Design einsetzen willst.
|
|||
|
||||
---
|
||||
|
||||
## 7. Zu entscheiden
|
||||
## 7. Entscheidungen (10. September 2026)
|
||||
|
||||
Mit meiner Empfehlung, damit Stufe 2 ohne Rückfragen durchlaufen kann:
|
||||
|
||||
1. **Mehrere Akten pro Person?** — Ja.
|
||||
2. **Vorbelegungen für welche Nationen zuerst?** — Die Squad-Fraktionen.
|
||||
Wenn eure Gruppe eine bestimmte Armee spielt, etwa die Bundeswehr, die
|
||||
zusätzlich.
|
||||
3. **Teilen mit Freunden wichtig?** — Stufe 3 als PNG-Karte ist der
|
||||
einfachste Weg mit dem meisten Effekt, weil sie direkt in Discord landet.
|
||||
4. **Online-Akten?** — Erst einmal nicht, siehe oben.
|
||||
1. **Mehrere Akten pro Person** — ja.
|
||||
2. **Vorbelegungen für Fraktion und Rang:** alle Squad-Fraktionen, dazu
|
||||
Bundeswehr, Frankreich, Spanien, Italien und Island. Freitext bleibt
|
||||
überall möglich.
|
||||
*Island hat keine Armee*, nur Küstenwache (Landhelgisgæslan) und die
|
||||
Krisenreaktionseinheit. Vorbelegt werden die Dienstgrade der
|
||||
Küstenwache, sofern die Gruppe kein fiktives Island spielt.
|
||||
3. **Teilen:** PNG-Karte für Discord (Stufe 3). Keine Import-Datei.
|
||||
4. **Gestaltung:** im bestehenden Stil, ohne vorherigen Entwurf in Claude
|
||||
Design.
|
||||
5. **Online-Akten:** vorerst nicht.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Projektübergabe: Squad Manager
|
||||
|
||||
Stand: 10. September 2026 · Version 3.2 · Git-Repository im Quellordner
|
||||
Stand: 10. September 2026 · Version 3.4 · Git-Repository im Quellordner
|
||||
|
||||
Seit 3.2 wird über einen Inno-Setup-Installer und einen eingebauten
|
||||
Auto-Updater verteilt (Server: https://sva.tyrveil.com), siehe Abschnitt 4.
|
||||
|
|
@ -38,13 +38,15 @@ und aller Dokumente ist Deutsch.
|
|||
Es gibt drei getrennte Orte. Das zu verwechseln war bereits mehrfach die
|
||||
Fehlerquelle.
|
||||
|
||||
### `C:\Users\danie\Downloads\squad-manager\` — Quelle
|
||||
### `C:\Users\danie\Desktop\squad-manager\` — Quelle
|
||||
|
||||
Arbeitsverzeichnis. Hier wird entwickelt. Der Code enthält hier
|
||||
**Kommentare**, und Texte stehen teils in Ersatzschreibung („Haelt").
|
||||
|
||||
```
|
||||
squad_manager.py Hauptprogramm, rund 1600 Zeilen, eine Datei
|
||||
squad_manager.py Hauptfenster, Funk-Modul, Updater (~1500 Zeilen)
|
||||
theme.py Farben, Schriften, ttk-Stil, Pegelanzeige
|
||||
akte.py Modul Akte (seit 3.4, noch Platzhalter)
|
||||
start.pyw Startskript ohne Konsolenfenster
|
||||
make_icon.py erzeugt icon.ico aus icon.png
|
||||
icon.png / icon.ico Programmsymbol (vom Nutzer geliefert)
|
||||
|
|
@ -101,8 +103,13 @@ frisch.
|
|||
|
||||
## 3. Aufbau des Programms
|
||||
|
||||
Eine einzelne Datei, `tkinter`/`ttk`, keine Klassenhierarchie außer der
|
||||
Hauptklasse `VoiceActivationApp`.
|
||||
Drei Dateien, `tkinter`/`ttk`: `squad_manager.py` mit Hauptfenster,
|
||||
Funk-Modul und Updater (Hauptklasse `VoiceActivationApp`), `theme.py` mit
|
||||
dem Stil und `akte.py` mit dem Modul Akte. `theme.py` gibt es, damit
|
||||
`akte.py` die Farben nicht aus `squad_manager.py` holen muss — das wäre
|
||||
ein zirkulärer Import, weil `squad_manager.py` die Akte einbindet.
|
||||
Weitere Module gehören ebenfalls flach daneben: Installer, Update-Paket
|
||||
und `start.pyw` erwarten flache Dateien.
|
||||
|
||||
**Ablauf:** `sounddevice.InputStream` liefert Audioblöcke an einen
|
||||
Callback, der den RMS-Pegel berechnet und in eine Queue legt. Ein
|
||||
|
|
@ -126,14 +133,17 @@ gerade nicht gesendet werden darf, oder einen leeren String. Reihenfolge:
|
|||
| `enumerate_inputs()` | Geräteliste, siehe Erkenntnis 5 |
|
||||
| `squad_focused()` | Prozessname des Vordergrundfensters prüfen |
|
||||
| `send_binding()` | Taste plus Zusatztaste drücken/lösen |
|
||||
| `apply_tactical_theme()` | dunkles Farbschema |
|
||||
| `LevelMeter` | segmentierte Pegelanzeige mit Schwellenmarke |
|
||||
| `apply_tactical_theme()` | dunkles Farbschema (`theme.py`) |
|
||||
| `LevelMeter` | segmentierte Pegelanzeige mit Schwellenmarke (`theme.py`) |
|
||||
| `set_dark_titlebar()` | Fenstertitelleiste dunkel |
|
||||
| `arm_autosave()` | speichert Einstellungen 600 ms nach jeder Änderung |
|
||||
|
||||
**Oberfläche:** Zwei Reiter („Mikrofon", „Tasten und Verhalten") plus eine
|
||||
**Oberfläche:** Zwei Hauptreiter, *FUNK* (mit den Unterreitern „Mikrofon"
|
||||
und „Tasten und Verhalten") und *AKTE*. Darunter für alle Module die
|
||||
Statusleiste mit den Knöpfen und der Zustandsanzeige (BEREITSCHAFT /
|
||||
HORCHT / SENDET / GESPERRT).
|
||||
HORCHT / SENDET / GESPERRT) — die Sprachaktivierung läuft weiter, während
|
||||
man in einem anderen Modul arbeitet. Der zuletzt gewählte Hauptreiter
|
||||
steht als `modul` in der `config.json`.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ Technische Dokumentation und alle bekannten Fallstricke:
|
|||
|
||||
| Pfad | Zweck |
|
||||
|---|---|
|
||||
| `squad_manager.py` | Hauptprogramm |
|
||||
| `squad_manager.py` | Hauptfenster, Funk-Modul, Updater |
|
||||
| `theme.py` | Farben, Schriften, Stil, Pegelanzeige |
|
||||
| `akte.py` | Modul Akte (in Arbeit, siehe `PLAN-AKTE.md`) |
|
||||
| `start.pyw` | Startskript ohne Konsolenfenster |
|
||||
| `make_icon.py` | erzeugt `icon.ico` aus `icon.png` |
|
||||
| `icon.png`, `icon.ico` | Programmsymbol |
|
||||
|
|
|
|||
35
akte.py
Normal file
35
akte.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
"""
|
||||
Modul Akte: Personalakten fuer Rollenspiel-Charaktere.
|
||||
|
||||
Stufe 1 (Version 3.4) schafft nur den Platz in der Oberflaeche. Datenmodell,
|
||||
Speicherung und Dokumentansicht folgen in Stufe 2, siehe PLAN-AKTE.md.
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
from theme import BG, AMBER
|
||||
|
||||
|
||||
class AkteSeite(ttk.Frame):
|
||||
"""Inhalt des Hauptreiters AKTE."""
|
||||
|
||||
def __init__(self, master):
|
||||
super().__init__(master)
|
||||
mitte = ttk.Frame(self)
|
||||
mitte.place(relx=0.5, rely=0.42, anchor="center")
|
||||
|
||||
stempel = tk.Canvas(mitte, width=300, height=86, bg=BG,
|
||||
highlightthickness=0)
|
||||
stempel.pack(pady=(0, 20))
|
||||
stempel.create_rectangle(8, 8, 292, 78, outline=AMBER, width=3)
|
||||
stempel.create_rectangle(15, 15, 285, 71, outline=AMBER, width=1)
|
||||
stempel.create_text(150, 43, text="PERSONALAKTE", fill=AMBER,
|
||||
font=("Consolas", 20, "bold"))
|
||||
|
||||
ttk.Label(mitte, text="In Vorbereitung",
|
||||
font=("Segoe UI Semibold", 12)).pack()
|
||||
ttk.Label(mitte, style="Dim.TLabel", justify="center",
|
||||
text="Hier entsteht die Personalakte für deine Charaktere:\n"
|
||||
"Porträt, Dienstgrad, Einheit, Auszeichnungen und "
|
||||
"Werdegang.").pack(pady=(6, 0))
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
; Uebersetzen mit: ISCC.exe setup.iss
|
||||
|
||||
#define Name "Squad Manager"
|
||||
#define Version "3.3"
|
||||
#define Version "3.4"
|
||||
#define Herausgeber "tyrveil.com"
|
||||
#define Website "https://sva.tyrveil.com"
|
||||
|
||||
|
|
|
|||
199
squad_manager.py
199
squad_manager.py
|
|
@ -50,8 +50,16 @@ from tkinter import ttk, messagebox # noqa: E402
|
|||
import numpy as np # noqa: E402
|
||||
import sounddevice as sd # noqa: E402
|
||||
|
||||
from theme import ( # noqa: E402
|
||||
BG, PANEL, PANEL_HI, LINE, FG, FG_DIM, OLIVE, OLIVE_HI, AMBER,
|
||||
AMBER_HELL, AMBER_DUNKEL, RED, GREEN_TX,
|
||||
FONT_UI, FONT_BOLD, FONT_TITLE, FONT_MONO, FONT_STATUS,
|
||||
apply_tactical_theme, LevelMeter,
|
||||
)
|
||||
import akte # noqa: E402
|
||||
|
||||
APP_NAME = "Squad Manager"
|
||||
VERSION = "3.3"
|
||||
VERSION = "3.4"
|
||||
CONFIG_PATH = Path(os.getenv("APPDATA", ".")) / "SquadManager" / "config.json"
|
||||
LOG_PATH = CONFIG_PATH.parent / "error.log"
|
||||
# Bis Version 3.2 hiess das Programm "Squad Voice Activation"
|
||||
|
|
@ -432,166 +440,6 @@ def get_foreground_process_name():
|
|||
kernel32.CloseHandle(handle)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Erscheinungsbild - gedeckte Militaerfarben, dunkler Untergrund
|
||||
# ---------------------------------------------------------------------------
|
||||
BG = "#151814" # Fensterhintergrund, fast schwarz mit Gruenstich
|
||||
PANEL = "#1e231b" # Flaechen, Eingabefelder
|
||||
PANEL_HI = "#2a3125" # Hover, ausgewaehlter Reiter
|
||||
LINE = "#3d4634" # Rahmen und Trennlinien
|
||||
FG = "#c9cec0" # Standardtext, helles Khaki
|
||||
FG_DIM = "#7f8874" # Nebentext
|
||||
OLIVE = "#6e8b3d" # Akzent, Fortschritt
|
||||
OLIVE_HI = "#8cb04d" # heller Akzent
|
||||
AMBER = "#d9a441" # Hinweise, Schwellenmarke
|
||||
AMBER_HELL = "#e8bb63" # Mauskontakt auf der Hinweisleiste
|
||||
AMBER_DUNKEL = "#2b2416" # Untergrund der Hinweisleiste
|
||||
RED = "#b4472f" # Sperre, Fehler
|
||||
GREEN_TX = "#9ed23f" # Sendebereit
|
||||
|
||||
FONT_UI = ("Segoe UI", 9)
|
||||
FONT_BOLD = ("Segoe UI Semibold", 9)
|
||||
FONT_TITLE = ("Segoe UI", 17, "bold")
|
||||
FONT_MONO = ("Consolas", 9)
|
||||
FONT_STATUS = ("Consolas", 13, "bold")
|
||||
|
||||
|
||||
def apply_tactical_theme(root):
|
||||
"""Dunkles, gedecktes Farbschema im Stil der Spieloberflaeche."""
|
||||
root.configure(bg=BG)
|
||||
style = ttk.Style(root)
|
||||
# "clam" ist das einzige mitgelieferte Thema, das sich durchgaengig
|
||||
# umfaerben laesst - "vista" ignoriert die meisten Farbangaben.
|
||||
style.theme_use("clam")
|
||||
|
||||
style.configure(".", background=BG, foreground=FG, font=FONT_UI,
|
||||
bordercolor=LINE, darkcolor=PANEL, lightcolor=PANEL,
|
||||
troughcolor=PANEL, focuscolor=OLIVE)
|
||||
style.configure("TFrame", background=BG)
|
||||
style.configure("TLabel", background=BG, foreground=FG)
|
||||
style.configure("Dim.TLabel", foreground=FG_DIM)
|
||||
style.configure("Mono.TLabel", font=FONT_MONO, foreground=FG)
|
||||
style.configure("Title.TLabel", font=FONT_TITLE, foreground=FG)
|
||||
style.configure("Sub.TLabel", foreground=FG_DIM)
|
||||
|
||||
style.configure("TLabelframe", background=BG, bordercolor=LINE,
|
||||
relief="solid", borderwidth=1)
|
||||
style.configure("TLabelframe.Label", background=BG, foreground=OLIVE_HI,
|
||||
font=FONT_BOLD)
|
||||
|
||||
style.configure("TButton", background=PANEL, foreground=FG,
|
||||
bordercolor=LINE, relief="solid", borderwidth=1,
|
||||
padding=(12, 6), font=FONT_UI)
|
||||
style.map("TButton",
|
||||
background=[("pressed", OLIVE), ("active", PANEL_HI),
|
||||
("disabled", PANEL)],
|
||||
foreground=[("disabled", FG_DIM)],
|
||||
bordercolor=[("active", OLIVE)])
|
||||
|
||||
style.configure("Accent.TButton", background=OLIVE, foreground="#12150f",
|
||||
font=FONT_BOLD, bordercolor=OLIVE_HI)
|
||||
style.map("Accent.TButton",
|
||||
background=[("pressed", OLIVE), ("active", OLIVE_HI),
|
||||
("disabled", PANEL)],
|
||||
foreground=[("disabled", FG_DIM)])
|
||||
|
||||
for widget in ("TCombobox", "TSpinbox", "TEntry"):
|
||||
style.configure(widget, fieldbackground=PANEL, background=PANEL,
|
||||
foreground=FG, bordercolor=LINE, arrowcolor=OLIVE_HI,
|
||||
insertcolor=FG, selectbackground=OLIVE,
|
||||
selectforeground="#12150f", padding=4)
|
||||
style.map(widget,
|
||||
fieldbackground=[("readonly", PANEL), ("disabled", BG)],
|
||||
foreground=[("disabled", FG_DIM)],
|
||||
bordercolor=[("focus", OLIVE)])
|
||||
# Die aufklappende Liste einer Combobox ist ein klassisches Tk-Widget
|
||||
# und muss ueber die Optionsdatenbank eingefaerbt werden.
|
||||
root.option_add("*TCombobox*Listbox.background", PANEL)
|
||||
root.option_add("*TCombobox*Listbox.foreground", FG)
|
||||
root.option_add("*TCombobox*Listbox.selectBackground", OLIVE)
|
||||
root.option_add("*TCombobox*Listbox.selectForeground", "#12150f")
|
||||
root.option_add("*TCombobox*Listbox.font", FONT_UI)
|
||||
|
||||
style.configure("TCheckbutton", background=BG, foreground=FG,
|
||||
indicatorcolor=PANEL, indicatorrelief="solid")
|
||||
style.map("TCheckbutton",
|
||||
background=[("active", BG)],
|
||||
indicatorcolor=[("selected", OLIVE_HI), ("active", PANEL_HI)],
|
||||
foreground=[("disabled", FG_DIM)])
|
||||
|
||||
style.configure("TNotebook", background=BG, bordercolor=LINE,
|
||||
tabmargins=(2, 4, 2, 0))
|
||||
style.configure("TNotebook.Tab", background="#10120f", foreground=FG_DIM,
|
||||
bordercolor=LINE, lightcolor="#10120f",
|
||||
darkcolor="#10120f", padding=(20, 9), font=FONT_BOLD)
|
||||
style.map("TNotebook.Tab",
|
||||
background=[("selected", PANEL_HI), ("active", PANEL)],
|
||||
lightcolor=[("selected", PANEL_HI)],
|
||||
darkcolor=[("selected", PANEL_HI)],
|
||||
foreground=[("selected", OLIVE_HI), ("active", FG)],
|
||||
expand=[("selected", (0, 0, 0, 0))])
|
||||
|
||||
# Der Schieberegler von clam ist standardmaessig hell und wuerde aus
|
||||
# dem Schema fallen.
|
||||
style.configure("Horizontal.TScale", background=BG, troughcolor="#10120f",
|
||||
bordercolor=LINE, lightcolor=OLIVE, darkcolor=OLIVE)
|
||||
style.map("Horizontal.TScale",
|
||||
background=[("active", BG)],
|
||||
lightcolor=[("active", OLIVE_HI)],
|
||||
darkcolor=[("active", OLIVE_HI)])
|
||||
style.configure("TSeparator", background=LINE)
|
||||
return style
|
||||
|
||||
|
||||
class LevelMeter(tk.Canvas):
|
||||
"""
|
||||
Segmentierte Pegelanzeige mit Schwellenmarke.
|
||||
|
||||
Zeigt anders als eine gewoehnliche Fortschrittsleiste, wo die
|
||||
Ausloeseschwelle relativ zum Pegel liegt - genau die Information,
|
||||
die man zum Einstellen braucht.
|
||||
"""
|
||||
SEGMENTS = 40
|
||||
MAXIMUM = 0.10
|
||||
|
||||
def __init__(self, master, width=320, height=26):
|
||||
super().__init__(master, width=width, height=height, bg=PANEL,
|
||||
highlightthickness=1, highlightbackground=LINE,
|
||||
bd=0)
|
||||
self._level = 0.0
|
||||
self._threshold = 0.025
|
||||
self._active = False
|
||||
self.bind("<Configure>", lambda e: self._redraw())
|
||||
|
||||
def update_values(self, level, threshold, active):
|
||||
self._level, self._threshold, self._active = level, threshold, active
|
||||
self._redraw()
|
||||
|
||||
def _redraw(self):
|
||||
self.delete("all")
|
||||
w = self.winfo_width() or int(self["width"])
|
||||
h = self.winfo_height() or int(self["height"])
|
||||
pad = 3
|
||||
seg_w = (w - 2 * pad) / self.SEGMENTS
|
||||
filled = int(min(1.0, self._level / self.MAXIMUM) * self.SEGMENTS)
|
||||
thr_seg = int(min(1.0, self._threshold / self.MAXIMUM) * self.SEGMENTS)
|
||||
|
||||
for i in range(self.SEGMENTS):
|
||||
x0 = pad + i * seg_w
|
||||
x1 = x0 + seg_w - 1.5
|
||||
if i < filled:
|
||||
colour = OLIVE_HI if self._active else OLIVE
|
||||
if i >= thr_seg and not self._active:
|
||||
colour = OLIVE_HI
|
||||
else:
|
||||
colour = "#252b1f"
|
||||
self.create_rectangle(x0, pad, x1, h - pad, fill=colour, width=0)
|
||||
|
||||
# Schwellenmarke
|
||||
x = pad + thr_seg * seg_w
|
||||
self.create_line(x, 0, x, h, fill=AMBER, width=2)
|
||||
|
||||
|
||||
def set_dark_titlebar(root):
|
||||
"""
|
||||
Faerbt die Fenstertitelleiste dunkel.
|
||||
|
|
@ -840,7 +688,7 @@ class VoiceActivationApp:
|
|||
def __init__(self, root):
|
||||
self.root = root
|
||||
self.root.title(f"{APP_NAME} {VERSION}")
|
||||
self.root.geometry("700x780")
|
||||
self.root.geometry("700x830")
|
||||
self.root.minsize(660, 480)
|
||||
set_window_icon(self.root)
|
||||
set_dark_titlebar(self.root)
|
||||
|
|
@ -908,7 +756,7 @@ class VoiceActivationApp:
|
|||
ttk.Label(header, text="SQUAD MANAGER",
|
||||
style="Title.TLabel").pack(anchor="w")
|
||||
ttk.Label(header, style="Sub.TLabel",
|
||||
text="Haelt die Sprechtaste, solange du redest.").pack(anchor="w")
|
||||
text="Sprachaktivierung und Personalakte fuer Squad.").pack(anchor="w")
|
||||
ttk.Separator(self.root, orient="horizontal").pack(
|
||||
fill="x", padx=18, pady=(10, 0))
|
||||
|
||||
|
|
@ -918,9 +766,20 @@ class VoiceActivationApp:
|
|||
self._build_statusbar()
|
||||
self._build_update_banner()
|
||||
|
||||
nb = ttk.Notebook(self.root)
|
||||
# Hauptreiter je Modul. Die Statusleiste bleibt darunter fuer alle
|
||||
# Module sichtbar - die Sprachaktivierung laeuft weiter, waehrend man
|
||||
# zum Beispiel an einer Akte schreibt.
|
||||
haupt = ttk.Notebook(self.root, style="Haupt.TNotebook")
|
||||
self.haupt_nb = haupt
|
||||
haupt.pack(fill="both", expand=True, padx=16, pady=(4, 8))
|
||||
seite_funk = ttk.Frame(haupt)
|
||||
seite_akte = ttk.Frame(haupt)
|
||||
haupt.add(seite_funk, text="FUNK")
|
||||
haupt.add(seite_akte, text="AKTE")
|
||||
|
||||
nb = ttk.Notebook(seite_funk)
|
||||
self.nb = nb
|
||||
nb.pack(fill="both", expand=True, padx=16, pady=8)
|
||||
nb.pack(fill="both", expand=True, pady=(6, 0))
|
||||
tab_main = ttk.Frame(nb)
|
||||
tab_keys = ttk.Frame(nb)
|
||||
nb.add(tab_main, text=" Mikrofon ")
|
||||
|
|
@ -929,6 +788,9 @@ class VoiceActivationApp:
|
|||
self._build_main_tab(tab_main)
|
||||
self._build_keys_tab(tab_keys)
|
||||
|
||||
self.akte = akte.AkteSeite(seite_akte)
|
||||
self.akte.pack(fill="both", expand=True)
|
||||
|
||||
def _build_main_tab(self, parent):
|
||||
f = ttk.Frame(parent)
|
||||
f.pack(fill="both", expand=True, padx=12, pady=12)
|
||||
|
|
@ -1130,6 +992,7 @@ class VoiceActivationApp:
|
|||
"squad_only": bool(self.squad_only_var.get()),
|
||||
"pause_on_cursor": bool(self.pause_on_cursor_var.get()),
|
||||
"beep": bool(self.beep_var.get()),
|
||||
"modul": self.haupt_nb.index("current"),
|
||||
}
|
||||
|
||||
def suche_update(self):
|
||||
|
|
@ -1213,6 +1076,8 @@ class VoiceActivationApp:
|
|||
self.beep_var):
|
||||
var.trace_add("write", self._on_setting_changed)
|
||||
self._autosave_job = None
|
||||
self.haupt_nb.bind("<<NotebookTabChanged>>", self._on_setting_changed,
|
||||
add="+")
|
||||
|
||||
def _on_setting_changed(self, *_):
|
||||
if getattr(self, "_autosave_job", None) is not None:
|
||||
|
|
@ -1286,6 +1151,10 @@ class VoiceActivationApp:
|
|||
if value in MODIFIERS:
|
||||
var.set(value)
|
||||
|
||||
modul = cfg.get("modul")
|
||||
if isinstance(modul, int) and 0 <= modul < len(self.haupt_nb.tabs()):
|
||||
self.haupt_nb.select(modul)
|
||||
|
||||
self.save_hint.config(text="Einstellungen geladen.")
|
||||
|
||||
# -- Audio --------------------------------------------------------------
|
||||
|
|
|
|||
187
theme.py
Normal file
187
theme.py
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
"""
|
||||
Erscheinungsbild von Squad Manager: Farben, Schriften, ttk-Stil und die
|
||||
segmentierte Pegelanzeige.
|
||||
|
||||
Eigene Datei, damit mehrere Module (Funk, Akte) denselben Stil nutzen,
|
||||
ohne sich gegenseitig zu importieren.
|
||||
"""
|
||||
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
|
||||
BG = "#151814" # Fensterhintergrund, fast schwarz mit Gruenstich
|
||||
PANEL = "#1e231b" # Flaechen, Eingabefelder
|
||||
PANEL_HI = "#2a3125" # Hover, ausgewaehlter Reiter
|
||||
LINE = "#3d4634" # Rahmen und Trennlinien
|
||||
FG = "#c9cec0" # Standardtext, helles Khaki
|
||||
FG_DIM = "#7f8874" # Nebentext
|
||||
OLIVE = "#6e8b3d" # Akzent, Fortschritt
|
||||
OLIVE_HI = "#8cb04d" # heller Akzent
|
||||
AMBER = "#d9a441" # Hinweise, Schwellenmarke
|
||||
AMBER_HELL = "#e8bb63" # Mauskontakt auf der Hinweisleiste
|
||||
AMBER_DUNKEL = "#2b2416" # Untergrund der Hinweisleiste
|
||||
RED = "#b4472f" # Sperre, Fehler
|
||||
GREEN_TX = "#9ed23f" # Sendebereit
|
||||
|
||||
FONT_UI = ("Segoe UI", 9)
|
||||
FONT_BOLD = ("Segoe UI Semibold", 9)
|
||||
FONT_TITLE = ("Segoe UI", 17, "bold")
|
||||
FONT_MONO = ("Consolas", 9)
|
||||
FONT_STATUS = ("Consolas", 13, "bold")
|
||||
FONT_NAV = ("Segoe UI Semibold", 11)
|
||||
|
||||
|
||||
def apply_tactical_theme(root):
|
||||
"""Dunkles, gedecktes Farbschema im Stil der Spieloberflaeche."""
|
||||
root.configure(bg=BG)
|
||||
style = ttk.Style(root)
|
||||
# "clam" ist das einzige mitgelieferte Thema, das sich durchgaengig
|
||||
# umfaerben laesst - "vista" ignoriert die meisten Farbangaben.
|
||||
style.theme_use("clam")
|
||||
|
||||
style.configure(".", background=BG, foreground=FG, font=FONT_UI,
|
||||
bordercolor=LINE, darkcolor=PANEL, lightcolor=PANEL,
|
||||
troughcolor=PANEL, focuscolor=OLIVE)
|
||||
style.configure("TFrame", background=BG)
|
||||
style.configure("TLabel", background=BG, foreground=FG)
|
||||
style.configure("Dim.TLabel", foreground=FG_DIM)
|
||||
style.configure("Mono.TLabel", font=FONT_MONO, foreground=FG)
|
||||
style.configure("Title.TLabel", font=FONT_TITLE, foreground=FG)
|
||||
style.configure("Sub.TLabel", foreground=FG_DIM)
|
||||
|
||||
style.configure("TLabelframe", background=BG, bordercolor=LINE,
|
||||
relief="solid", borderwidth=1)
|
||||
style.configure("TLabelframe.Label", background=BG, foreground=OLIVE_HI,
|
||||
font=FONT_BOLD)
|
||||
|
||||
style.configure("TButton", background=PANEL, foreground=FG,
|
||||
bordercolor=LINE, relief="solid", borderwidth=1,
|
||||
padding=(12, 6), font=FONT_UI)
|
||||
style.map("TButton",
|
||||
background=[("pressed", OLIVE), ("active", PANEL_HI),
|
||||
("disabled", PANEL)],
|
||||
foreground=[("disabled", FG_DIM)],
|
||||
bordercolor=[("active", OLIVE)])
|
||||
|
||||
style.configure("Accent.TButton", background=OLIVE, foreground="#12150f",
|
||||
font=FONT_BOLD, bordercolor=OLIVE_HI)
|
||||
style.map("Accent.TButton",
|
||||
background=[("pressed", OLIVE), ("active", OLIVE_HI),
|
||||
("disabled", PANEL)],
|
||||
foreground=[("disabled", FG_DIM)])
|
||||
|
||||
for widget in ("TCombobox", "TSpinbox", "TEntry"):
|
||||
style.configure(widget, fieldbackground=PANEL, background=PANEL,
|
||||
foreground=FG, bordercolor=LINE, arrowcolor=OLIVE_HI,
|
||||
insertcolor=FG, selectbackground=OLIVE,
|
||||
selectforeground="#12150f", padding=4)
|
||||
style.map(widget,
|
||||
fieldbackground=[("readonly", PANEL), ("disabled", BG)],
|
||||
foreground=[("disabled", FG_DIM)],
|
||||
bordercolor=[("focus", OLIVE)])
|
||||
# Die aufklappende Liste einer Combobox ist ein klassisches Tk-Widget
|
||||
# und muss ueber die Optionsdatenbank eingefaerbt werden.
|
||||
root.option_add("*TCombobox*Listbox.background", PANEL)
|
||||
root.option_add("*TCombobox*Listbox.foreground", FG)
|
||||
root.option_add("*TCombobox*Listbox.selectBackground", OLIVE)
|
||||
root.option_add("*TCombobox*Listbox.selectForeground", "#12150f")
|
||||
root.option_add("*TCombobox*Listbox.font", FONT_UI)
|
||||
|
||||
style.configure("TCheckbutton", background=BG, foreground=FG,
|
||||
indicatorcolor=PANEL, indicatorrelief="solid")
|
||||
style.map("TCheckbutton",
|
||||
background=[("active", BG)],
|
||||
indicatorcolor=[("selected", OLIVE_HI), ("active", PANEL_HI)],
|
||||
foreground=[("disabled", FG_DIM)])
|
||||
|
||||
style.configure("TNotebook", background=BG, bordercolor=LINE,
|
||||
tabmargins=(2, 4, 2, 0))
|
||||
style.configure("TNotebook.Tab", background="#10120f", foreground=FG_DIM,
|
||||
bordercolor=LINE, lightcolor="#10120f",
|
||||
darkcolor="#10120f", padding=(20, 9), font=FONT_BOLD)
|
||||
style.map("TNotebook.Tab",
|
||||
background=[("selected", PANEL_HI), ("active", PANEL)],
|
||||
lightcolor=[("selected", PANEL_HI)],
|
||||
darkcolor=[("selected", PANEL_HI)],
|
||||
foreground=[("selected", OLIVE_HI), ("active", FG)],
|
||||
expand=[("selected", (0, 0, 0, 0))])
|
||||
|
||||
# Der Schieberegler von clam ist standardmaessig hell und wuerde aus
|
||||
# dem Schema fallen.
|
||||
style.configure("Horizontal.TScale", background=BG, troughcolor="#10120f",
|
||||
bordercolor=LINE, lightcolor=OLIVE, darkcolor=OLIVE)
|
||||
style.map("Horizontal.TScale",
|
||||
background=[("active", BG)],
|
||||
lightcolor=[("active", OLIVE_HI)],
|
||||
darkcolor=[("active", OLIVE_HI)])
|
||||
# Hauptreiter (FUNK, AKTE): ohne Kasten, nur Schrift - so heben sie sich
|
||||
# als uebergeordnete Ebene von den umrahmten Unterreitern ab.
|
||||
style.configure("Haupt.TNotebook", background=BG, bordercolor=BG,
|
||||
lightcolor=BG, darkcolor=BG, tabmargins=(0, 0, 0, 0))
|
||||
style.configure("Haupt.TNotebook.Tab", background=BG, foreground=FG_DIM,
|
||||
bordercolor=BG, lightcolor=BG, darkcolor=BG,
|
||||
padding=(4, 6, 26, 6), font=FONT_NAV)
|
||||
# clam gibt dem gewaehlten Reiter eine eigene Innenabstand-Regel. Ohne
|
||||
# die padding-Zeile erbt dieser Stil sie, und die Schrift springt beim
|
||||
# Umschalten um einige Pixel.
|
||||
style.map("Haupt.TNotebook.Tab",
|
||||
padding=[("selected", (4, 6, 26, 6))],
|
||||
background=[("selected", BG), ("active", BG)],
|
||||
lightcolor=[("selected", BG)],
|
||||
darkcolor=[("selected", BG)],
|
||||
bordercolor=[("selected", BG)],
|
||||
foreground=[("selected", OLIVE_HI), ("active", FG)],
|
||||
expand=[("selected", (0, 0, 0, 0))])
|
||||
|
||||
style.configure("TSeparator", background=LINE)
|
||||
return style
|
||||
|
||||
|
||||
class LevelMeter(tk.Canvas):
|
||||
"""
|
||||
Segmentierte Pegelanzeige mit Schwellenmarke.
|
||||
|
||||
Zeigt anders als eine gewoehnliche Fortschrittsleiste, wo die
|
||||
Ausloeseschwelle relativ zum Pegel liegt - genau die Information,
|
||||
die man zum Einstellen braucht.
|
||||
"""
|
||||
SEGMENTS = 40
|
||||
MAXIMUM = 0.10
|
||||
|
||||
def __init__(self, master, width=320, height=26):
|
||||
super().__init__(master, width=width, height=height, bg=PANEL,
|
||||
highlightthickness=1, highlightbackground=LINE,
|
||||
bd=0)
|
||||
self._level = 0.0
|
||||
self._threshold = 0.025
|
||||
self._active = False
|
||||
self.bind("<Configure>", lambda e: self._redraw())
|
||||
|
||||
def update_values(self, level, threshold, active):
|
||||
self._level, self._threshold, self._active = level, threshold, active
|
||||
self._redraw()
|
||||
|
||||
def _redraw(self):
|
||||
self.delete("all")
|
||||
w = self.winfo_width() or int(self["width"])
|
||||
h = self.winfo_height() or int(self["height"])
|
||||
pad = 3
|
||||
seg_w = (w - 2 * pad) / self.SEGMENTS
|
||||
filled = int(min(1.0, self._level / self.MAXIMUM) * self.SEGMENTS)
|
||||
thr_seg = int(min(1.0, self._threshold / self.MAXIMUM) * self.SEGMENTS)
|
||||
|
||||
for i in range(self.SEGMENTS):
|
||||
x0 = pad + i * seg_w
|
||||
x1 = x0 + seg_w - 1.5
|
||||
if i < filled:
|
||||
colour = OLIVE_HI if self._active else OLIVE
|
||||
if i >= thr_seg and not self._active:
|
||||
colour = OLIVE_HI
|
||||
else:
|
||||
colour = "#252b1f"
|
||||
self.create_rectangle(x0, pad, x1, h - pad, fill=colour, width=0)
|
||||
|
||||
# Schwellenmarke
|
||||
x = pad + thr_seg * seg_w
|
||||
self.create_line(x, 0, x, h, fill=AMBER, width=2)
|
||||
|
|
@ -26,7 +26,8 @@ WURZEL = Path(__file__).resolve().parent.parent
|
|||
DIST = WURZEL / "dist"
|
||||
BASIS_URL = "https://sva.tyrveil.com"
|
||||
|
||||
PYTHON_DATEIEN = ("squad_manager.py", "start.pyw", "make_icon.py")
|
||||
PYTHON_DATEIEN = ("squad_manager.py", "theme.py", "akte.py", "start.pyw",
|
||||
"make_icon.py")
|
||||
MITKOPIEREN = ("requirements.txt", "icon.png", "icon.ico")
|
||||
|
||||
ISCC_KANDIDATEN = (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue