Esempio n. 1
0
File: base.py Progetto: pbx/kupfer
    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)
Esempio n. 2
0
    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)
Esempio n. 3
0
	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))