diff --git a/.gitignore b/.gitignore index 574b77f..9d493c4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,12 @@ __pycache__/ *.pyc *.pyo +# Rhino-Testdateien (rhino/-Ordner) +rhino/*.3dm +rhino/*.3dm.thumb.png +rhino/*.3dmbak +rhino/dossier.project.json + # Claude Code .claude/ diff --git a/rhino/oberleiste.py b/rhino/oberleiste.py index 3d85ad3..3d447bf 100644 --- a/rhino/oberleiste.py +++ b/rhino/oberleiste.py @@ -763,6 +763,32 @@ def _layout_name_to_guid(name): _LAYOUT_MARKER_PATH = os.path.expanduser( "~/Library/Application Support/ch.gabrielevarano.Dossier/layout_marker.json") +_RHINO_SETTINGS_XML = os.path.expanduser( + "~/Library/Application Support/McNeel/Rhinoceros/8.0/settings/" + "settings-Scheme__Default.xml") + + +def _rhino_last_restored_layout_guid(): + """Liest aus Rhinos settings-Scheme__Default.xml die zuletzt restorete + Layout-GUID. Rhino schreibt diesen Eintrag nach jedem erfolgreichen + Restore (sowohl beim App-Start als auch nach `_-WindowLayout`-Command). + Wenn die GUID == unser Ziel ist, hat Rhino's Auto-Restore das Layout + schon beim Cold-Start angewendet → wir koennen den teuren Command- + Apply skippen.""" + try: + if not os.path.isfile(_RHINO_SETTINGS_XML): return None + with open(_RHINO_SETTINGS_XML, "rb") as f: + txt = f.read().decode("utf-8", errors="replace") + # b6b68c03-... + import re + m = re.search( + r'\s*([0-9a-fA-F\-]+)\s*', + txt) + if m: return m.group(1).strip().lower() + except Exception as ex: + print("[OBERLEISTE] last-restored read:", ex) + return None + def _is_layout_recently_applied(name, max_age_sec=600): """True wenn das gegebene Layout vor < max_age_sec Sekunden via DOSSIER @@ -812,6 +838,11 @@ def _apply_window_layout(name): if not name: print("[OBERLEISTE] apply_window_layout: leerer Name") return False + # KEIN Content-Skip mehr: Mac Rhino's Auto-Restore aus LastRestoredWindow + # Layout dockt Eto-WebView-Panels NICHT korrekt — sie spawnen floating in + # der Mitte statt an die persistierte Dock-Position. Nur der explizite + # `_-WindowLayout`-RunScript triggert den vollen Re-Dock-Cycle der auch + # WebViews korrekt platziert. Die 3s sind der Preis fuer korrektes UI. import time as _t_wl _t_wl_start = _t_wl.time() _ret = False