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. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # This file is part of RaiTV
  5. #
  6. # RaiTV is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # RaiTV is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with RaiTV; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. #
  20. #
  21. #
  22. # Questo file contiene la classe Loader, che permette di caricare file
  23. # esterni senza preoccuparsi di dove si trovano (a grandi linee). E' messa
  24. # qui di modo che non ci si debba preoccupare di cercarla, altrimenti
  25. # perderebbe tutta la sua utilità :)
  26. #
  27.  
  28. __author__ = "Leonardo Robol <leo@robol.it>"
  29.  
  30. import os, sys
  31.  
  32. class Loader():
  33.  
  34. def __init__(self):
  35. """Scopre in che directory è l'eseguibile e ne
  36. deduce in che directory dovrebbero trovarsi i
  37. vari oggetti utili"""
  38.  
  39. # Determino la cartella di lavoro
  40. self.pwd = os.getcwd()
  41.  
  42. # e quella in cui sta il programma principale
  43. self.bin = os.path.abspath(sys.argv[0])
  44. self.bin = os.path.dirname(self.bin)
  45.  
  46. # Se questa è una cartella locale, allora
  47. # cercheremo i file in locale, altrimenti
  48. # nei luoghi atti allo scopo.
  49. # Per determinarlo proviamo a cercare le directory che
  50. # servono
  51.  
  52. os.chdir(self.bin)
  53.  
  54. try:
  55. os.stat("ui")
  56. os.stat("RaiTV")
  57. self.local = True
  58. except OSError:
  59. self.local = False
  60.  
  61. ## A questo punto dobbiamo determinare dove sono i moduli
  62. ## e file dell'interfaccia
  63. ## TODO: Farlo per davvero.
  64.  
  65. def UIPath(self, filename):
  66. """Ritorna il path di un file relativo all'interfaccia"""
  67. if self.local:
  68. return os.path.join(self.bin , "ui", filename)
  69.  
  70. def ModulePath(self):
  71. """Ritorna il path da cui importare i moduli"""
  72. if self.local:
  73. return os.path.join(self.bin, "RaiTV")
  74.  
  75.  
  76. #
  77. # Questo è il programma vero, che viene eseguito quando
  78. # questo file viene eseguito direttamente
  79. #
  80.  
  81. if __name__ == "__main__":
  82.  
  83. import gtk, pygtk
  84.  
  85. ## Creiamo l'oggetto Loader che si occuperà di
  86. ## determinare la posizione dei file interessanti
  87. loader = Loader()
  88. sys.path.insert(0, loader.ModulePath())
  89.  
  90. ## Passiamo ad importare ciò che ci serve.
  91. from RaiTV import Interface
  92.  
  93. ## Passiamo all'interfaccia anche il loader di
  94. ## modo che non si faccia troppi problemi
  95. ## a caricare i suoi file
  96. ui = Interface.UI(loader)
  97.  
  98. ## Mostriamo tutto
  99. ui.show_all()
  100.  
  101. ## Partiti :)
  102. gtk.main()
  103.  
  104.