diff --git a/weldx_widgets/widget_base.py b/weldx_widgets/widget_base.py index 46fb499..13b6311 100644 --- a/weldx_widgets/widget_base.py +++ b/weldx_widgets/widget_base.py @@ -131,15 +131,19 @@ def schema(self) -> str: """Return a schema name is used to validate input and output.""" pass + @staticmethod @functools.lru_cache - def get_schema_path(self) -> Path: + def _get_schema_path(schema) -> Path: """Resolve a schema name to path.""" - return get_schema_path(self.schema) + return get_schema_path(schema) + + def get_schema_path(self) -> Path: + return WeldxImportExport._get_schema_path(self.schema) def validate(self, tree): """Validate given tree against schema of this class.""" # should be implemented such that we can validate both input and output. - pass + return @abc.abstractmethod def from_tree(self, tree: dict): diff --git a/weldx_widgets/widget_gmaw.py b/weldx_widgets/widget_gmaw.py index 4b5ca18..8b1fac0 100644 --- a/weldx_widgets/widget_gmaw.py +++ b/weldx_widgets/widget_gmaw.py @@ -306,7 +306,7 @@ def __init__(self, process_type="spray"): def _create_process_widgets(self, change): new = change["new"] arg = self.translate[new] - box = self._cached_process_widgets(arg) + box = WidgetGMAW._cached_process_widgets(arg) self._welding_process.children = (box,) @property @@ -314,8 +314,9 @@ def welding_process(self) -> Union[ProcessSpray, ProcessPulsed]: """Return welding process widget.""" return self._welding_process.children[0] + @staticmethod @lru_cache(None) - def _cached_process_widgets(self, process): + def _cached_process_widgets(process): if process == "spray": return ProcessSpray()