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,90 @@
# layer/metadata.py
def get_layer_type(layer) -> str:
if layer is None:
return "unknown"
layer_type = getattr(layer, "layer_type", None)
if layer_type is not None:
return str(layer_type)
try:
if callable(getattr(layer, "isSpatial", None)):
return "vector" if layer.isSpatial() else "table"
except Exception:
pass
return "unknown"
def get_layer_crs(layer) -> str:
if layer is None:
return "None"
crs = getattr(layer, "crs", None)
if crs is not None and not callable(crs):
if isinstance(crs, str):
return crs
return "None"
try:
crs_obj = layer.crs()
authid = getattr(crs_obj, "authid", None)
if callable(authid):
value = authid()
if isinstance(value, str):
return value
except Exception:
pass
return "None"
def get_layer_fields(layer) -> list[str]:
if layer is None:
return []
fields = getattr(layer, "fields", None)
if fields is not None and not callable(fields):
return list(fields)
try:
f = layer.fields()
if callable(getattr(f, "names", None)):
return list(f.names())
return list(f)
except Exception:
return []
def get_layer_source(layer) -> str:
if layer is None:
return "None"
source = getattr(layer, "source", None)
if source is not None and not callable(source):
return str(source)
try:
return layer.source() or "None"
except Exception:
return "None"
def is_layer_editable(layer) -> bool:
if layer is None:
return False
editable = getattr(layer, "editable", None)
if editable is not None:
return bool(editable)
try:
is_editable = getattr(layer, "isEditable", None)
if callable(is_editable):
return bool(is_editable())
except Exception:
pass
return False