Simplify `FlowGraphics.x_last()` logics

storage_cli
Tyler Goodlet 2023-02-28 16:02:01 -05:00
parent e2cb1aca8e
commit 6df2c3d009
2 changed files with 9 additions and 5 deletions

View File

@ -158,7 +158,10 @@ class FlowGraphic(pg.GraphicsObject):
drawn yet, ``None``. 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): class Curve(FlowGraphic):

View File

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