0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

refactor(plots/image): images are accessed as property .images -> returns list[BECImage]

This commit is contained in:
2024-04-12 10:37:20 +02:00
parent bd3b1ba043
commit 2f7317b328
2 changed files with 23 additions and 12 deletions

View File

@ -1,9 +1,8 @@
# This file was automatically generated by generate_cli.py
from bec_widgets.cli.client_utils import rpc_call, RPCBase, BECFigureClientMixin
from typing import Literal, Optional, overload
from bec_widgets.cli.client_utils import BECFigureClientMixin, RPCBase, rpc_call
class BECPlotBase(RPCBase):
@rpc_call
@ -740,14 +739,6 @@ class BECImageShow(RPCBase):
ImageItemConfig|dict: The configuration of the image.
"""
@rpc_call
def get_image_list(self) -> "list[BECImageItem]":
"""
Get the list of images.
Returns:
list[BECImageItem]: The list of images.
"""
@rpc_call
def get_image_dict(self) -> "dict[str, dict[str, BECImageItem]]":
"""
@ -1048,6 +1039,15 @@ class BECImageShow(RPCBase):
Remove the plot widget from the figure.
"""
@property
@rpc_call
def images(self) -> "list[BECImageItem]":
"""
Get the list of images.
Returns:
list[BECImageItem]: The list of images.
"""
class BECConnector(RPCBase):
@rpc_call

View File

@ -283,7 +283,6 @@ class BECImageShow(BECPlotBase):
USER_ACCESS = [
"add_image_by_config",
"get_image_config",
"get_image_list",
"get_image_dict",
"get_config",
"add_monitor_image",
@ -312,6 +311,7 @@ class BECImageShow(BECPlotBase):
"lock_aspect_ratio",
"plot",
"remove",
"images",
]
def __init__(
@ -449,7 +449,8 @@ class BECImageShow(BECPlotBase):
else:
return image.config # TODO check if this works
def get_image_list(self) -> list[BECImageItem]:
@property
def images(self) -> list[BECImageItem]:
"""
Get the list of images.
Returns:
@ -461,6 +462,16 @@ class BECImageShow(BECPlotBase):
images.append(image)
return images
@images.setter
def images(self, value: dict[str, dict[str, BECImageItem]]):
"""
Set the images from a dictionary.
Args:
value (dict[str, dict[str, BECImageItem]]): The images to set, organized by source and id.
"""
self._images = value
def get_image_dict(self) -> dict[str, dict[str, BECImageItem]]:
"""
Get all images.