Wrappe modular aufgebaut, Tests erfolgreich, Menüleiste und Werzeugleiste werden eingetragen (QT6 und QT5)- (Es fehlen noch Fachplugins, um zu prüfen, ob es auch wirklich in QGIS geht)

This commit is contained in:
2025-12-19 14:29:52 +01:00
parent e8fea163b5
commit f88b5da51f
37 changed files with 1886 additions and 1679 deletions

View File

@@ -0,0 +1,41 @@
"""
sn_basis/functions/dialog_wrapper.py Benutzer-Dialoge
"""
from typing import Any
from sn_basis.functions.qt_wrapper import (
QMessageBox,
YES,
NO,
)
# ---------------------------------------------------------
# Öffentliche API
# ---------------------------------------------------------
def ask_yes_no(
title: str,
message: str,
default: bool = False,
parent: Any = None,
) -> bool:
"""
Fragt den Benutzer eine Ja/Nein-Frage.
- In Qt: zeigt einen QMessageBox-Dialog
- Im Mock-Modus: gibt den Default-Wert zurück
"""
try:
buttons = QMessageBox.Yes | QMessageBox.No
result = QMessageBox.question(
parent,
title,
message,
buttons,
YES if default else NO,
)
return result == YES
except Exception:
return default