Skip to content

Commit

Permalink
Remove synchronized
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbruno25 committed Jul 19, 2024
1 parent c6095d3 commit 9744920
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/can_explorer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,13 @@
from typing import cast

import dearpygui.dearpygui as dpg
from wrapt import synchronized

from can_explorer.configs import Default
from can_explorer.plotting import PlotData, PlotRow
from can_explorer.resources import Percentage
from can_explorer.tags import Tag
from can_explorer.ui_builder import UIBuilder

# Some dpg functionality is not thread safe
# ie: adding and removing widgets
# The synchronized decorator is used to provide
# the instance with a lock for thread safety
# https://github.com/GrahamDumpleton/wrapt/blob/develop/blog/07-the-missing-synchronized-decorator.md


class PlotView:
_format: Callable = Default.ID_FORMAT
Expand Down Expand Up @@ -59,7 +52,6 @@ def _sync_rows(self) -> None:
def get_rows(self) -> dict:
return self._row_dict.copy()

@synchronized
def update(self, can_id: int, plot_data: PlotData) -> None:
if can_id not in self._row_keys:
self._row_keys.append(can_id)
Expand All @@ -68,17 +60,14 @@ def update(self, can_id: int, plot_data: PlotData) -> None:
label=self._format(can_id), data=plot_data, height=self._height
)

@synchronized
def remove(self, can_id: int) -> None:
self._row_keys.remove(can_id)
self._row_dict[can_id].hide()

@synchronized
def clear(self) -> None:
while self._row_keys:
self.remove(self._row_keys[0])

@synchronized
def set_format(self, id_format: Callable) -> None:
"""
Set the format CAN id's will be displayed as.
Expand All @@ -91,7 +80,6 @@ def set_format(self, id_format: Callable) -> None:

self._format = id_format

@synchronized
def set_height(self, height: int) -> None:
"""
Set the height of all plots.
Expand Down

0 comments on commit 9744920

Please sign in to comment.