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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [b2d68b4b77]

Overview
Comment:Remove @title and @module getters, add notebook channel menu_label (unstyled variant of tab_label). Support reading `png:` descriptor field instead of literal .png files along plugins.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b2d68b4b77c2821f5436118b8324f2aae652bef7
User & Date: mario on 2015-03-31 16:21:28
Other Links: manifest | tags
Context
2015-03-31
16:22
Starting support for alternative genre/category sources. check-in: 3829f57e04 user: mario tags: trunk
16:21
Remove @title and @module getters, add notebook channel menu_label (unstyled variant of tab_label). Support reading `png:` descriptor field instead of literal .png files along plugins. check-in: b2d68b4b77 user: mario tags: trunk
16:19
Use `ui_xml` instead of local filename. (Read via pkgutil.get_data, so should work independently of installation path.) Add logo/banner from `logo.py` → `logo.png`. check-in: 9057171155 user: mario tags: trunk
Changes

Modified channels/__init__.py from [04ae180339] to [a58ebaa107].

126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144






145












146
147
148
149
150
151
152







+











-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-








    # constructor
    def __init__(self, parent=None):
    
        #self.streams = {}
        self.gtk_list = None
        self.gtk_cat = None
        self.module = self.__class__.__name__
        self.meta = plugin_meta(None, inspect.getcomments(inspect.getmodule(self)))
        self.config = self.meta.get("config", [])
        self.title = self.meta.get("title", self.module)

        # only if streamtuner2 is run in graphical mode        
        if (parent):
            self.cache()
            self.gui(parent)
        pass
        
        
    # called before application shutdown
    # some plugins might override this, to save their current streams[] data
    def shutdown(self):
        pass
    #__del__ = shutdown
    
    # These are all implemented in main (where they don't belong!)

    # get class name
    @property
    def module(self):
        return self.__class__.__name__
    # get title
    @property
    def title(self):
        return self.meta.get("title", self.module)
        
        
    # returns station entries from streams[] for .current category
    def stations(self):
        return self.streams.get(self.current, [])
    def rowno(self):
        pass
    def row(self):
        pass
    
564
565
566
567
568
569
570
571
572







573
574

575
576
577
578
579
580
581
582
583
584
585
586

587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605

606
607
608
609
610
611
612
548
549
550
551
552
553
554


555
556
557
558
559
560
561
562

563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594

595
596
597
598
599
600
601
602







-
-
+
+
+
+
+
+
+

-
+












+


















-
+







            tv2.show()
            sw2.add(tv2)
            vbox.pack2(sw2, resize=True, shrink=True)

            # prepare label
            label = gtk.HBox()
            label.set_property("visible", True)
            fn = "/usr/share/streamtuner2/channels/" + self.module + ".png"
            if os.path.exists(fn):
            fn = conf.share + "/channels/" + self.module + ".png"
            pixbuf = None
            if "png" in self.meta:
                pixbuf = uikit.pixbuf(self.meta["png"])
            elif os.path.exists(fn):
                pixbuf = gtk.gdk.pixbuf_new_from_file(fn)
            if pixbuf:
                icon = gtk.Image()
                icon.set_property("pixbuf", gtk.gdk.pixbuf_new_from_file(fn))
                icon.set_from_pixbuf(pixbuf)
                icon.set_property("icon-size", 1)
                icon.set_property("visible", True)
                label.pack_start(icon, expand=False, fill=True)
            if self.meta["title"]:
                text = gtk.Label(self.meta["title"])
                text.set_property("visible", True)
                label.pack_start(text, expand=True, fill=True)
                
            # pack it into an event container to catch double-clicks
            ev_label = gtk.EventBox()
            ev_label.add(label)
            ev_label.connect('event', parent.on_homepage_channel_clicked)
            plain_label = gtk.Label(self.module)



            # to widgets
            self.gtk_cat = tv1
            parent.widgets[module + "_cat"] = tv1
            self.gtk_list = tv2
            parent.widgets[module + "_list"] = tv2
            parent.widgets["v_" + module] = vbox
            parent.widgets["c_" + module] = ev_label
            tv2.connect('button-press-event', parent.station_context_menu)


            # try to initialize superclass now, before adding to channel tabs
            GenericChannel.gui(self, parent)


            # add notebook tab
            tab = parent.notebook_channels.append_page(vbox, ev_label)
            tab = parent.notebook_channels.insert_page_menu(child=vbox, tab_label=ev_label, menu_label=plain_label)
            
            
            
            # double-click catch


            # add module to list