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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [6bf4c5e61e]

Overview
Comment:Stub category tree building main[] in case of wrapped primary group. Add uikit.bg on STATE_ACTIVE, skip existing EventBox widgets.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6bf4c5e61edcf7e9af46286901c66cf8a62ac8ca
User & Date: mario on 2015-05-02 05:44:01
Other Links: manifest | tags
Context
2015-05-02
05:44
Fix `audioformat` property name. check-in: 3f1b3bd882 user: mario tags: trunk
05:44
Stub category tree building main[] in case of wrapped primary group. Add uikit.bg on STATE_ACTIVE, skip existing EventBox widgets. check-in: 6bf4c5e61e user: mario tags: trunk
05:42
Remove redundant pq and compat2and3 imports. check-in: 8783b94a0a user: mario tags: trunk
Changes

Modified uikit.py from [6f3acc5193] to [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