Move cache-reset ctx mngr to parent type: `FlowGraphics.reset_cache()`
parent
a81b51b142
commit
5c08b5658f
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue