eric6/Debugger/CallTraceViewer.py

changeset 7785
9978016560ec
parent 7775
4a1db75550bd
child 7802
eefe954f01e8
child 7836
2f0d208b8137
equal deleted inserted replaced
7784:3257703e10c5 7785:9978016560ec
164 if not res: 164 if not res:
165 return 165 return
166 fname = Utilities.toNativeSeparators(fname) 166 fname = Utilities.toNativeSeparators(fname)
167 167
168 try: 168 try:
169 f = open(fname, "w", encoding="utf-8") 169 with open(fname, "w", encoding="utf-8") as f:
170 itm = self.callTrace.topLevelItem(0) 170 itm = self.callTrace.topLevelItem(0)
171 while itm is not None: 171 while itm is not None:
172 isCall = itm.data(0, Qt.UserRole) 172 isCall = itm.data(0, Qt.UserRole)
173 if isCall: 173 if isCall:
174 call = "->" 174 call = "->"
175 else: 175 else:
176 call = "<-" 176 call = "<-"
177 f.write("{0} {1} || {2}\n".format( 177 f.write("{0} {1} || {2}\n".format(
178 call, 178 call,
179 itm.text(1), itm.text(2))) 179 itm.text(1), itm.text(2)))
180 itm = self.callTrace.itemBelow(itm) 180 itm = self.callTrace.itemBelow(itm)
181 f.close()
182 except IOError as err: 181 except IOError as err:
183 E5MessageBox.critical( 182 E5MessageBox.critical(
184 self, 183 self,
185 self.tr("Error saving Call Trace Info"), 184 self.tr("Error saving Call Trace Info"),
186 self.tr("""<p>The call trace info could not""" 185 self.tr("""<p>The call trace info could not"""

eric ide

mercurial