Normalize native dependency ownership and split config UI
Some checks failed
Some checks failed
Make distro packages the single source of truth for GTK/X11 Python bindings instead of advertising them as wheel-managed runtime dependencies. Update the uv, CI, and packaging workflows to use system site packages, regenerate uv.lock, and keep portable and Arch metadata aligned with that contract. Pull runtime policy, audio probing, and page builders out of config_ui.py so the settings window becomes a coordinator instead of a single large mixed-concern module. Rename the config serialization and logging helpers, and stop startup logging from exposing raw vocabulary entries or custom model paths. Remove stale helper aliases and add regression coverage for safe startup logging, packaging metadata and module drift, portable requirements, and the extracted audio helper behavior. Validated with uv lock, python3 -m compileall -q src tests, python3 -m unittest discover -s tests -p 'test_*.py', make build, and make package-arch.
This commit is contained in:
parent
f779b71e1b
commit
c6fc61c885
23 changed files with 617 additions and 437 deletions
52
src/config_ui_audio.py
Normal file
52
src/config_ui_audio.py
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from typing import Any
|
||||
|
||||
from recorder import (
|
||||
list_input_devices,
|
||||
resolve_input_device,
|
||||
start_recording,
|
||||
stop_recording,
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MicrophoneTestResult:
|
||||
ok: bool
|
||||
message: str
|
||||
|
||||
|
||||
class AudioSettingsService:
|
||||
def list_input_devices(self) -> list[dict[str, Any]]:
|
||||
return list_input_devices()
|
||||
|
||||
def resolve_input_device(self, input_spec: str | int | None) -> int | None:
|
||||
return resolve_input_device(input_spec)
|
||||
|
||||
def test_microphone(
|
||||
self,
|
||||
input_spec: str | int | None,
|
||||
*,
|
||||
duration_sec: float = 0.35,
|
||||
) -> MicrophoneTestResult:
|
||||
try:
|
||||
stream, record = start_recording(input_spec)
|
||||
time.sleep(duration_sec)
|
||||
audio = stop_recording(stream, record)
|
||||
except Exception as exc:
|
||||
return MicrophoneTestResult(
|
||||
ok=False,
|
||||
message=f"Microphone test failed: {exc}",
|
||||
)
|
||||
|
||||
if getattr(audio, "size", 0) > 0:
|
||||
return MicrophoneTestResult(
|
||||
ok=True,
|
||||
message="Microphone test successful.",
|
||||
)
|
||||
return MicrophoneTestResult(
|
||||
ok=False,
|
||||
message="No audio captured. Try another device.",
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue