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 is the library the provides a gui to Snorky!
  5.  
  6.  
  7. from PyQt4 import QtGui, QtCore, QtWebKit
  8.  
  9. class SnorkyWebView(QtWebKit.QWebView):
  10. def __init__(self, parent=None):
  11. super(SnorkyWebView, self).__init__(parent)
  12.  
  13. def reset(self):
  14. self.setHtml("<html>\
  15. <head>\
  16. <title>Snorky 0.1</title>\
  17. <style>\
  18. body {\
  19. font-family: \"Trebuchet MS\", Lucida, Sans;\
  20. }\
  21. \
  22. h2 {\
  23. color: #4444ee;\
  24. font-size: 14px;\
  25. }\
  26. </style>\
  27. </head>\
  28. <body>\
  29. <h2>Come posso usare snorky 0.2?</h2>\
  30. Inserisci nome utente e password in alto e clicca su connetti, \
  31. cos&igrave; potrai vedere e/o modificare i file torrent in download su\
  32. hugo.robol.it. \
  33. <h2>Come funziona tutto questo?</h2>\
  34. Usando il tuo nome utente e la tua password e con l'aiuto di paramiko\
  35. (e di qualche altra libreria per creare un piccolo server) viene inoltrata\
  36. la porta 8112 sul server sulla tua porta 8112 locale in modo che la \
  37. QWebView di qui sotto possa visualizzarla!\
  38. </body>\
  39. </html>")
  40.  
  41. def load_page(self):
  42. self.load(QtCore.QUrl("http://localhost:9998/"))
  43.  
  44. class SnorkyMainWin(QtGui.QWidget):
  45. def __init__(self, parent=None):
  46. # Init the parent
  47. super(SnorkyMainWin, self).__init__(parent)
  48.  
  49. # Default size
  50. self.resize(800,600)
  51.  
  52. # Title
  53. self.setWindowTitle("Snorky 0.2")
  54.  
  55. # Get buttons and similar
  56. self.populate()
  57.  
  58. # Status
  59.  
  60. def populate(self):
  61. # Out main VBox
  62. main_vbox = QtGui.QVBoxLayout()
  63. main_vbox.addStretch(1)
  64.  
  65. # HBox for user, passwd...
  66. passwd_hbox = QtGui.QHBoxLayout()
  67.  
  68. # Username field
  69. qla_username = QtGui.QLabel("Username")
  70. self.qle_username = QtGui.QLineEdit()
  71. passwd_hbox.addWidget(qla_username)
  72. passwd_hbox.addWidget(self.qle_username)
  73.  
  74. # Password field
  75. qla_passwd = QtGui.QLabel("Password")
  76. self.qle_passwd = QtGui.QLineEdit()
  77. # Hide chars...
  78. self.qle_passwd.setEchoMode(2)
  79. passwd_hbox.addWidget(qla_passwd)
  80. passwd_hbox.addWidget(self.qle_passwd)
  81.  
  82. # Host field
  83. qla_host = QtGui.QLabel("Host")
  84. self.qle_host = QtGui.QLineEdit("linus.robol.it")
  85. passwd_hbox.addWidget(qla_host)
  86. passwd_hbox.addWidget(self.qle_host)
  87.  
  88. # Port field
  89. qla_port = QtGui.QLabel("Port")
  90. self.qle_port = QtGui.QLineEdit("8112")
  91. passwd_hbox.addWidget(qla_port)
  92. passwd_hbox.addWidget(self.qle_port)
  93.  
  94. # Connect button
  95. self.btnConnect = QtGui.QPushButton("Connect")
  96. passwd_hbox.addWidget(self.btnConnect)
  97.  
  98. # Web interface
  99. self.web = SnorkyWebView()
  100.  
  101. # Progress Bar
  102. prgbar = QtGui.QProgressBar()
  103. self.connect(self.web, QtCore.SIGNAL("loadProgress( int )") , prgbar.setValue)
  104.  
  105. # Put pieces in main_vbox
  106. main_vbox.addLayout(passwd_hbox, 0.1)
  107. main_vbox.addWidget(prgbar, 0.1)
  108. main_vbox.addWidget(self.web, 100)
  109. self.web.reset()
  110.  
  111. # Show the boxes
  112. self.setLayout(main_vbox)