rqt_robot_dashboard.util module

class rqt_robot_dashboard.util.IconHelper(context, paths=None, name='IconHelper')

Bases: object

Helper class to easily access images and build QIcons out of lists of file names

add_image_path(path)

Paths added will be searched for images by the _find_image function Paths will be searched in revearse order by add time The last path to be searched is always rqt_robot_dashboard/images Subdirectories are not recursively searched

Parameters:

path (str) – The path to add to the image paths list

build_icon(image_name_list, mode=python_qt_binding.QtGui.QIcon.Normal, state=python_qt_binding.QtGui.QIcon.On)

Convenience function to create an icon from a list of file names

Parameters:
  • image_name_list (list of str) – List of file image names to make into an icon

  • mode (int) – The mode of the QIcon to be created.

  • state (int) – the state of the QIcon to be created.

find_image(path)

Convenience function to help with finding images. Path can either be specified as absolute paths or relative to any path in _image_paths

Parameters:

path (str) – The path or name of the image.

make_icon(image_list, mode=python_qt_binding.QtGui.QIcon.Normal, state=python_qt_binding.QtGui.QIcon.On)

Helper function to create QIcons from lists of image files Warning: svg files interleaved with other files will not render correctly

Parameters:
  • image_list – list of image paths to layer into an icon.

  • mode (int) – The mode of the QIcon to be created.

  • state (int) – the state of the QIcon to be created.

set_icon_lists(icons, clicked_icons=None, suppress_overlays=False)

Sets up the icon lists for the button states. There must be one index in icons for each state.

Raises:

IndexError – if icons is not a list of lists of strings

Parameters:
  • icons (list) – A list of lists of strings to create icons for the states of this button. If only one is supplied then ok, warn, error, stale icons will be created with overlays

  • clicked_icons (list) – A list of clicked state icons. len must equal icons

  • suppress_overlays (bool) – if false and there is only one icon path supplied

rqt_robot_dashboard.util.dasherr(logger, msg, obj, title='Error')

Logs a message with logger.error and displays a QMessageBox to the user

Parameters:
  • msg (str) – Message to display.

  • obj (QObject) – Parent object for the QMessageBox

  • title (str) – An optional title for the QMessageBox`

rqt_robot_dashboard.util.dashinfo(logger, msg, obj, title='Info')

Logs a message with logger.info and displays a QMessageBox to the user

Parameters:
  • msg (str) – Message to display.

  • obj (QObject) – Parent object for the QMessageBox

  • title (str) – An optional title for the QMessageBox`

rqt_robot_dashboard.util.dashwarn(logger, msg, obj, title='Warning')

Logs a message with logger.warning and displays a QMessageBox to the user

Parameters:
  • msg (str) – Message to display.

  • obj (QObject) – Parent object for the QMessageBox

  • title (str) – An optional title for the QMessageBox`