Files
DOSSIER/tools/export_icons.py
karim 13a5e1eb7a AGPL-3.0 Dual-Lizenz + Pill-Stil-UI + Section-Style-Overhaul + Plan-Mode-Template
Lizenz:
- AGPL-3.0 LICENSE-File im Repo-Root (GNU Volltext)
- SPDX-Header + Copyright in allen Source-Files (Python/JSX/JS/Rust)
- license-Feld in package.json + Cargo.toml
- About-App komplett neu: Dual-Lizenz-Block (AGPL + Commercial),
  openbureau-Branding, Version-Pills, made-in-Switzerland-Footer

UI-Restyle (3 Wellen) — alle Dialoge + Satellites + Panel-Sidebars
auf gemeinsamen Pill-Stil aus BarControls (BarToggle/BarButton/BarCombo):
- Welle 1: GeschossDialog/Settings, AusschnittSettings, LayoutDialog
- Welle 2: ConfirmDeleteEbene, Kamera, MasseSettings, Osm, Swisstopo,
  TextEditor, AusschnittLayerDialog, LayerCombinations
- Welle 3: LayoutsApp, MassstabApp, WerkzeugeApp, OverridesApp,
  ZeichnungsebenenApp; Werkzeuge mit ElementeApp-PillGroup-Layout

GeschossDialog Header-Refactor: +Geschoss/+Zeichnung in Toolbar oben,
move-Pfeile-Spalte breiter (kein Overlap mit G-Haken)

Ausschnitte Rows als Pills, kein Outer-Border ums Suchfeld

Section-Style komplett neu (gestaltung.py + GestaltungApp.jsx):
- ObjectSectionAttributesSource.FromObject (richtiger Enum-Name fuer Mac)
- HatchPatternPrintColor + BoundaryPrintColor mit-setzen (Display = Print)
- BoundaryColor nur bei explizitem User-Override, sonst Rhino-Default
- background_color_hex Parameter (BackgroundFillMode=SolidColor)
- Readback aus GetCustomSectionStyle statt direkt aus Attributes
- UI: Schnittkante > Section Style > Solid-Fill mit proper SectionHead
- 'Boundary' (3D Pen) -> 'Background' weil sich's wie Section-Hintergrund verhaelt

Plan-Mode 'Dossier Plan' via Template:
- rhino/templates/dossier_plan.ini wird direkt geladen
- Fallback auf Technical-Clone + ini-Patch wenn Template fehlt
- Auto-Cleanup von Orphan-Modes vor Import (Name- oder Guid-Match)
- ClipSectionUsage=1 + TechnicalMask=15 als bekannte Soll-Werte
- Bei Template-Pfad keine ini-Patches (1:1 wie User exportiert)
- Sanity-Print listet alle registrierten Modes nach Anlegen

Bridge-Unification: 4 Settings-Apps (Ebenen/Project/Geschoss*Dialog)
benutzen jetzt chunkende send() statt eigene bridgeSend ohne Chunk-
Logik -> grosse Payloads (Hatch-Refs etc.) kommen nicht mehr truncated
bei Python an (loeste 'JSON-Fehler char 990'-Regression in Ebenen-
Settings)

Library-Imports robust: 'import library' jetzt Top-Level in elemente.py
+ rhinopanel.py (statt Lazy in Methoden) -> 'No module named library'-
Crashes weg auch wenn sys.path zwischendurch resettet wird

Tools fuer Display-Mode-Maintenance:
- _clean_display_modes.py (loescht alle Custom-Modes, Built-ins bleiben)
- _inspect_plan_mode.py / _inspect_obj_section.py / _inspect_obj_boundary.py
  (Diagnose-Skripte fuer SectionStyle-Property-Reverse-Engineering)
- _reset_rhino_settings.sh (Backup + Nuke der Rhino-Settings als
  letzte Bastion gegen korrupte Display-Modes)
2026-05-26 17:09:18 +02:00

