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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [04ae180339]:

To Artifact [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

    # constructor
    def __init__(self, parent=None):
    
        #self.streams = {}
        self.gtk_list = None
        self.gtk_cat = None

        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
    

    # 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
    







>











<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<







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
        
        





    # These are all implemented in main (where they don't belong!)












    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
            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):


                icon = gtk.Image()
                icon.set_property("pixbuf", gtk.gdk.pixbuf_new_from_file(fn))
                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)




            # 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)
            
            
            
            # double-click catch


            # add module to list            







|
>
>
>
|
>
>

|












>


















|







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 = 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_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.insert_page_menu(child=vbox, tab_label=ev_label, menu_label=plain_label)
            
            
            
            # double-click catch


            # add module to list