Move cache-reset ctx mngr to parent type: `FlowGraphics.reset_cache()`

log_linearized_curve_overlays
Tyler Goodlet 2023-02-28 18:01:13 -05:00
parent eda283f059
commit 75642929e3
2 changed files with 11 additions and 7 deletions

View File

@ -163,6 +163,16 @@ class FlowGraphic(pg.GraphicsObject):
return None
@cm
def reset_cache(self) -> None:
self.setCacheMode(QtWidgets.QGraphicsItem.NoCache)
try:
log.debug(f'{self._name} -> CACHE DISABLE')
yield
finally:
log.debug(f'{self._name} -> CACHE ENABLE')
self.setCacheMode(self.cache_mode)
class Curve(FlowGraphic):
'''
@ -251,12 +261,6 @@ class Curve(FlowGraphic):
self.fast_path.clear()
# self.fast_path = None
@cm
def reset_cache(self) -> None:
self.setCacheMode(QtWidgets.QGraphicsItem.NoCache)
yield
self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
def boundingRect(self):
'''
Compute and then cache our rect.

View File

@ -93,7 +93,7 @@ class BarItems(FlowGraphic):
'''
# XXX: causes this weird jitter bug when click-drag panning
# where the path curve will awkwardly flicker back and forth?
cache_mode: int = QGraphicsItem.NoCache
# cache_mode: int = QGraphicsItem.NoCache
def __init__(
self,