Simplify `FlowGraphics.x_last()` logics

log_linearized_curve_overlays
Tyler Goodlet 2023-02-28 16:02:01 -05:00
parent 75807f4a96
commit 77401a94fb
2 changed files with 9 additions and 5 deletions

View File

@ -158,7 +158,10 @@ class FlowGraphic(pg.GraphicsObject):
drawn yet, ``None``.
'''
return self._last_line.x1() if self._last_line else None
if self._last_line:
return self._last_line.x1()
return None
class Curve(FlowGraphic):

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,
@ -113,8 +113,9 @@ class BarItems(FlowGraphic):
'''
if self._last_bar_lines:
close_arm_line = self._last_bar_lines[-1]
return close_arm_line.x2() if close_arm_line else None
else:
if close_arm_line:
return close_arm_line.x2()
return None
# Qt docs: https://doc.qt.io/qt-5/qgraphicsitem.html#boundingRect