code: def set_icon(self, icon, qtgui_module):
          
  
          if self._use_fallback:
              icon.addFile(self._fallback)
          else:
              for role, pixmap in self._roles.items():
                  if role.endswith("off"):
                      mode = role[:-3]
                      state = qtgui_module.QIcon.Off
                  elif role.endswith("on"):
                      mode = role[:-2]
                      state = qtgui_module.QIcon.On
                  else:
                      continue
  
                  mode = getattr(qtgui_module.QIcon, mode.title())
  
                  if pixmap:
                      icon.addPixmap(qtgui_module.QPixmap(pixmap), mode, state)
                  else:
                      icon.addPixmap(qtgui_module.QPixmap(), mode, state)
  
          self.icon = icon
docs: Save the icon and set its attributes.