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]

  1. #
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Interface for RaiTV
  5. #
  6.  
  7. import gtk, pygtk, gobject
  8.  
  9. ## Costruisco un po' di oggeti che poi
  10. ## avrò bisogno di recuperare
  11.  
  12. from VideoWidget import VideoWidget
  13. from ChannelLoader import ChannelList
  14.  
  15. class UI():
  16.  
  17. def __init__(self):
  18. """Recupera tutti gli oggetti necessari aprendo
  19. il file .ui e costruisce quelli che mancano"""
  20.  
  21. self.builder = gtk.Builder()
  22. self.builder.add_from_file("ui/RaiTV.ui")
  23.  
  24. self.win = self.builder.get_object("win")
  25. self.listacanali = self.builder.get_object("listacanali")
  26.  
  27. ## La liststore dei canali
  28. self.liststore = self.builder.get_object("canalistore")
  29.  
  30. ## Lista dei canali (in astratto)
  31. self.channellist = ChannelList(self.liststore)
  32.  
  33. ## Questo hbox è quello dove dobbiamo inserire
  34. ## la videowidget
  35. self.pannellocentrale = self.builder.get_object("pannellocentrale")
  36.  
  37. self.videowidget = VideoWidget()
  38. self.pannellocentrale.pack2(self.videowidget)
  39.  
  40. ## Visualizziamo il nome del canale
  41. col = gtk.TreeViewColumn("Selezione canale")
  42. cell = gtk.CellRendererText()
  43. col.pack_start(cell,True)
  44. col.set_attributes(cell,text=0)
  45. self.listacanali.append_column(col)
  46.  
  47. ## Qualche setting prima di partire
  48. self.win.resize(740,480)
  49.  
  50. ## Carico i pulsanti
  51. self.stop_btn, self.play_btn, self.pause_btn, self.record_btn, self.updatelist = \
  52. self.builder.get_object("stop"), self.builder.get_object("play"), \
  53. self.builder.get_object("pause"), self.builder.get_object("record"), \
  54. self.builder.get_object("updatelist")
  55.  
  56. ## Colleghiamo il clic sulla lista con il playback del canale
  57. self.listacanali.connect("row-activated", self.row_activated_callback)
  58.  
  59. ## La statusbar
  60. self.statusbar = self.builder.get_object("statusbar")
  61. self.sb_info("Applicazione inizializzata")
  62.  
  63. ## Connette i bottoni di play/pause... alle relative azioni del
  64. ## videowidget
  65. self.connect_buttons()
  66.  
  67.  
  68. ## Connettiamo la richiesta di uscire a qualcosa che lo gestisca
  69. self.win.connect("destroy", self.destroy)
  70.  
  71. def show_all(self):
  72. """Mostra tutta l'interfaccia"""
  73. self.win.show_all()
  74.  
  75. def sb_info(self, text):
  76. """Pubblica delle informazioni nella statusbar"""
  77. assert self.statusbar
  78. id = self.statusbar.get_context_id("info")
  79. self.statusbar.push(id, "Info: " + text)
  80.  
  81. def connect_buttons(self):
  82. """Connette i bottoni con le relative azioni"""
  83. self.stop_btn.connect("clicked", lambda w: self.videowidget.stop() )
  84. self.play_btn.connect("clicked", lambda w: self.play() )
  85. self.pause_btn.connect("clicked", lambda w: self.videowidget.pause() )
  86. self.updatelist.connect("clicked", lambda w: self.updateChannels() )
  87.  
  88. def play(self):
  89. if not self.videowidget.playing:
  90. treeselection = self.listacanali.get_selection()
  91. model, treeiter = treeselection.get_selected()
  92. mmsurl = self.channellist.getChannelFromIter(treeiter)
  93. self.videowidget.load_video(mmsurl)
  94. else:
  95. self.videowidget.play()
  96.  
  97. def updateChannels(self):
  98. """Aggiorna la lista dei canali scaricandola direttamente da quella
  99. della rai. Si rifiuta di aggiornare se la lista ottenuta è vuota"""
  100. self.sb_info("Aggiornamento canali in corso...")
  101. self.channellist.updateChannels()
  102. self.sb_info("Canali aggiornati")
  103. if not self.channellist == {}:
  104. ## Possiamo permetterci di perdere tutti i canali,
  105. ## perché sembra che l'operazione sia andata a buon
  106. ## fine
  107. self.liststore = self.channellist.getChannelList()
  108.  
  109. def row_activated_callback(self, treeview, path, column):
  110. ## Devo ottenere l'URL da cui prendere lo streaming
  111. mmsurl = self.channellist.getChannelFromPath(path)
  112. self.sb_info("Connessione a %s..." % mmsurl)
  113. self.videowidget.load_video(mmsurl)
  114. self.sb_info("Connessione riuscita")
  115.  
  116.  
  117. def destroy(self, w):
  118. """Chiamata per distruggere l'interfaccia"""
  119.  
  120. ## Fermiamo il video
  121. self.videowidget.stop()
  122.  
  123. ## e ce ne andiamo
  124. gtk.main_quit()
  125.  
  126.  
  127.  
  128.