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.  
  3. import gtk, gtkmozembed, gobject
  4.  
  5. class PalaApp():
  6.  
  7. def __init__(self):
  8.  
  9. self.default_padding = 5
  10. self.timeout = 15000
  11.  
  12. # Creo Finestra e WebView
  13. self.Window = gtk.Window(gtk.WINDOW_TOPLEVEL)
  14. self.Window.set_title("Pala ControllaPagina")
  15. self.WebView = gtkmozembed.MozEmbed()
  16.  
  17. # Creo il VBox per organizzarmi tutto
  18. VBox = gtk.VBox()
  19.  
  20. # Creo la progressbar
  21. self._ProgressBar = gtk.ProgressBar()
  22. VBox.pack_end(self._ProgressBar,
  23. False,
  24. True,
  25. self.default_padding)
  26. self.WebView.connect('progress',
  27. lambda w, p, q: self._ProgressBar.set_fraction(p * 1.0 /q))
  28.  
  29. VBox.pack_end(self.WebView, True, True, self.default_padding)
  30.  
  31. label = gtk.Label("Pagina")
  32. self.UrlField = gtk.Entry()
  33. self.UrlField.connect('activate',
  34. lambda w: self.LoadPage(self.UrlField.get_text()))
  35. self.CheckPageButton = gtk.Button("Controlla pagina")
  36.  
  37. # Creo la Toolbar
  38. Toolbar = gtk.HBox()
  39. BackButton = gtk.Button("Indietro", gtk.STOCK_GO_BACK)
  40. ForwardButton = gtk.Button("Avanti", gtk.STOCK_GO_FORWARD)
  41. BackButton.connect('clicked', self.ButtonBack_cb)
  42. ForwardButton.connect('clicked', self.ForwardButton_cb)
  43. Toolbar.pack_start(BackButton, False, True, self.default_padding)
  44. Toolbar.pack_start(ForwardButton, False, True, self.default_padding)
  45. Toolbar.pack_start(label, False, True, 2* self.default_padding)
  46. Toolbar.pack_start(self.UrlField, True, True, self.default_padding)
  47. Toolbar.pack_start(self.CheckPageButton, False, False,
  48. self.default_padding)
  49. VBox.pack_end(Toolbar, False, True, self.default_padding)
  50.  
  51. self.Window.add(VBox)
  52. self.Window.resize(740,680)
  53. self.Window.show_all()
  54.  
  55. # Tengo traccia dell'url
  56. self.WebView.connect('open-uri',
  57. lambda w, url: self.UrlField.set_text(url))
  58.  
  59. self.Window.connect('destroy', self.Quit)
  60.  
  61. # Mi segno l'id della connect del PalaUpdater
  62. self.updating = False
  63.  
  64. self.CheckPageButton.connect('clicked', self.CheckPageButton_cb)
  65.  
  66. def GetUrl(self):
  67. return self.WebView.get_location()
  68.  
  69. def ButtonBack_cb(self, w):
  70. if self.WebView.can_go_back():
  71. self.WebView.go_back()
  72.  
  73. def ForwardButton_cb(self, w):
  74. if self.WebView.can_go_forward():
  75. self.WebView.go_forward()
  76.  
  77. def Quit(self, w):
  78. gtk.main_quit()
  79.  
  80. def LoadPage(self, url):
  81. """Carica la pagina data nella webView"""
  82. self.UrlField.set_text(url)
  83. self.WebView.load_url(url)
  84.  
  85. def Reload(self):
  86. # print "eheh %s" % self.updating
  87. # self.LoadPage(self.GetUrl())
  88. print "Faccio il reload"
  89. self.WebView.reload(gtkmozembed.FLAG_RELOADBYPASSCACHE)
  90. if self.updating:
  91. gobject.timeout_add(self.timeout,
  92. self.Reload)
  93.  
  94.  
  95. def CheckPageButton_cb(self, w):
  96. if not self.updating:
  97. self.updating = True
  98. gobject.timeout_add(self.timeout,
  99. self.Reload)
  100. self.CheckPageButton.set_label("Smetti di controllare la pagina")
  101. else:
  102. self.CheckPageButton.set_label("Controlla Pagina")
  103. self.updating = False
  104.  
  105. if __name__ == "__main__":
  106.  
  107. pala = PalaApp()
  108. pala.LoadPage("http://www.dm.unipi.it")
  109.  
  110. gtk.main()