Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [048bd8afa3]:

To Artifact [e359ed9045]:


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")
if ver == 2:
    ui_xml = ui_xml.replace('version="3.0"', 'version="2.16"')



# simplified gtk constructors               ---------------------------------------------
class uikit:







|







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

432
433
434
435
436
437
438
439
440
441
442
        b.pack_start(w2, expand=True, fill=True)
        return b


    # 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)
        

    # 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()







>
|
|
|
|







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



460


461
462
463
464

465
466
467
468
469
470
471
472
                    gtk.rc_parse(f)
            pass

        
    # 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):
            buf = base64.b64decode(buf)  # inline encoding
        if gzip:
            buf = zlib.decompress(buf)

        p.write(buf, len(buf))
        pix = p.get_pixbuf()
        p.close()
        return pix
            
            









>
>
>
|
>
>
|



>
|







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
566


567
568
569
570
571
572
573
        #########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<1:


        progressbar.set_fraction(p)
        progressbar.set_property("text", msg)
        while gtk.events_pending(): gtk.main_iteration(False)
      else:
        progresswin.hide()
    except: return








|
>
>







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