comparison python/ide/ide.py @ 343:11c5a8a70c02 devel

Fix ide
author Windel Bouwman
date Sat, 01 Mar 2014 16:27:52 +0100
parents dcae6574c974
children
comparison
equal deleted inserted replaced
342:86b02c98a717 343:11c5a8a70c02
4 import os 4 import os
5 import logging 5 import logging
6 import traceback 6 import traceback
7 import io 7 import io
8 8
9 from qtwrapper import QtGui, QtCore, QtWidgets, pyqtSignal, get_icon, abspath, Qt 9 from qtwrapper import QtGui, QtCore, QtWidgets, pyqtSignal, get_icon
10 from qtwrapper import abspath, Qt
10 11
11 # Compiler imports: 12 # Compiler imports:
12 p = os.path.join(os.path.dirname(__file__), '..') 13 p = os.path.join(os.path.dirname(__file__), '..')
13 sys.path.insert(0, p) 14 sys.path.insert(0, p)
14 sys.path.insert(0, os.path.join(p, 'utils')) 15 sys.path.insert(0, os.path.join(p, 'utils'))
16
15 import ppci 17 import ppci
16 from astviewer import AstViewer 18 from astviewer import AstViewer
17 from codeedit import CodeEdit 19 from codeedit import CodeEdit
18 from logview import LogView as BuildOutput 20 from logview import LogView as BuildOutput
19 from disasm import Disassembly 21 from disasm import Disassembly
20 stutil = __import__('st-util') 22 stutil = __import__('st-util')
21 import zcc 23 import zcc
22 import outstream 24 from ppci.outstream import BinaryOutputStream
23 from target import armtarget 25 from ppci.target.target_list import thumb_target
24 26
25 27
26 def handle_exception(tp, v, tb): 28 def handle_exception(tp, v, tb):
27 logging.critical(str(v)) 29 logging.critical(str(v))
28 tb = traceback.format_tb(tb) 30 tb = traceback.format_tb(tb)
277 ce = self.activeMdiChild() 279 ce = self.activeMdiChild()
278 if not ce: 280 if not ce:
279 return 281 return
280 fn = ce.FileName 282 fn = ce.FileName
281 self.diag.clear() 283 self.diag.clear()
282 outs = outstream.TextOutputStream() 284 outs = BinaryOutputStream()
283 imps = [open(ce.FileName, 'r') for ce in self.allChildren() if ce.FileName and ce.FileName != fn] 285 imps = [open(ce.FileName, 'r') for ce in self.allChildren() if ce.FileName and ce.FileName != fn]
284 if not zcc.zcc([open(fn, 'r')], imps, armtarget, outs, self.diag): 286 if not zcc.zcc([open(fn, 'r')], imps, thumb_target, outs, self.diag):
285 # Set errors: 287 # Set errors:
286 self.builderrors.setErrorList(self.diag.diags) 288 self.builderrors.setErrorList(self.diag.diags)
287 ce.setErrors(self.diag.diags) 289 ce.setErrors(self.diag.diags)
288 return 290 return
289 return outs 291 return outs