From 4352bd1fbfea159fa0cfc5121f69f84ba0c3f13b Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sun, 1 Nov 2009 10:55:05 +0100 Subject: [PATCH] Aggiunto scaricamento dei canali (anche se ancora non possono essere selezionati per il playback) --- RaiTV/ChannelLoader.py | 3 +++ RaiTV/Interface.py | 26 +++++++++++++++++++++++--- RaiTV/VideoWidget.py | 1 - ui/RaiTV.ui | 46 +++++++++++++++++++--------------------------- 4 files changed, 45 insertions(+), 31 deletions(-) diff --git a/RaiTV/ChannelLoader.py b/RaiTV/ChannelLoader.py index ab5c971..b3fc24f 100644 --- a/RaiTV/ChannelLoader.py +++ b/RaiTV/ChannelLoader.py @@ -51,6 +51,9 @@ class ChannelList(): mms = r.read() mms = re.search(r"HREF=\"(\S*)\"", mms).group(1) return mms + + def getChannelList(self): + return self.channels diff --git a/RaiTV/Interface.py b/RaiTV/Interface.py index c1e162a..c62f141 100644 --- a/RaiTV/Interface.py +++ b/RaiTV/Interface.py @@ -4,7 +4,7 @@ # Interface for RaiTV # -import gtk, pygtk +import gtk, pygtk, gobject ## Costruisco un po' di oggeti che poi ## avrò bisogno di recuperare @@ -26,7 +26,6 @@ class UI(): ## Lista dei canali (in astratto) self.channellist = ChannelList() - ## Questo hbox è quello dove dobbiamo inserire ## la videowidget @@ -34,6 +33,16 @@ class UI(): self.videowidget = VideoWidget() self.hbox1.pack_start(self.videowidget) + + ## La liststore dei canali + self.liststore = self.builder.get_object("canalistore") + + ## Visualizziamo il nome del canale + col = gtk.TreeViewColumn("Selezione canale") + cell = gtk.CellRendererText() + col.pack_start(cell,True) + col.set_attributes(cell,text=0) + self.listacanali.append_column(col) ## Qualche setting prima di partire self.win.resize(640,480) @@ -48,6 +57,8 @@ class UI(): self.statusbar = self.builder.get_object("statusbar") self.sb_info("Applicazione inizializzata") + ## Connette i bottoni di play/pause... alle relative azioni del + ## videowidget self.connect_buttons() @@ -69,7 +80,16 @@ class UI(): self.stop_btn.connect("clicked", lambda w: self.videowidget.stop() ) self.play_btn.connect("clicked", lambda w: self.videowidget.play() ) self.pause_btn.connect("clicked", lambda w: self.videowidget.pause() ) - self.updatelist.connect("clicked", lambda w: self.channellist.updateChannels() ) + self.updatelist.connect("clicked", lambda w: self.updateChannels() ) + + def updateChannels(self): + """Aggiorna la lista dei canali scaricandola direttamente da quella + della rai. Si rifiuta di aggiornare se la lista ottenuta è vuota""" + self.channellist.updateChannels() + self.sb_info("Canali aggiornati") + if not self.channellist == {}: + for channel, url in self.channellist.getChannelList().items(): + self.liststore.append( (channel, url) ) def start_video(self): """Avvia il video""" diff --git a/RaiTV/VideoWidget.py b/RaiTV/VideoWidget.py index d4a93f7..2322166 100644 --- a/RaiTV/VideoWidget.py +++ b/RaiTV/VideoWidget.py @@ -26,7 +26,6 @@ class VideoWidget(gtk.DrawingArea): bus.connect("message", self.on_message) - def do_expose_event(self, event): if self.imagesink: self.imagesink.expose() diff --git a/ui/RaiTV.ui b/ui/RaiTV.ui index c5537cd..2b3c7f5 100644 --- a/ui/RaiTV.ui +++ b/ui/RaiTV.ui @@ -156,26 +156,25 @@ True - + True True - canalistore + automatic + automatic + + + True + True + canalistore + 0 + + 0 - - True - vertical - - - False - 1 - - - @@ -271,27 +270,20 @@ - - Volume + + + + True True - True - none - False - vertical - audio-volume-muted -audio-volume-high -audio-volume-low -audio-volume-medium + 0 + False + left - False - 1 + 2 - - - False -- 2.1.4