ros-visualization / qt_gui_core

BSD 3-Clause "New" or "Revised" License
37 stars 76 forks source link

Exporting perspectives fails with QColor setting #271

Open Kettenhoax opened 1 year ago

Kettenhoax commented 1 year ago

In ROS humble, when exporting the current perspective via the rqt GUI, while a plugin is instanced that saves a QColor setting, the export fails.

Traceback (most recent call last):
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 188, in save_settings_completed
    callback(*callback_args)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 399, in _on_export_perspective_continued
    self._convert_values(data, self._export_value)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 423, in _convert_values
    self._convert_values(groups[group], convert_function)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 423, in _convert_values
    self._convert_values(groups[group], convert_function)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 423, in _convert_values
    self._convert_values(groups[group], convert_function)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 420, in _convert_values
    keys[key] = convert_function(keys[key])
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 463, in _export_value
    reimported = self._import_value(data)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/qt_gui/perspective_manager.py", line 428, in _import_value
    return eval(value['repr'])
  File "<string>", line 1
    <PyQt5.QtGui.QColor object at 0x7f238b461540>
    ^
SyntaxError: invalid syntax

I created a minimal plugin example, that when loaded in rqt can reproduce the issue: https://gist.github.com/Kettenhoax/5e83c83ba2f8887e4fe8da121bd8b367