diff --git a/functions/dialog_wrapper.py b/functions/dialog_wrapper.py index 170bbc0..4bd1996 100644 --- a/functions/dialog_wrapper.py +++ b/functions/dialog_wrapper.py @@ -218,7 +218,7 @@ def ask_detailpruefung_oder_vg_laden( msg.setText(message) detail_btn = msg.addButton("Detailprüfung starten", QMessageBox.ButtonRole.AcceptRole) - vg_btn = msg.addButton("Bodenordnungsobjekt als VG laden", QMessageBox.ButtonRole.ActionRole) + vg_btn = msg.addButton("Bodenordnungsobjekt als Verfahrensgebiet laden", QMessageBox.ButtonRole.ActionRole) msg.addButton("Abbrechen", QMessageBox.ButtonRole.RejectRole) exec_dialog(msg) @@ -324,7 +324,73 @@ class ProgressDialog: if self._dlg is not None: self._dlg.close() + def raise_to_front(self) -> None: + """Bringt den Fortschrittsdialog in den Vordergrund. + + Wird aufgerufen, nachdem ein modaler Subdialog (z. B. Auswahlbox) + geschlossen wurde und der Fortschrittsdialog wieder sichtbar sein soll. + """ + if QT_VERSION == 0: + return + if self._dlg is not None: + try: + self._dlg.raise_() + self._dlg.activateWindow() + QCoreApplication.processEvents() + except Exception: + pass + def create_progress_dialog(total: int, title: str = "Fortschritt", label: str = "Verarbeite...") -> ProgressDialog: return ProgressDialog(total, title, label) + +def ask_bror_kombination( + parent: Any, + kombinationen: list[tuple[str, str]], +) -> Optional[tuple[str, str]]: + """Zeigt Dialog zur Auswahl einer BROR-Kombination (adv_name + bezeichnung). + + Wird aufgerufen, wenn der WFS mehrere verschiedene Kombinationen aus + ``adv_name`` und ``bezeichnung`` zurückliefert, sodass der Nutzer + entscheiden muss, welche Objekte in die Pipeline einfließen sollen. + + Parameters + ---------- + parent : + Eltern-Widget oder None. + kombinationen : + Sortierte Liste von ``(adv_name, bezeichnung)``-Tupeln. + + Returns + ------- + Optional[tuple[str, str]] + Das gewählte ``(adv_name, bezeichnung)``-Tupel oder ``None`` bei + Abbruch bzw. leerer Eingabe. + """ + if not kombinationen: + return None + + if QT_VERSION == 0: # Mock-Modus + print(f"Mock-Modus: ask_bror_kombination → {kombinationen[0]}") + return kombinationen[0] + + items = [f"{adv} | {bez}" for adv, bez in kombinationen] + item, ok = QInputDialog.getItem( + parent, + "BROR-Objekt auswählen", + "Mehrere BauRaumOderBodenordnungsrecht-Objekte gefunden.\n" + "Bitte wählen Sie die gewünschte Kombination\n" + "aus ADV-Name und Bezeichnung:", + items, + 0, + False, + ) + if not ok: + return None + try: + idx = items.index(item) + return kombinationen[idx] + except ValueError: + return None +