VLN-API integriert
This commit is contained in:
@@ -5,6 +5,25 @@ from sn_basis.functions.sys_wrapper import get_plugin_root, join_path
|
||||
from sn_basis.modules.stilpruefer import Stilpruefer
|
||||
from typing import Optional
|
||||
|
||||
def apply_style_from_path(layer, style_path: str) -> bool:
|
||||
"""
|
||||
Wendet einen Layerstil anhand eines vollständigen Pfades an.
|
||||
|
||||
Im Gegensatz zu :func:`apply_style` wird der Pfad extern bereitgestellt;
|
||||
es findet keine eigene Stilprüfung statt.
|
||||
"""
|
||||
if not layer_exists(layer):
|
||||
return False
|
||||
try:
|
||||
ok, _ = layer.loadNamedStyle(str(style_path))
|
||||
if ok:
|
||||
getattr(layer, "triggerRepaint", lambda: None)()
|
||||
return True
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
||||
def apply_style(layer, style_name: str) -> bool:
|
||||
"""
|
||||
Wendet einen Layerstil an, sofern er gültig ist.
|
||||
|
||||
Reference in New Issue
Block a user