164 lines
5.4 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: AGPL-3.0-or-later
# Copyright (C) 2026 Karim Gabriele Varano
"""
export_icons.py
Laedt alle Material-Symbols-Outlined Icons herunter die unsere WERKZEUGE-
Sidebar benutzt, und konvertiert sie zu PNG (32x32) fuer Rhino-Toolbars.
Ausgabe-Ordner: ./icons_export/
dossier_icons/
svg/ — Originale SVGs (skalierbar)
png/ — 32x32 PNGs fuer Rhino .rui Buttons
Konvertierung SVG->PNG nutzt 'rsvg-convert' wenn installiert, sonst Mac's
'qlmanage' (immer verfuegbar) als Fallback.
Verwendung:
python3 tools/export_icons.py
"""
import os
import sys
import shutil
import subprocess
from urllib.request import urlopen, Request
# Icons gruppiert wie in WerkzeugeApp.jsx — name : label (label nur fuer Logging)
ICONS = {
# 2D Zeichnen
"horizontal_rule": "Line",
"polyline": "Polyline",
"rectangle": "Rect",
"radio_button_unchecked": "Circle",
"network_intelligence": "Arc",
"gesture": "Curve",
"text_fields": "Text",
"grid_view": "Hatch",
"straighten": "Dim",
# 2D Editieren
"open_with": "Move",
"content_copy": "Copy",
"rotate_right": "Rotate",
"aspect_ratio": "Scale",
"flip": "Mirror",
"padding": "Offset",
"content_cut": "Trim",
"swipe_right_alt": "Extend",
"link": "Join",
"scatter_plot": "Explode",
"rounded_corner": "Fillet",
"apps": "Array",
# 3D Modellieren
"vertical_align_top": "Extrude",
"square": "Box",
"join_inner": "Union",
"remove": "Diff",
"gradient": "Intersect",
"roofing": "Cap",
"cut": "Section",
"unfold_more": "Loft",
# Auswahl
"add_link": "SelChain",
"filter_alt": "SelDup",
"loop": "SelClosed",
"compare_arrows": "Invert",
"select_all": "SelAll",
"deselect": "SelNone",
}
URL_TPL = "https://fonts.gstatic.com/s/i/short-term/release/materialsymbolsoutlined/{name}/default/24px.svg"
OUT_ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "icons_export", "dossier_icons")
OUT_SVG = os.path.join(OUT_ROOT, "svg")
OUT_PNG = os.path.join(OUT_ROOT, "png")
def ensure_dirs():
for d in (OUT_SVG, OUT_PNG):
if not os.path.isdir(d):
os.makedirs(d)
def download_svg(name):
url = URL_TPL.format(name=name)
req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
with urlopen(req, timeout=10) as r:
return r.read()
def have(cmd):
return shutil.which(cmd) is not None
def convert_to_png(svg_path, png_path, size=32):
"""Konvertiert SVG -> PNG. Probiert rsvg-convert, sonst qlmanage (Mac)."""
if have("rsvg-convert"):
try:
subprocess.check_call(
["rsvg-convert", "-w", str(size), "-h", str(size),
svg_path, "-o", png_path],
stderr=subprocess.DEVNULL,
)
return "rsvg-convert"
except subprocess.CalledProcessError:
pass
if have("qlmanage"):
# qlmanage erzeugt {svg_path}.png im out-dir
out_dir = os.path.dirname(png_path)
try:
subprocess.check_call(
["qlmanage", "-t", "-s", str(size), "-o", out_dir, svg_path],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
)
generated = svg_path + ".png"
generated_in_outdir = os.path.join(out_dir, os.path.basename(generated))
if os.path.isfile(generated_in_outdir):
shutil.move(generated_in_outdir, png_path)
return "qlmanage"
except subprocess.CalledProcessError:
pass
return None
def main():
ensure_dirs()
print("[icons] Ziel: " + os.path.abspath(OUT_ROOT))
n_ok = 0
n_png = 0
n_fail = []
converter_used = None
for name, label in sorted(ICONS.items()):
svg_path = os.path.join(OUT_SVG, name + ".svg")
try:
data = download_svg(name)
with open(svg_path, "wb") as f:
f.write(data)
n_ok += 1
# SVG -> PNG
png_path = os.path.join(OUT_PNG, name + ".png")
used = convert_to_png(svg_path, png_path, size=32)
if used:
converter_used = used
n_png += 1
print(" OK {:<24}{}".format(name, label))
except Exception as ex:
n_fail.append((name, str(ex)))
print(" FAIL {:<24}{} ({})".format(name, label, ex))
print("")
print("[icons] SVGs: {} ok / {} fail".format(n_ok, len(n_fail)))
if n_png:
print("[icons] PNGs: {} via {}".format(n_png, converter_used))
elif n_ok:
print("[icons] PNG-Konvertierung uebersprungen — kein rsvg-convert/qlmanage gefunden.")
print(" Installiere via: brew install librsvg")
if n_fail:
print("")
print("[icons] Fehlgeschlagene Icons (vielleicht andere Namen im Symbols-Repo):")
for n, err in n_fail:
print(" - {} : {}".format(n, err))
if __name__ == "__main__":
main()