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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [5abf53dbd8]:

  • File uikit.py — part of check-in [b784d408c1] at 2015-04-09 14:50:54 on branch action-mapfmts — Still some parameter renaming in action module to do. Optional support for row={} parameter in play/record calls, in case .pls/.m3u needs to be constructed (to retain title=). Adapt action playlist exporting to wrapper object, which preconverts plain URL lists or [rows] list, can itself call convert_playlist(), and optionalized file writing. Rewrite main save() and exportcat.save() to utilize new save_playlist(). Implement overwrite confirmation for Save-as dialog. (user: mario, size: 23117) [annotate] [blame] [check-ins using]

To Artifact [f012e456ad]:


360
361
362
363
364
365
366


367



368
369
370
371
372
373
374
375
376



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395



    #-- Save-As dialog
    #
    @staticmethod
    def save_file(title="Save As", parent=None, fn="", formats=[("*.pls", "*.pls"), ("*.xspf", "*.xpsf"), ("*.m3u", "*.m3u"), ("*.jspf", "*.jspf"), ("*.asx", "*.asx"), ("*.json", "*.json"), ("*.smil", "*.smil"), ("*.wpl", "*.wpl"), ("*","*")]):


        c = gtk.FileChooserDialog(title, parent, action=gtk.FILE_CHOOSER_ACTION_SAVE, buttons=(gtk.STOCK_CANCEL, 0, gtk.STOCK_SAVE, 1))



        # params
        if fn:
            c.set_current_name(fn)
            fn = ""
        for fname,ftype in formats:
            f = gtk.FileFilter()
            f.set_name(fname)
            f.add_pattern(ftype)
            c.add_filter(f)



        # display
        if c.run():
            fn = c.get_filename()  # return filaname
        c.destroy()
        # check if selected file exists, ask for confirmation
        if os.path.exists(fn):
            if uikit.msg("Overwrite existing file '%s' ?" % fn, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK_CANCEL, yes=1):
                return fn
            else:
                return None
        else:
            return fn
    
    
    
    # pass updates from another thread, ensures that it is called just once
    @staticmethod
    def do(lambda_func):
        gobject.idle_add(lambda: lambda_func() and False)







>
>
|
>
>
>
|








>
>
>
|



<
<
<
|
<
<
<
<







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388



389




390
391
392
393
394
395
396



    #-- Save-As dialog
    #
    @staticmethod
    def save_file(title="Save As", parent=None, fn="", formats=[("*.pls", "*.pls"), ("*.xspf", "*.xpsf"), ("*.m3u", "*.m3u"), ("*.jspf", "*.jspf"), ("*.asx", "*.asx"), ("*.json", "*.json"), ("*.smil", "*.smil"), ("*.wpl", "*.wpl"), ("*","*")]):

        # With overwrite confirmation
        c = gtk.FileChooserDialog(title, parent, action=gtk.FILE_CHOOSER_ACTION_SAVE,
                buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK))
        c.set_do_overwrite_confirmation(True)

        # Params
        if fn:
            c.set_current_name(fn)
            fn = ""
        for fname,ftype in formats:
            f = gtk.FileFilter()
            f.set_name(fname)
            f.add_pattern(ftype)
            c.add_filter(f)
        
        # Filter handlers don't work either.

        # Display and wait
        if c.run():
            fn = c.get_filename()  # return filaname
        c.destroy()



        return fn




    
    
    
    # pass updates from another thread, ensures that it is called just once
    @staticmethod
    def do(lambda_func):
        gobject.idle_add(lambda: lambda_func() and False)
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
    # manual signal binding with a dict of { (widget, signal): callback }
    @staticmethod
    def add_signals(builder, map):
        for (widget,signal),func in map.items():
            builder.get_widget(widget).connect(signal, func)

        
    # Pixbug loader (from inline string, as in `logo.png`)
    @staticmethod
    def pixbuf(buf, fmt="png", decode=True, gzip=False):
        if not buf or len(buf) < 16:
            return None
        if fmt and ver==3:
            p = GdkPixbuf.PixbufLoader.new_with_type(fmt)
        elif fmt:







|







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
    # manual signal binding with a dict of { (widget, signal): callback }
    @staticmethod
    def add_signals(builder, map):
        for (widget,signal),func in map.items():
            builder.get_widget(widget).connect(signal, func)

        
    # Pixbug loader (from inline string, as in `logo.png`, automatic base64 decoding, and gunzipping of raw data)
    @staticmethod
    def pixbuf(buf, fmt="png", decode=True, gzip=False):
        if not buf or len(buf) < 16:
            return None
        if fmt and ver==3:
            p = GdkPixbuf.PixbufLoader.new_with_type(fmt)
        elif fmt: