Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<author email="mabel@openrobotics.org">Mabel Zhang</author>
<author email="logans@cottsay.net">Scott K Logan</author>

<build_depend>qt6-base-dev</build_depend>
<build_depend>libqt6widgets6t64</build_depend>

<exec_depend>ament_index_python</exec_depend>
<exec_depend version_gte="0.2.19">python_qt_binding</exec_depend>
<exec_depend>python3-matplotlib</exec_depend>
Expand Down
8 changes: 5 additions & 3 deletions src/rqt_plot/data_plot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

from python_qt_binding import QT_BINDING
from python_qt_binding.QtCore import Qt, qWarning, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtGui import QColor, QColorConstants
from python_qt_binding.QtWidgets import QHBoxLayout, QWidget
from qt_gui_py_common.simple_settings_dialog import SimpleSettingsDialog
from rqt_py_common.ini_helper import pack, unpack
Expand Down Expand Up @@ -112,8 +112,10 @@ class DataPlot(QWidget):
SCALE_VISIBLE = 2
SCALE_EXTEND = 4

_colors = [Qt.blue, Qt.red, Qt.cyan, Qt.magenta, Qt.green,
Qt.darkYellow, Qt.black, Qt.darkCyan, Qt.darkRed, Qt.gray]
_colors = [QColorConstants.Blue, QColorConstants.Red, QColorConstants.Cyan,
QColorConstants.Magenta, QColorConstants.Green,
QColorConstants.DarkYellow, QColorConstants.Black,
QColorConstants.DarkCyan, QColorConstants.DarkRed, QColorConstants.Gray]

limits_changed = Signal()
_redraw = Signal()
Expand Down
8 changes: 4 additions & 4 deletions src/rqt_plot/data_plot/mat_data_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure

from python_qt_binding import QT_BINDING, QT_BINDING_VERSION
from python_qt_binding import QT_BINDING, QT_BINDING_VERSION, QtWidgets

try:
from pkg_resources import parse_version
Expand All @@ -48,7 +48,7 @@ def parse_version(s):
raise ImportError('A PySide version newer than 1.1.0 is required.')

from python_qt_binding.QtCore import Qt, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtGui import QColorConstants
from python_qt_binding.QtWidgets import QSizePolicy, QVBoxLayout, QWidget

if QT_BINDING == 'pyside':
Expand Down Expand Up @@ -77,7 +77,7 @@ def __init__(self, parent=None):
self.axes = self.figure.add_subplot(111)
self.axes.grid(True, color='gray')
self.safe_tight_layout()
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
self.updateGeometry()

def resizeEvent(self, event):
Expand Down Expand Up @@ -120,7 +120,7 @@ def __init__(self, parent=None):
def _limits_changed(self, event):
self.limits_changed.emit()

def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
def add_curve(self, curve_id, curve_name, curve_color=QColorConstants.Blue, markers_on=False):

# adding an empty curve and change the limits, so save and restore them
x_limits = self.get_xlim()
Expand Down
6 changes: 3 additions & 3 deletions src/rqt_plot/data_plot/pyqtgraph_data_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from pyqtgraph import mkBrush, mkPen, PlotWidget

from python_qt_binding.QtCore import Qt, Signal
from python_qt_binding.QtGui import QColor
from python_qt_binding.QtGui import QColorConstants
from python_qt_binding.QtWidgets import QVBoxLayout, QWidget

try:
Expand Down Expand Up @@ -71,10 +71,10 @@ def __init__(self, parent=None):
self._curves = {}
self._current_vline = None

def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
def add_curve(self, curve_id, curve_name, curve_color=QColorConstants.Blue, markers_on=False):
pen = mkPen(curve_color, width=1)
symbol = 'o'
symbolPen = mkPen(QColor(Qt.black))
symbolPen = mkPen(QColor(QColorConstants.Black))
symbolBrush = mkBrush(curve_color)
# this adds the item to the plot and legend
if markers_on:
Expand Down
12 changes: 6 additions & 6 deletions src/rqt_plot/data_plot/qwt_data_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import sys

from python_qt_binding.QtCore import QEvent, QPointF, QSize, Qt, qWarning, Signal
from python_qt_binding.QtGui import QBrush, QColor, QPen, QVector2D
from python_qt_binding.QtGui import QBrush, QColorConstants, QPen, QVector2D
import Qwt


Expand All @@ -45,7 +45,7 @@ class QwtDataPlot(Qwt.QwtPlot):

def __init__(self, *args):
super(QwtDataPlot, self).__init__(*args)
self.setCanvasBackground(Qt.white)
self.setCanvasBackground(QColorConstants.White)
self.insertLegend(Qwt.QwtLegend(), Qwt.QwtPlot.BottomLegend)

self._curves = {}
Expand All @@ -66,7 +66,7 @@ def __init__(self, *args):
self._last_click_coordinates = None

marker_axis_y = Qwt.QwtPlotMarker()
marker_axis_y.setLabelAlignment(Qt.AlignRight | Qt.AlignTop)
marker_axis_y.setLabelAlignment(Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignTop)
marker_axis_y.setLineStyle(Qwt.QwtPlotMarker.HLine)
marker_axis_y.setYValue(0.0)
marker_axis_y.attach(self)
Expand All @@ -75,8 +75,8 @@ def __init__(self, *args):
Qwt.QwtPlot.xBottom, Qwt.QwtPlot.yLeft, Qwt.QwtPicker.PolygonSelection,
Qwt.QwtPlotPicker.PolygonRubberBand, Qwt.QwtPicker.AlwaysOn, self.canvas()
)
self._picker.setRubberBandPen(QPen(Qt.blue))
self._picker.setTrackerPen(QPen(Qt.blue))
self._picker.setRubberBandPen(QPen(QColorConstants.Blue))
self._picker.setTrackerPen(QPen(QColorConstants.Blue))

# Initialize data
self.rescale()
Expand Down Expand Up @@ -114,7 +114,7 @@ def resizeEvent(self, event):
Qwt.QwtPlot.resizeEvent(self, event)
self.rescale()

def add_curve(self, curve_id, curve_name, curve_color=QColor(Qt.blue), markers_on=False):
def add_curve(self, curve_id, curve_name, curve_color=QColorConstants.Blue, markers_on=False):
curve_id = str(curve_id)
if curve_id in self._curves:
return
Expand Down
12 changes: 9 additions & 3 deletions src/rqt_plot/plot_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@

from ament_index_python.resources import get_resource
from python_qt_binding import loadUi
from python_qt_binding import QT_BINDING_VERSION
from python_qt_binding.QtCore import Qt, QTimer, qWarning, Slot
from python_qt_binding.QtGui import QIcon
from python_qt_binding.QtWidgets import QAction, QMenu, QWidget
from packaging.version import Version
if Version(QT_BINDING_VERSION) > Version('6.0.0'):
from python_qt_binding.QtGui import QAction
else:
from python_qt_binding.QtWidgets import QAction
from python_qt_binding.QtGui import QColorConstants, QIcon
from python_qt_binding.QtWidgets import QMenu, QWidget

from rosidl_parser.definition import AbstractGenericString
from rosidl_parser.definition import AbstractNestedType
Expand Down Expand Up @@ -228,8 +234,8 @@ def __init__(self, node, initial_topics=None, start_paused=False):
def switch_data_plot_widget(self, data_plot):
self.enable_timer(enabled=False)

self.data_plot_layout.removeWidget(self.data_plot)
if self.data_plot is not None:
self.data_plot_layout.removeWidget(self.data_plot)
self.data_plot.close()

self.data_plot = data_plot
Expand Down