1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-12-30 10:41:18 +01:00

fix(rpc_base): rpc_call wrapper passes full_name for Devices indeed of name

This commit is contained in:
2025-07-22 15:17:06 +02:00
committed by Jan Wyzula
parent 3bcff75107
commit 491d04467c
2 changed files with 17 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ from functools import wraps
from typing import TYPE_CHECKING, Any, cast
from bec_lib.client import BECClient
from bec_lib.device import DeviceBaseWithConfig
from bec_lib.endpoints import MessageEndpoints
from bec_lib.utils.import_utils import lazy_import, lazy_import_from
@@ -49,12 +50,22 @@ def rpc_call(func):
out = []
for arg in args:
if hasattr(arg, "name"):
if isinstance(
arg, DeviceBaseWithConfig
): # if dev.<device> is passed to GUI, it passes full_name
if hasattr(arg, "full_name"):
arg = arg.full_name
elif hasattr(arg, "name"):
arg = arg.name
out.append(arg)
args = tuple(out)
for key, val in kwargs.items():
if hasattr(val, "name"):
if isinstance(
val, DeviceBaseWithConfig
): # if dev.<device> is passed to GUI, it passes full_name
if hasattr(val, "full_name"):
kwargs[key] = val.full_name
elif hasattr(val, "name"):
kwargs[key] = val.name
if not self._root._gui_is_alive():
raise RuntimeError("GUI is not alive")

View File

@@ -28,6 +28,10 @@ class EntryValidator:
if not available_entries:
available_entries = [name]
# edge case for if name is passed instead of full_name, should not happen
if entry in signals_dict:
entry = signals_dict[entry].get("obj_name", entry)
if entry is None or entry == "":
entry = next(iter(device._hints), name) if hasattr(device, "_hints") else name
if entry not in available_entries: