36 from python_qt_binding.QtCore 
import Signal, QSize
    37 from python_qt_binding.QtWidgets 
import QLabel
    38 from .util 
import IconHelper
    42     A Widget which displays incremental battery state, including a status tip.    43     To use this widget simply call :func:`update_perc` and :func:`update_time`    44     to change the displayed charge percentage and time remaining, respectively.    46     :param name: The name of this widget    49     state_changed = Signal(int)
    51     def __init__(self, name='Battery', icons=None, charge_icons=None,
    52                  icon_paths=
None, suppress_overlays=
False, stale_icon=
None):
    53         super(BatteryDashWidget, self).
__init__()
    58                 icons.append([
'ic-battery-%s.svg' % (x * 20)])
    59                 charge_icons.append([
'ic-battery-charge-%s.svg' % (x * 20)])
    61             stale_icon = [
'ic-battery-0.svg', 
'ol-stale-battery.svg']
    62         icon_paths = (icon_paths 
if icon_paths 
else []) + [[
'rqt_robot_dashboard', 
'images']]
    65         for path 
in icon_paths:
    66             paths.append(os.path.join(rp.get_path(path[0]), path[1]))
    69         icons.append(stale_icon)
    70         charge_icons.append(stale_icon) 
    71         converted_icons = self._icon_helper.set_icon_lists(icons, charge_icons, suppress_overlays)
    85             self.setPixmap(self.
_icons[-1].pixmap(QSize(60, 100)))
    87             self.setPixmap(self.
_charge_icons[state].pixmap(QSize(60, 100)))
    89             self.setPixmap(self.
_icons[state].pixmap(QSize(60, 100)))
    94         Read-only accessor for the widgets current state.   103         Update the displayed battery percentage.   104         The default implementation of this method displays in 20% increments   106         :param val: The new value to be displayed.   113         Set the state of this button.   114         This will also update the icon for the button based on the ``self._icons`` list   116         :raises IndexError: If state is not a proper index to ``self._icons``   118         :param state: The state to set.   121         if 0 <= state 
and state < len(self.
_icons):
   123             self.state_changed.emit(self.
__state)
   125             raise IndexError(
"%s update_state received invalid state: %s" % (self.
_name, state))
   130             self.setToolTip(
"%s: %.2f%% remaining" % (self.
_name, fval))
   132             self.setToolTip(
"%s: %s%% remaining" % (self.
_name, value))
   135         """Set button to stale.   137         Not used by base dashboard implementation.   141         self.setToolTip(
"%s: Stale" % self.
_name)