eric4.py

changeset 12
1d8dd9706f46
parent 7
c679fb30c8f3
child 13
1af94a91f439
equal deleted inserted replaced
11:b0996e4a289e 12:1d8dd9706f46
1 #!/usr/bin/env python 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 3
4 # Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> 4 # Copyright (c) 2002 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
5 # 5 #
6 6
12 """ 12 """
13 13
14 import sys 14 import sys
15 import os 15 import os
16 import traceback 16 import traceback
17 import cStringIO 17 import io
18 import time 18 import time
19 import logging 19 import logging
20
21 import sip
22 sip.setapi("QString", 2)
23 sip.setapi("QVariant", 2)
24 20
25 from PyQt4.QtCore import QTextCodec, SIGNAL, SLOT, qWarning, \ 21 from PyQt4.QtCore import QTextCodec, SIGNAL, SLOT, qWarning, \
26 QLibraryInfo, QTimer 22 QLibraryInfo, QTimer
27 from PyQt4.QtGui import QApplication, QErrorMessage 23 from PyQt4.QtGui import QApplication, QErrorMessage
28 24
86 break 82 break
87 if len(sys.argv) > 1: 83 if len(sys.argv) > 1:
88 client.processArgs(sys.argv[1:]) 84 client.processArgs(sys.argv[1:])
89 sys.exit(0) 85 sys.exit(0)
90 elif res < 0: 86 elif res < 0:
91 print "eric4: %s" % client.errstr() 87 print("eric4: %s" % client.errstr())
92 sys.exit(res) 88 sys.exit(res)
93 89
94 def excepthook(excType, excValue, tracebackobj): 90 def excepthook(excType, excValue, tracebackobj):
95 """ 91 """
96 Global function to catch unhandled exceptions. 92 Global function to catch unhandled exceptions.
114 versionInfo += "%s\n%s" % (separator, pluginVersionInfo) 110 versionInfo += "%s\n%s" % (separator, pluginVersionInfo)
115 distroInfo = Utilities.generateDistroInfo() 111 distroInfo = Utilities.generateDistroInfo()
116 if distroInfo: 112 if distroInfo:
117 versionInfo += "%s\n%s" % (separator, distroInfo) 113 versionInfo += "%s\n%s" % (separator, distroInfo)
118 114
119 tbinfofile = cStringIO.StringIO() 115 tbinfofile = io.StringIO()
120 traceback.print_tb(tracebackobj, None, tbinfofile) 116 traceback.print_tb(tracebackobj, None, tbinfofile)
121 tbinfofile.seek(0) 117 tbinfofile.seek(0)
122 tbinfo = tbinfofile.read() 118 tbinfo = tbinfofile.read()
123 errmsg = '%s: \n%s' % (str(excType), str(excValue)) 119 errmsg = '%s: \n%s' % (str(excType), str(excValue))
124 sections = [separator, timeString, separator, errmsg, separator, tbinfo] 120 sections = [separator, timeString, separator, errmsg, separator, tbinfo]
248 # start the event loop 244 # start the event loop
249 res = app.exec_() 245 res = app.exec_()
250 logging.debug("Shutting down, result %d" % res) 246 logging.debug("Shutting down, result %d" % res)
251 logging.shutdown() 247 logging.shutdown()
252 sys.exit(res) 248 sys.exit(res)
253 except Exception, err: 249 except Exception as err:
254 raise err 250 raise err
255 251
256 if __name__ == '__main__': 252 if __name__ == '__main__':
257 main() 253 main()

eric ide

mercurial