Check-in [f5d46dca11]
Overview
| Comment: | More PixbufLoader workarounds for Gtk3, and get_data() casting for Python 3. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
f5d46dca1167278ee714299deffbb08b |
| User & Date: | mario on 2015-04-01 15:42:08 |
| Other Links: | manifest | tags |
Context
|
2015-04-01
| ||
| 15:43 | Nicer error message, and compacter plugin comment. Add default config value in init. check-in: 6226dc5594 user: mario tags: trunk | |
| 15:42 | More PixbufLoader workarounds for Gtk3, and get_data() casting for Python 3. check-in: f5d46dca11 user: mario tags: trunk | |
| 15:40 | Register extension menu entries twice (main menu, and stream context submenu), to avert Gtk warning. check-in: 3bc568c0e4 user: mario tags: trunk | |
Changes
Modified uikit.py from [048bd8afa3] to [e359ed9045].
| ︙ | ︙ | |||
56 57 58 59 60 61 62 |
import gtk
import gobject
GdkPixbuf = gtk.gdk
empty_pixbuf = GdkPixbuf.Pixbuf(gtk.gdk.COLORSPACE_RGB,True,8,16,16)
empty_pixbuf.fill(0xFFFFFFFF)
# prepare gtkbuilder data
| | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
import gtk
import gobject
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").decode("utf-8")
if ver == 2:
ui_xml = ui_xml.replace('version="3.0"', 'version="2.16"')
# simplified gtk constructors ---------------------------------------------
class uikit:
|
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
b.pack_start(w2, expand=True, fill=True)
return b
# Attach textual menu entry and callback
@staticmethod
def add_menu(menuwidget, label, action):
| > | | | | | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
b.pack_start(w2, expand=True, fill=True)
return b
# Attach textual menu entry and callback
@staticmethod
def add_menu(menuwidget, label, action):
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):
m = gtk.MessageDialog(None, 0, style, buttons, message_format=text)
m.show()
|
| ︙ | ︙ | |||
453 454 455 456 457 458 459 |
gtk.rc_parse(f)
pass
# Pixbug loader (from inline string, as in `logo.png`)
@staticmethod
def pixbuf(buf, fmt="png", decode=True, gzip=False):
| > > > | > > | > | | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 |
gtk.rc_parse(f)
pass
# Pixbug loader (from inline string, as in `logo.png`)
@staticmethod
def pixbuf(buf, fmt="png", decode=True, gzip=False):
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)
if buf:
p.write(buf)
pix = p.get_pixbuf()
p.close()
return pix
|
| ︙ | ︙ | |||
559 560 561 562 563 564 565 |
#########progressbar.set_property("visible", True)
progressbar.set_property("show_text", True)
progressbar.set_property("text", msg)
progresswin.add(progressbar)
progresswin.show_all()
try:
| | > > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
#########progressbar.set_property("visible", True)
progressbar.set_property("show_text", True)
progressbar.set_property("text", msg)
progresswin.add(progressbar)
progresswin.show_all()
try:
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()
except: return
|
| ︙ | ︙ |