Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -25,11 +25,13 @@ # system import os.path import copy import sys +import re import base64 +import zlib import inspect from compat2and3 import unicode, xrange, PY3 import pkgutil @@ -387,11 +389,11 @@ if color: # wrap unstylable widgets into EventBox if not isinstance(w, gtk.Window): wrap = gtk.EventBox() wrap.add(w) - wrap.set_property("visible", True) + ##########wrap.set_property("visible", True) w = wrap # copy style object, modify settings s = w.get_style().copy() c = w.get_colormap().alloc_color(color) for state in (gtk.STATE_NORMAL, gtk.STATE_SELECTED): @@ -407,20 +409,20 @@ @staticmethod def label(text, size=400, markup=0): label = gtk.Label(text) if markup: label.set_markup(text) - label.set_property("visible", True) + #######label.set_property("visible", True) label.set_line_wrap(True) label.set_size_request(size, -1) return label # Wrap two widgets in horizontal box @staticmethod def hbox(w1, w2): b = gtk.HBox(homogeneous=False, spacing=10) - b.set_property("visible", True) + ######b.set_property("visible", True) b.pack_start(w1, expand=False, fill=False) b.pack_start(w2, expand=True, fill=True) return b @@ -452,22 +454,19 @@ pass # Pixbug loader (from inline string, as in `logo.png`) @staticmethod - def pixbuf(buf, fmt="png"): - p = GdkPixbuf.PixbufLoader(fmt) - try: # inline encoding - buf = base64.b64decode(buf) - except: - None - #print "PNG: %s" % len(buf) + def pixbuf(buf, fmt="png", decode=True, gzip=False): + p = GdkPixbuf.PixbufLoader(*[fmt] if fmt else []) + if decode and re.match("^[\w+/=\s]+$", buf): + buf = base64.b64decode(buf) # inline encoding + if gzip: + buf = zlib.decompress(buf) p.write(buf, len(buf)) - #print "FMT: %s" % p.get_format() pix = p.get_pixbuf() p.close() - #print "PIX: %s" % pix return pix @@ -488,11 +487,11 @@ def __init__(self, entries, no_scroll=1): # prepare widget gtk.ComboBox.__init__(self) - self.set_property("visible", True) + ########self.set_property("visible", True) cell = gtk.CellRendererText() self.pack_start(cell, True) self.add_attribute(cell, "text", 1) if no_scroll: self.connect("scroll_event", self.no_scroll) @@ -551,15 +550,15 @@ progresswin.set_property("width_request", 300) progresswin.set_property("default_height", 30) progresswin.set_property("height_request", 30) #progresswin.set_property("window_position", "center") progresswin.set_property("decorated", False) - progresswin.set_property("visible", True) + #######progresswin.set_property("visible", True) # GtkProgressBar "progressbar" progressbar = gtk.ProgressBar() - progressbar.set_property("visible", True) + #########progressbar.set_property("visible", True) progressbar.set_property("show_text", True) progressbar.set_property("text", msg) progresswin.add(progressbar) progresswin.show_all() @@ -605,10 +604,10 @@ def __init__(self, parent): a = gtk.AboutDialog() a.set_name(parent.meta["id"]) a.set_version(parent.meta["version"]) a.set_license(parent.meta["license"]) - a.set_authors(parent.meta["author"].split(",")) + a.set_authors((pkgutil.get_data("config", "CREDITS") or parent.meta["author"]).split("\n")) a.set_website(parent.meta["url"]) a.connect("response", lambda a, ok: ( a.hide(), a.destroy() ) ) - a.show() + a.show_all()