Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -58,11 +58,11 @@ GdkPixbuf = gtk.gdk empty_pixbuf = GdkPixbuf.Pixbuf(gtk.gdk.COLORSPACE_RGB,True,8,16,16) empty_pixbuf.fill(0xFFFFFFFF) # prepare gtkbuilder data -ui_xml = pkgutil.get_data("config", "gtk3.xml") +ui_xml = pkgutil.get_data("config", "gtk3.xml").decode("utf-8") if ver == 2: ui_xml = ui_xml.replace('version="3.0"', 'version="2.16"') @@ -427,14 +427,15 @@ # Attach textual menu entry and callback @staticmethod def add_menu(menuwidget, label, action): - m = gtk.MenuItem(label) - m.connect("activate", action) - m.show() - menuwidget.add(m) + for where in list(menuwidget): + m = gtk.MenuItem(label) + m.connect("activate", action) + m.show() + where.add(m) # gtk.messagebox @staticmethod def msg(text, style=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE): @@ -455,16 +456,22 @@ # Pixbug loader (from inline string, as in `logo.png`) @staticmethod def pixbuf(buf, fmt="png", decode=True, gzip=False): - p = GdkPixbuf.PixbufLoader(*[fmt] if fmt else []) - if decode and re.match("^[\w+/=\s]+$", buf): + if fmt and ver==3: + p = GdkPixbuf.PixbufLoader.new_with_type(fmt) + elif fmt: + p = GdkPixbuf.PixbufLoader(fmt) + else: + p = GdkPixbuf.PixbufLoader() + if decode and re.match("^[\w+/=\s]+$", str(buf)): buf = base64.b64decode(buf) # inline encoding if gzip: buf = zlib.decompress(buf) - p.write(buf, len(buf)) + if buf: + p.write(buf) pix = p.get_pixbuf() p.close() return pix @@ -561,11 +568,13 @@ progressbar.set_property("text", msg) progresswin.add(progressbar) progresswin.show_all() try: - if p<1: + if p <= 0.0: + pass + elif p < 1.0: progressbar.set_fraction(p) progressbar.set_property("text", msg) while gtk.events_pending(): gtk.main_iteration(False) else: progresswin.hide()