forked from AG_QGIS/Plugin_SN_Basis
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:
20
functions/ly_existence_wrapper.py
Normal file
20
functions/ly_existence_wrapper.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# sn_basis/functions/ly_existence_wrapper.py
|
||||
|
||||
def layer_exists(layer) -> bool:
|
||||
if layer is None:
|
||||
return False
|
||||
|
||||
is_valid_flag = getattr(layer, "is_valid", None)
|
||||
if is_valid_flag is not None:
|
||||
try:
|
||||
return bool(is_valid_flag)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
try:
|
||||
is_valid = getattr(layer, "isValid", None)
|
||||
if callable(is_valid):
|
||||
return bool(is_valid())
|
||||
return True
|
||||
except Exception:
|
||||
return False
|
||||
Reference in New Issue
Block a user