436
437
438
439
440
441
442
443
444
445
446
447
448
449 | # gtk.messagebox
@staticmethod
def msg(text, style=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE):
m = gtk.MessageDialog(None, 0, style, buttons, message_format=text)
m.show()
m.connect("response", lambda *w: m.destroy())
# 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) |
>
>
>
>
>
>
>
>
>
>
>
| 436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460 | # gtk.messagebox
@staticmethod
def msg(text, style=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE):
m = gtk.MessageDialog(None, 0, style, buttons, message_format=text)
m.show()
m.connect("response", lambda *w: m.destroy())
# apply gtkrc stylesheet
@staticmethod
def load_theme(theme=None):
if theme:
for dir in (conf.dir, conf.share, "/usr/share"):
f = dir + "/themes/" + theme + "/gtk-2.0/gtkrc"
if os.path.exists(f):
gtk.rc_parse(f)
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) |