[kupfer: 6/12] icons: factory ComposedIconSmall for create small composed icons



commit dfb1c846bc503539aa03763180b122705bf47c3c
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Thu Feb 4 21:19:47 2010 +0100

    icons: factory ComposedIconSmall for create small composed icons

 kupfer/icons.py           |   20 ++++++++++++++------
 kupfer/obj/contacts.py    |    2 +-
 kupfer/plugin/gajim.py    |    2 +-
 kupfer/plugin/putty.py    |    2 +-
 kupfer/plugin/skype.py    |    2 +-
 kupfer/plugin/tsclient.py |    2 +-
 kupfer/plugin/vinagre.py  |    2 +-
 7 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/kupfer/icons.py b/kupfer/icons.py
index fa343d7..a3ef9db 100644
--- a/kupfer/icons.py
+++ b/kupfer/icons.py
@@ -90,14 +90,15 @@ class ComposedIcon (Icon):
 	"""
 	A composed icon, which kupfer will render to pixbuf as
 	background icon with the decorating icon as emblem
-
-	@minimum_icon_size is the minimum size for
-	the composition to be drawn
 	"""
-	minimum_icon_size = 48
 
 	class Implementation (object):
-		"""Base class for the internal implementation"""
+		"""Base class for the internal implementation
+
+		@minimum_icon_size is the minimum size for
+		the composition to be drawn"""
+		minimum_icon_size = 48
+
 		def __init__(self, baseicon, emblem):
 			self.baseicon = baseicon
 			self.emblemicon = emblem
@@ -128,9 +129,16 @@ class ComposedIcon (Icon):
 		return None
 
 
+def ComposedIconSmall(baseicon, emblem, **kwargs):
+	"""Create composed icon for leaves with emblem visible on browser list"""
+	ci = ComposedIcon(baseicon, emblem, **kwargs)
+	ci.minimum_icon_size = 24
+	return ci
+
+
 def _render_composed_icon(composed_icon, icon_size):
 	# If it's too small, render as fallback icon
-	if icon_size < ComposedIcon.minimum_icon_size:
+	if icon_size < composed_icon.minimum_icon_size:
 		return _get_icon_for_standard_gicon(composed_icon, icon_size)
 	emblemicon = composed_icon.emblemicon
 	baseicon = composed_icon.baseicon
diff --git a/kupfer/obj/contacts.py b/kupfer/obj/contacts.py
index b9de28d..e5341d4 100644
--- a/kupfer/obj/contacts.py
+++ b/kupfer/obj/contacts.py
@@ -68,7 +68,7 @@ class EmailContact (ContactLeaf):
 		return self.object[EMAIL_KEY]
 
 	def get_gicon(self):
-		return icons.ComposedIcon(ContactLeaf.get_icon_name(self),"stock_mail")
+		return icons.ComposedIconSmall(self.get_icon_name(),"stock_mail")
 
 
 class JabberContact (ContactLeaf):
diff --git a/kupfer/plugin/gajim.py b/kupfer/plugin/gajim.py
index 9966e56..186c9c1 100644
--- a/kupfer/plugin/gajim.py
+++ b/kupfer/plugin/gajim.py
@@ -78,7 +78,7 @@ class GajimContact(JabberContact):
 		return "".join((self.object[JABBER_JID_KEY], self.object[GAJIM_ACCOUNT_KEY]))
 
 	def get_gicon(self):
-		return icons.ComposedIcon(JabberContact.get_icon_name(self), "gajim")
+		return icons.ComposedIconSmall(self.get_icon_name(), "gajim")
 
 
 class AccountStatus(Leaf):
diff --git a/kupfer/plugin/putty.py b/kupfer/plugin/putty.py
index 2b8517b..9dde4cb 100644
--- a/kupfer/plugin/putty.py
+++ b/kupfer/plugin/putty.py
@@ -36,7 +36,7 @@ class PuttySession(HostLeaf):
 		return self._description
 
 	def get_gicon(self):
-		return icons.ComposedIcon("computer", "putty")
+		return icons.ComposedIconSmall(self.get_icon_name(), "putty")
 
 
 class PuttyOpenSession(Action):
diff --git a/kupfer/plugin/skype.py b/kupfer/plugin/skype.py
index c4b1858..5b08245 100644
--- a/kupfer/plugin/skype.py
+++ b/kupfer/plugin/skype.py
@@ -190,7 +190,7 @@ class Contact(ContactLeaf):
 		return self._description
 
 	def get_gicon(self):
-		return icons.ComposedIcon(self.get_icon_name(), "skype")
+		return icons.ComposedIconSmall(self.get_icon_name(), "skype")
 
 
 class AccountStatus(Leaf):
diff --git a/kupfer/plugin/tsclient.py b/kupfer/plugin/tsclient.py
index 6bd8ef2..1a4030a 100644
--- a/kupfer/plugin/tsclient.py
+++ b/kupfer/plugin/tsclient.py
@@ -33,7 +33,7 @@ class TsclientSession(HostLeaf):
 		return self._description
 
 	def get_gicon(self):
-		return icons.ComposedIcon(HostLeaf.get_icon_name(self), "tsclient")
+		return icons.ComposedIconSmall(self.get_icon_name(), "tsclient")
 
 
 class TsclientOpenSession(Action):
diff --git a/kupfer/plugin/vinagre.py b/kupfer/plugin/vinagre.py
index a010cba..fa70b88 100644
--- a/kupfer/plugin/vinagre.py
+++ b/kupfer/plugin/vinagre.py
@@ -26,7 +26,7 @@ BOOKMARKS_FILE = '~/.local/share/vinagre/vinagre-bookmarks.xml'
 
 class Bookmark(HostServiceLeaf):
 	def get_gicon(self):
-		return icons.ComposedIcon(HostServiceLeaf.get_icon_name(self), "vinagre")
+		return icons.ComposedIconSmall(self.get_icon_name(), "vinagre")
 
 
 class VinagreStartSession(Action):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]