Skip to content

Commit

Permalink
STY: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zdomke committed Apr 30, 2024
1 parent 954f386 commit 6045209
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions pydm/widgets/baseplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ def color_string(self) -> str:
-------
str
"""
return str(
utilities.colors.svg_color_from_hex(self.color.name(), hex_on_fail=True)
)
return str(utilities.colors.svg_color_from_hex(self.color.name(), hex_on_fail=True))

@color_string.setter
def color_string(self, new_color_string: str) -> None:
Expand Down Expand Up @@ -189,11 +187,7 @@ def threshold_color_string(self) -> str:
-------
str
"""
return str(
utilities.colors.svg_color_from_hex(
self.threshold_color.name(), hex_on_fail=True
)
)
return str(utilities.colors.svg_color_from_hex(self.threshold_color.name(), hex_on_fail=True))

@property
def threshold_color(self) -> QColor:
Expand Down Expand Up @@ -650,9 +644,7 @@ def __init__(
# The pyqtgraph PlotItem.setAxisItems() will always add an an AxisItem called left whether you asked
# it to or not. This will clear it if not specifically requested.
plotItem.removeAxis("left")
super(BasePlot, self).__init__(
parent=parent, background=background, plotItem=plotItem
)
super(BasePlot, self).__init__(parent=parent, background=background, plotItem=plotItem)

self.plotItem = plotItem
self.plotItem.hideButtons()
Expand Down Expand Up @@ -745,24 +737,18 @@ def addCurve(
"""

if curve_color is None:
curve_color = utilities.colors.default_colors[
len(self._curves) % len(utilities.colors.default_colors)
]
curve_color = utilities.colors.default_colors[len(self._curves) % len(utilities.colors.default_colors)]
plot_data_item.color_string = curve_color

self._curves.append(plot_data_item)

if y_axis_name is None:
if utilities.is_qt_designer():
# If we are just in designer, add an axis that will not conflict with the pyqtgraph default
self.addAxis(
plot_data_item=plot_data_item, name="Axis 1", orientation="left"
)
self.addAxis(plot_data_item=plot_data_item, name="Axis 1", orientation="left")
# If not in designer and the user did not name the axis, use the pyqtgraph default one named left
elif "left" not in self.plotItem.axes:
self.addAxis(
plot_data_item=plot_data_item, name="left", orientation="left"
)
self.addAxis(plot_data_item=plot_data_item, name="left", orientation="left")
else:
self.plotItem.linkDataToAxis(plot_data_item, "left")
elif y_axis_name in self.plotItem.axes:
Expand Down Expand Up @@ -1380,11 +1366,7 @@ def maxRedrawRate(self, redraw_rate: int) -> None:
self.redraw_timer.setInterval(int((1.0 / self._redraw_rate) * 1000))

def pausePlotting(self) -> bool:
(
self.redraw_timer.stop()
if self.redraw_timer.isActive()
else self.redraw_timer.start()
)
(self.redraw_timer.stop() if self.redraw_timer.isActive() else self.redraw_timer.start())
return self.redraw_timer.isActive()

def mouseMoved(self, evt: QMouseEvent) -> None:
Expand Down

0 comments on commit 6045209

Please sign in to comment.