viewgit/index.php:465 Only variables should be passed by reference [2048]
viewgit/index.php:466 Non-static method GeSHi::get_language_name_from_extension() should not be called statically [2048]
# # -*- coding: utf-8 -*- # # Interface for RaiTV # # This file is part of RaiTV # # RaiTV is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # RaiTV is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with RaiTV; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import gtk, pygtk, gobject ## Costruisco un po' di oggeti che poi ## avrò bisogno di recuperare from VideoWidget import VideoWidget from ChannelLoader import ChannelList class UI(): def __init__(self, loader): """Recupera tutti gli oggetti necessari aprendo il file .ui e costruisce quelli che mancano""" self.loader = loader self.builder = gtk.Builder() self.builder.add_from_file( loader.UIPath("RaiTV.ui") ) self.win = self.builder.get_object("win") self.listacanali = self.builder.get_object("listacanali") ## La liststore dei canali self.liststore = self.builder.get_object("canalistore") ## Lista dei canali (in astratto) self.channellist = ChannelList(self.liststore) ## Questo hbox è quello dove dobbiamo inserire ## la videowidget self.pannellocentrale = self.builder.get_object("pannellocentrale") ## Gli passiamo anche il loader altrimenti non sa come caricare ## le immagini! :) self.videowidget = VideoWidget(self.loader) self.pannellocentrale.pack2(self.videowidget) ## 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(740,480) ## Carico i pulsanti self.stop_btn, self.play_btn, self.pause_btn, self.record_btn, self.updatelist = \ self.builder.get_object("stop"), self.builder.get_object("play"), \ self.builder.get_object("pause"), self.builder.get_object("record"), \ self.builder.get_object("updatelist") ## Colleghiamo il clic sulla lista con il playback del canale self.listacanali.connect("row-activated", self.row_activated_callback) ## La statusbar 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() ## Connettiamo la richiesta di uscire a qualcosa che lo gestisca self.win.connect("destroy", self.destroy) def show_all(self): """Mostra tutta l'interfaccia""" self.win.show_all() def sb_info(self, text): """Pubblica delle informazioni nella statusbar""" assert self.statusbar id = self.statusbar.get_context_id("info") self.statusbar.push(id, "Info: " + text) def connect_buttons(self): """Connette i bottoni con le relative azioni""" self.stop_btn.connect("clicked", lambda w: self.videowidget.stop() ) self.play_btn.connect("clicked", lambda w: self.play() ) self.pause_btn.connect("clicked", lambda w: self.videowidget.pause() ) self.updatelist.connect("clicked", lambda w: self.updateChannels() ) def play(self): """Controlla se c'è qualcosa di selezionato ed eventualmente lo comincia a riprodurre""" if self.videowidget is None: return treeselection = self.listacanali.get_selection() model, treeiter = treeselection.get_selected() if treeiter is None: ## Questo vuol dire che non abbiamo selezionato ## nulla, e quindi possiamo non fare nulla return mmsurl = self.channellist.getChannelFromIter(treeiter) self.videowidget.load_video(mmsurl) def updateChannels(self): """Aggiorna la lista dei canali scaricandola direttamente da quella della rai. Si rifiuta di aggiornare se la lista ottenuta è vuota""" self.sb_info("Aggiornamento canali in corso...") self.channellist.updateChannels() self.sb_info("Canali aggiornati") if not self.channellist == {}: ## Possiamo permetterci di perdere tutti i canali, ## perché sembra che l'operazione sia andata a buon ## fine self.liststore = self.channellist.getChannelList() def row_activated_callback(self, treeview, path, column): ## Devo ottenere l'URL da cui prendere lo streaming mmsurl = self.channellist.getChannelFromPath(path) self.sb_info("Connessione a %s..." % mmsurl) self.videowidget.load_video(mmsurl) self.sb_info("Connessione riuscita") def destroy(self, w): """Chiamata per distruggere l'interfaccia""" ## Fermiamo il video self.videowidget.stop() ## e ce ne andiamo gtk.main_quit()