def get_icon(self): """ Returns an icon in GIcon format Subclasses should implement: get_gicon and get_icon_name, if they make sense. The methods are tried in that order. """ gicon = self.get_gicon() if gicon and icons.is_good(gicon): return gicon icon_name = self.get_icon_name() if icon_name and icons.get_good_name_for_icon_names((icon_name, )): return icons.get_gicon_for_names(icon_name) return icons.get_gicon_for_names(self.fallback_icon_name)
def get_icon(self): """ Returns an icon in GIcon format Subclasses should implement: get_gicon and get_icon_name, if they make sense. The methods are tried in that order. """ gicon = self.get_gicon() if gicon and icons.is_good(gicon): return gicon icon_name = self.get_icon_name() if icon_name and icons.get_good_name_for_icon_names((icon_name, )): return icons.get_gicon_for_names(icon_name) fallback_class = Action if isinstance(self, Action) else KupferObject return icons.get_gicon_for_names(fallback_class.get_icon_name(self))