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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [6f3acc5193]:

  • File uikit.py — part of check-in [ffaf262c43] at 2015-04-28 17:35:15 on branch trunk — Move `state.json` and .current restoration into GenericChannel.gui(). Current category is reselected by TreeView traversal on instantion now. Previous state now load through config.state() for channels/__init__, not in main/init_app_state anymore (just row:expand / winsizes now). Disable .currentcat() overwriting, redundant now in display_categories(). Still need to avoid second .select_current() call in first_show(). (user: mario, size: 25356) [annotate] [blame] [check-ins using]

To Artifact [c6a56b517d]:


108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

                # loop through cells
                for var in xrange(2, len(desc)):
                    cell = desc[var]
                    # cell renderer
                    if (cell[2] == "pixbuf"):
                        rend = gtk.CellRendererPixbuf()  # img cell
                        #rend.set_fixed_size(24, 24)
                        if (cell[1] == str):
                            cell[3]["stock_id"] = datapos  # for stock icons
                            expand = False
                        else:
                            pix_entry = datapos
                            cell[3]["pixbuf"] = datapos
                    else:







|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122

                # loop through cells
                for var in xrange(2, len(desc)):
                    cell = desc[var]
                    # cell renderer
                    if (cell[2] == "pixbuf"):
                        rend = gtk.CellRendererPixbuf()  # img cell
                        rend.set_fixed_size(24, 24)
                        if (cell[1] == str):
                            cell[3]["stock_id"] = datapos  # for stock icons
                            expand = False
                        else:
                            pix_entry = datapos
                            cell[3]["pixbuf"] = datapos
                    else:
216
217
218
219
220
221
222

223
224
225
226
227
228
229
    def tree(widget, entries, title="category", icon=gtk.STOCK_DIRECTORY):

        # list types
        ls = gtk.TreeStore(str, str)
        #log.DATA(".tree", entries)

        # add entries

        for entry in entries:
            if isinstance(entry, (str,unicode)):
                main = ls.append(None, [str(entry), icon])
            else:
                for sub_title in entry:
                    ls.append(main, [str(sub_title), icon])








>







216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
    def tree(widget, entries, title="category", icon=gtk.STOCK_DIRECTORY):

        # list types
        ls = gtk.TreeStore(str, str)
        #log.DATA(".tree", entries)

        # add entries
        main = None
        for entry in entries:
            if isinstance(entry, (str,unicode)):
                main = ls.append(None, [str(entry), icon])
            else:
                for sub_title in entry:
                    ls.append(main, [str(sub_title), icon])

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
461
462
        return len(uikit.idle_tasks) > 0
        


    # adds background color to widget,
    # eventually wraps it into a gtk.Window, if it needs a container
    @staticmethod
    def bg(w, color="", where=["bg"]):
        """ this method should be called after widget creation, and before .add()ing it to container """
        if color:
            # wrap unstylable widgets into EventBox
            if not isinstance(w, gtk.Window):
                wrap = gtk.EventBox()
                wrap.add(w)
                ##########wrap.set_property("visible", True)
                w = wrap
            # copy style object, modify settings
            s = w.get_style().copy()
            c = w.get_colormap().alloc_color(color)
            for state in (gtk.STATE_NORMAL, gtk.STATE_SELECTED):
                s.bg[state] = c
            w.set_style(s)
            # probably redundant, but better safe than sorry:
            w.modify_bg(gtk.STATE_NORMAL, c)
        # return modified or wrapped widget
        return w








|



|







|







437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
        return len(uikit.idle_tasks) > 0
        


    # adds background color to widget,
    # eventually wraps it into a gtk.Window, if it needs a container
    @staticmethod
    def bg(w, color="", where=["bg"], wrap=1):
        """ this method should be called after widget creation, and before .add()ing it to container """
        if color:
            # wrap unstylable widgets into EventBox
            if wrap and not isinstance(w, (gtk.Window, gtk.EventBox)):
                wrap = gtk.EventBox()
                wrap.add(w)
                ##########wrap.set_property("visible", True)
                w = wrap
            # copy style object, modify settings
            s = w.get_style().copy()
            c = w.get_colormap().alloc_color(color)
            for state in (gtk.STATE_NORMAL, gtk.STATE_SELECTED, gtk.STATE_ACTIVE):
                s.bg[state] = c
            w.set_style(s)
            # probably redundant, but better safe than sorry:
            w.modify_bg(gtk.STATE_NORMAL, c)
        # return modified or wrapped widget
        return w