PyLint/PyLintExecDialog.py

changeset 22
68beeb22dade
parent 20
8ca799e4b7e4
child 24
b01348dd84d5
equal deleted inserted replaced
21:f2144b9596a0 22:68beeb22dade
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a dialog to show the results of the PyLint run. 7 Module implementing a dialog to show the results of the PyLint run.
8 """ 8 """
9
10 from __future__ import unicode_literals # __IGNORE_WARNING__
11 try:
12 str = unicode
13 except (NameError):
14 pass
9 15
10 import os 16 import os
11 17
12 from PyQt4.QtCore import QTimer, QProcess, Qt, pyqtSlot 18 from PyQt4.QtCore import QTimer, QProcess, Qt, pyqtSlot
13 from PyQt4.QtGui import QWidget, QCursor, QHeaderView, QApplication, \ 19 from PyQt4.QtGui import QWidget, QCursor, QHeaderView, QApplication, \
359 E5MessageBox.Cancel) 365 E5MessageBox.Cancel)
360 if res == E5MessageBox.Cancel: 366 if res == E5MessageBox.Cancel:
361 return 367 return
362 368
363 try: 369 try:
364 f = open(self.reportFile, 'w') 370 import codecs
365 f.write(self.buf) 371 f = open(self.reportFile, 'wb')
372 f.write(codecs.BOM_UTF8)
373 f.write(self.buf.encode('utf-8'))
366 f.close() 374 f.close()
367 except IOError as why: 375 except IOError as why:
368 E5MessageBox.critical(self, self.trUtf8('PyLint Report'), 376 E5MessageBox.critical(self, self.trUtf8('PyLint Report'),
369 self.trUtf8('<p>The PyLint report file <b>{0}</b> could not be written.' 377 self.trUtf8('<p>The PyLint report file <b>{0}</b> could not be written.'
370 '<br>Reason: {1}</p>') 378 '<br>Reason: {1}</p>')
383 self.reportFile = E5FileDialog.getSaveFileName( 391 self.reportFile = E5FileDialog.getSaveFileName(
384 self, 392 self,
385 self.trUtf8("PyLint Report"), 393 self.trUtf8("PyLint Report"),
386 self.ppath, 394 self.ppath,
387 filter, 395 filter,
388 None,
389 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) 396 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
390 if self.reportFile: 397 if self.reportFile:
391 self.__writeReport() 398 self.__writeReport()

eric ide

mercurial