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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [1647517a84]:

  • File uikit.py — part of check-in [d90db23c73] at 2016-10-28 18:11:30 on branch trunk — Move liststore_edit() and app_bin_check() from configwin. to uikit.

    Allow ListStore for config_play/_record/_specbuttons without `editable` row [2], which is now a property of the CellRenderers (instead of a cell-attribute).

    Specialized uikit.config_treeview() builds a custom two-column TreeView now. (user: mario, size: 28574) [annotate] [blame] [check-ins using]

To Artifact [26d04e8c56]:


508
509
510
511
512
513
514


515


516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
        w.show_all()
        return w
    
    
    # Config win table (editable dictionary, two columns w/ executable indicator pixbuf)
    @staticmethod
    def config_treeview(opt, columns=["Icon", "Command"]):


        liststore = gtk.ListStore(str, str, str)


        w = gtk.TreeView(liststore)
        lno = len(columns)
        # two text columns and renderers
        for i in range(0, lno):
            c = gtk.TreeViewColumn(columns[i])
            c.set_resizable(True)
            c.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            c.set_fixed_width(150 + 75*i)
            r = gtk.CellRendererText()
            c.pack_end(r, expand=True)
            r.set_property("editable", True)
            r.connect("edited", uikit.liststore_edit, (liststore, i))
            c.add_attribute(r, "text", i)
            #c.add_attribute(r, "editable", 2)
            w.append_column(c)







>
>
|
>
>

<





|







508
509
510
511
512
513
514
515
516
517
518
519
520

521
522
523
524
525
526
527
528
529
530
531
532
533
        w.show_all()
        return w
    
    
    # Config win table (editable dictionary, two columns w/ executable indicator pixbuf)
    @staticmethod
    def config_treeview(opt, columns=["Icon", "Command"]):
        lno = len(columns)
        if lno == 2:
            liststore = gtk.ListStore(str, str, str)
        else:
            liststore = gtk.ListStore(*[str for i in range(0, lno)])
        w = gtk.TreeView(liststore)

        # two text columns and renderers
        for i in range(0, lno):
            c = gtk.TreeViewColumn(columns[i])
            c.set_resizable(True)
            c.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
            c.set_fixed_width(int(430/lno))
            r = gtk.CellRendererText()
            c.pack_end(r, expand=True)
            r.set_property("editable", True)
            r.connect("edited", uikit.liststore_edit, (liststore, i))
            c.add_attribute(r, "text", i)
            #c.add_attribute(r, "editable", 2)
            w.append_column(c)
538
539
540
541
542
543
544

545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
        return w, liststore
        
    # Generic Gtk callback to update ListStore when entries get edited.
    # where user_data = (liststore, column #id)
    @staticmethod
    def liststore_edit(cell, row, text, user_data):
        #log.EDIT(cell, row, text, user_data)

        liststore, column = user_data
        liststore[row][column] = text
        # update executable-indicator pixbuf
        if column == 1 and len(liststore) == 3 and liststore[row][2].startswith("gtk."):
            liststore[row][2] = uikit.app_bin_check(text)
        # add new row if editing last
        if row == len(liststore) -1:
            liststore.append(*["" for c in liststore[column]])

    # return OK or CANCEL depending on availability of app
    @staticmethod
    def app_bin_check(v):
        bin = re.findall(r"(?<![$(`%-;/$])\b(\w+(?:-\w+)*)", v)
        if bin:
            bin = [find_executable(bin) for bin in bin]







>



|

|
|
|







541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
        return w, liststore
        
    # Generic Gtk callback to update ListStore when entries get edited.
    # where user_data = (liststore, column #id)
    @staticmethod
    def liststore_edit(cell, row, text, user_data):
        #log.EDIT(cell, row, text, user_data)
        row = int(row)
        liststore, column = user_data
        liststore[row][column] = text
        # update executable-indicator pixbuf
        if column == 1 and len(liststore[0]) == 3 and liststore[row][2].startswith("gtk-"):
            liststore[row][2] = uikit.app_bin_check(text)
        # add new row when editing last one
        if len(text) and (row + 1) == len(liststore):
            liststore.append(["", "", "gtk-new"])

    # return OK or CANCEL depending on availability of app
    @staticmethod
    def app_bin_check(v):
        bin = re.findall(r"(?<![$(`%-;/$])\b(\w+(?:-\w+)*)", v)
        if bin:
            bin = [find_executable(bin) for bin in bin]