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

WIP image with image item init fixed

This commit is contained in:
2025-04-08 14:53:55 +02:00
parent c2a83c0830
commit 22be20a799
2 changed files with 14 additions and 9 deletions

View File

@ -125,16 +125,15 @@ class Image(PlotBase):
popups: bool = True,
**kwargs,
):
self._main_image = ImageItem(parent_image=self)
self._color_bar = None
if config is None:
config = ImageConfig(widget_class=self.__class__.__name__)
self.gui_id = config.gui_id
self._color_bar = None
self._main_image = ImageItem()
super().__init__(
parent=parent, config=config, client=client, gui_id=gui_id, popups=popups, **kwargs
)
# For PropertyManager identification
self.setObjectName("Image")
self._main_image.parent_image = self
self.plot_item.addItem(self._main_image)
self.scan_id = None

View File

@ -82,10 +82,12 @@ class ImageItem(BECConnector, pg.ImageItem):
self.config = config
else:
self.config = config
self.parent_image = parent_image
self.parent_id = self.parent_image.gui_id
super().__init__(config=config, gui_id=gui_id)
pg.ImageItem.__init__(self)
if parent_image is not None:
self.set_parent(parent_image)
else:
self.parent_image = None
self.parent_id = None
super().__init__(config=config, gui_id=gui_id, **kwargs)
self.raw_data = None
self.buffer = []
@ -94,6 +96,10 @@ class ImageItem(BECConnector, pg.ImageItem):
# Image processor will handle any setting of data
self._image_processor = ImageProcessor(config=self.config.processing)
def set_parent(self, parent: BECConnector):
self.parent_image = parent
self.parent_id = parent.gui_id
def parent(self):
return self.parent_image