Skip to content

Commit

Permalink
Minor performance improvement to DataPanelListItem init.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmeyer committed Nov 27, 2024
1 parent a258a1d commit d4f354f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nion/swift/DataPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ class DataPanelListItem(CanvasItem.CanvasItemComposition):
def __init__(self, display_item: DisplayItem.DisplayItem, ui: UserInterface.UserInterface, font_metrics_fn: typing.Callable[[str, str], UserInterface.FontMetrics]) -> None:
super().__init__()

self._begin_batch_update()

self.__display_item = display_item
self.__ui = ui
self.__font_metrics_fn = font_metrics_fn
Expand Down Expand Up @@ -618,6 +620,8 @@ def thumbnail_updated() -> None:
self.__status_canvas_item = status_str_text_canvas_item
self.__item_changed_listener = display_item.item_changed_event.listen(ReferenceCounting.weak_partial(DataPanelListItem.__item_changed, self))

self._end_batch_update()

def close(self) -> None:
self.__thumbnail_updated_event_listener = typing.cast(typing.Any, None)
self.__thumbnail_source = typing.cast(typing.Any, None)
Expand Down

0 comments on commit d4f354f

Please sign in to comment.