53
60
def __init__(self, name=None, type=ImageNone, size = 32):
54
61
gtk.Image.__init__(self)
56
if type == ImagePlugin and name != None:
57
iconpath = "%s/plugin-%s.svg" % (PixmapDir, name)
58
if not os.path.exists(iconpath):
59
iconpath = "%s/plugin-unknown.svg"%PixmapDir
61
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
62
self.set_from_pixbuf(pixbuf)
64
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
66
elif type == ImageCategory and name != None:
67
iconpath = "%s/category-%s.svg" % (PixmapDir, name)
68
if not os.path.exists(iconpath):
69
iconpath = "%s/category-uncategorized.svg" % PixmapDir
71
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
72
self.set_from_pixbuf(pixbuf)
74
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
64
if type == ImagePlugin:
65
iconpath = "%s/plugin-%s.svg" % (PixmapDir, name)
66
if not os.path.exists(iconpath):
67
iconpath = "%s/plugin-unknown.svg"%PixmapDir
69
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
70
self.set_from_pixbuf(pixbuf)
72
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
74
elif type == ImageCategory:
75
iconpath = "%s/category-%s.svg" % (PixmapDir, name)
76
if not os.path.exists(iconpath):
77
iconpath = "%s/category-uncategorized.svg" % PixmapDir
79
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(iconpath, size, size)
80
self.set_from_pixbuf(pixbuf)
82
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
84
elif type == ImageThemed:
85
iconTheme = gtk.icon_theme_get_default()
87
pixbuf = iconTheme.load_icon(name, size, 0)
88
self.set_from_pixbuf(pixbuf)
90
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
92
elif type == ImageStock:
94
self.set_from_stock(name, size)
96
self.set_from_stock(gtk.STOCK_MISSING_IMAGE, gtk.ICON_SIZE_BUTTON)
76
98
class Label(gtk.Label):
77
99
def __init__(self, value = "", wrap = 160):
81
103
self.set_line_wrap(True)
82
104
self.set_size_request(wrap, -1)
106
class NotFoundBox(gtk.Alignment):
107
def __init__(self, value):
108
gtk.Alignment.__init__(self, 0.5, 0.5, 0.0, 0.0)
111
self.Warning = gtk.Label()
112
self.Markup = _("<span size=\"large\"><b>No matches found.</b> </span><span>\n\n Your filter \"<b>%s</b>\" does not match any items.</span>")
113
self.Warning.set_markup(self.Markup % value)
114
image = Image("face-surprise", ImageThemed, 48)
116
box.pack_start(image, False, False, 0)
117
box.pack_start(self.Warning, True, True, 15)
120
def update(self, value):
121
self.Warning.set_markup(self.Markup % value)
84
123
# Updates all registered setting when they where changed through CompizConfig
86
125
def __init__(self, context):