Move cache-reset ctx mngr to parent type: `FlowGraphics.reset_cache()`
parent
eda283f059
commit
75642929e3
|
@ -163,6 +163,16 @@ class FlowGraphic(pg.GraphicsObject):
|
||||||
|
|
||||||
return None
|
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):
|
class Curve(FlowGraphic):
|
||||||
'''
|
'''
|
||||||
|
@ -251,12 +261,6 @@ class Curve(FlowGraphic):
|
||||||
self.fast_path.clear()
|
self.fast_path.clear()
|
||||||
# self.fast_path = None
|
# self.fast_path = None
|
||||||
|
|
||||||
@cm
|
|
||||||
def reset_cache(self) -> None:
|
|
||||||
self.setCacheMode(QtWidgets.QGraphicsItem.NoCache)
|
|
||||||
yield
|
|
||||||
self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
|
|
||||||
|
|
||||||
def boundingRect(self):
|
def boundingRect(self):
|
||||||
'''
|
'''
|
||||||
Compute and then cache our rect.
|
Compute and then cache our rect.
|
||||||
|
|
|
@ -93,7 +93,7 @@ class BarItems(FlowGraphic):
|
||||||
'''
|
'''
|
||||||
# XXX: causes this weird jitter bug when click-drag panning
|
# XXX: causes this weird jitter bug when click-drag panning
|
||||||
# where the path curve will awkwardly flicker back and forth?
|
# where the path curve will awkwardly flicker back and forth?
|
||||||
cache_mode: int = QGraphicsItem.NoCache
|
# cache_mode: int = QGraphicsItem.NoCache
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue