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. import gtk, pygtk, gobject
  2.  
  3. class Dialog(gtk.MessageDialog):
  4.  
  5. def __init__(self, buttons=gtk.BUTTONS_NONE, mtype=gtk.MESSAGE_INFO):
  6.  
  7. gtk.MessageDialog.__init__(self,
  8. parent = None,
  9. flags = 0,
  10. type = mtype,
  11. buttons = buttons)
  12.  
  13.  
  14. class ErrorDialog(Dialog):
  15.  
  16. def __init__(self, error, message):
  17.  
  18. Dialog.__init__(self,
  19. buttons = gtk.BUTTONS_OK,
  20. mtype = gtk.MESSAGE_ERROR
  21. )
  22.  
  23. self.set_markup(error)
  24. self.format_secondary_markup(message)
  25.  
  26. class QueueDialog(Dialog):
  27.  
  28. def __init__(self, jobs, printer):
  29.  
  30. Dialog.__init__(self,
  31. buttons = gtk.BUTTONS_OK,
  32. mtype = gtk.MESSAGE_INFO
  33. )
  34.  
  35. if len(jobs) == 0:
  36. self.set_markup("Non ci sono lavori in coda su <b>%s</b>." % printer)
  37. else:
  38. self.set_markup("Ci sono %d lavori in coda su <b>%s</b>:" % (len(jobs), printer))
  39.  
  40. # Lista dei lavori
  41. markup = ""
  42. for job in jobs:
  43. markup += "%d) <b>%s</b> sta stampando <b>%s</b>\n" % (job['position'], job['user'],
  44. job['filename'])
  45. self.format_secondary_markup (markup)
  46.  
  47.  
  48. class InfoDialog(Dialog):
  49.  
  50. def __init__(self, error, message):
  51.  
  52. Dialog.__init__(self,
  53. buttons = gtk.BUTTONS_OK,
  54. mtype = gtk.MESSAGE_INFO
  55. )
  56.  
  57. self.set_markup(error)
  58. self.format_secondary_markup(message)
  59.  
  60.  
  61.  
  62. class MessageDialog(Dialog):
  63.  
  64. def __init__(self, title, text):
  65.  
  66. Dialog.__init__(self,
  67. buttons = gtk.BUTTONS_OK_CANCEL,
  68. mtype = gtk.MESSAGE_WARNING
  69. )
  70.  
  71. self.set_markup(title)
  72. self.format_secondary_markup(text)
  73.  
  74.  
  75. class ProgressDialog(gtk.Dialog):
  76.  
  77. __gsignals__ = {
  78. 'transfer-cancelled': (gobject.SIGNAL_RUN_LAST,
  79. gobject.TYPE_NONE, ())
  80. }
  81.  
  82. def __init__(self, filename):
  83.  
  84. gtk.Dialog.__init__(self,
  85. title = "Trasferimento file in corso...",
  86. buttons = None)
  87. self.__progress_bar = gtk.ProgressBar()
  88. self.__progress_bar.set_fraction(0)
  89. self.set_border_width(5)
  90.  
  91. self.get_content_area().set_spacing(5)
  92.  
  93. filename = filename.split("/")[-1]
  94. text = "Trasferimento del file %s \n sul server remoto in corso..." % filename
  95. label = gtk.Label(text)
  96. self.get_content_area().pack_start(label, 5)
  97. self.get_content_area().pack_start(self.__progress_bar, 5)
  98. label.show()
  99. self.__progress_bar.show()
  100.  
  101. cancel_button = gtk.Button("Annulla")
  102. self.get_content_area().pack_start(cancel_button, 5)
  103. cancel_button.show()
  104.  
  105. cancel_button.connect("clicked", self.cancel)
  106.  
  107. self.connect("destroy", self.cancel)
  108.  
  109. def cancel(self, widget):
  110. self.emit('transfer-cancelled')
  111. self.hide()
  112.  
  113. def set_fraction(self, fraction):
  114. self.__progress_bar.set_fraction(fraction)
  115. while gtk.events_pending():
  116. gtk.main_iteration()
  117.  
  118.  
  119.  
  120.  
  121.