parameters: (self, icon, qtgui_module)
docstring: Save the icon and set its attributes.
docstring_summary: Save the icon and set its attributes.
docstring_tokens: Save the icon and set its attributes .
function: def set_icon(self, icon, qtgui_module):
          """Save the icon and set its attributes."""
  
          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
function_tokens: 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