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,40 @@
# sn_basis/functions/ly_visibility_wrapper.py
def is_layer_visible(layer) -> bool:
if layer is None:
return False
visible = getattr(layer, "visible", None)
if visible is not None:
return bool(visible)
try:
is_visible = getattr(layer, "isVisible", None)
if callable(is_visible):
return bool(is_visible())
except Exception:
pass
return False
def set_layer_visible(layer, visible: bool) -> bool:
if layer is None:
return False
try:
if hasattr(layer, "visible"):
layer.visible = bool(visible)
return True
except Exception:
pass
try:
node = getattr(layer, "treeLayer", lambda: None)()
if node and callable(getattr(node, "setItemVisibilityChecked", None)):
node.setItemVisibilityChecked(bool(visible))
return True
except Exception:
pass
return False