def get_pixbuf(self, id): module = self.get_module(id) if module.__icon__: if type(module.__icon__) != list: if module.__icon__.endswith(".png"): icon_path = os.path.join(DATA_DIR, "pixmaps", module.__icon__) pixbuf = gtk.gd.pixbuf_new_from_file(icon_path) else: pixbuf = icon.get_with_name(module.__icon__, size=24) else: pixbuf = icon.get_with_list(module.__icon__, size=24) return pixbuf
def draw_title(self): eventbox = gtk.EventBox() eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white")) self.pack_start(eventbox, False, False, 0) vbox = gtk.VBox() eventbox.add(vbox) align = gtk.Alignment(0.5, 0.5, 1.0, 1.0) align.set_padding(5, 5, 5, 5) vbox.pack_start(align) hbox = gtk.HBox(False, 6) align.add(hbox) inner_vbox = gtk.VBox(False, 6) hbox.pack_start(inner_vbox) name = gtk.Label() name.set_markup("<b><big>%s</big></b>" % self.__title__) name.set_alignment(0, 0.5) inner_vbox.pack_start(name, False, False, 0) if self.__url__: align = gtk.Alignment(0.5, 0.5, 1.0, 1.0) inner_vbox.pack_start(align) inner_hbox = gtk.HBox(False, 0) align.add(inner_hbox) left_box = gtk.VBox(False, 6) inner_hbox.pack_start(left_box) right_box = gtk.VBox(False, 6) inner_hbox.pack_start(right_box, False, False, 0) desc = gtk.Label(self.__desc__) desc.set_ellipsize(pango.ELLIPSIZE_END) desc.set_alignment(0, 1) left_box.pack_start(desc, False, False, 0) more = gtk.Label() more.set_markup('<a href="%s">%s</a>' % (self.__url__, "More")) right_box.pack_start(more, False, False, 0) else: desc = gtk.Label(self.__desc__) desc.set_ellipsize(pango.ELLIPSIZE_END) desc.set_alignment(0, 0.5) inner_vbox.pack_start(desc, False, False, 0) if self.__icon__: if type(self.__icon__) != list: if self.__icon__.endswith(".png"): icon_path = os.path.join(DATA_DIR, "pixmaps", self.__icon__) image = gtk.image_new_from_file(icon_path) else: pixbuf = icon.get_with_name(self.__icon__, size=48) image = gtk.image_new_from_pixbuf(pixbuf) else: pixbuf = icon.get_with_list(self.__icon__, size=48) image = gtk.image_new_from_pixbuf(pixbuf) image.set_alignment(0, 0) image.set_padding(5, 5) hbox.pack_end(image, False, False, 0) vbox.pack_start(gtk.HSeparator(), False, False, 0)