Debugger/CallTraceViewer.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3021
801289962f4e
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
132 if not ext: 132 if not ext:
133 ex = selectedFilter.split("(*")[1].split(")")[0] 133 ex = selectedFilter.split("(*")[1].split(")")[0]
134 if ex: 134 if ex:
135 fname += ex 135 fname += ex
136 if QFileInfo(fname).exists(): 136 if QFileInfo(fname).exists():
137 res = E5MessageBox.yesNo(self, 137 res = E5MessageBox.yesNo(
138 self,
138 self.trUtf8("Save Call Trace Info"), 139 self.trUtf8("Save Call Trace Info"),
139 self.trUtf8("<p>The file <b>{0}</b> already exists." 140 self.trUtf8("<p>The file <b>{0}</b> already exists."
140 " Overwrite it?</p>").format(fname), 141 " Overwrite it?</p>").format(fname),
141 icon=E5MessageBox.Warning) 142 icon=E5MessageBox.Warning)
142 if not res: 143 if not res:
150 isCall = itm.data(0, Qt.UserRole) 151 isCall = itm.data(0, Qt.UserRole)
151 if isCall: 152 if isCall:
152 call = "->" 153 call = "->"
153 else: 154 else:
154 call = "<-" 155 call = "<-"
155 f.write("{0} {1} || {2}\n".format(call, 156 f.write("{0} {1} || {2}\n".format(
157 call,
156 itm.text(1), itm.text(2))) 158 itm.text(1), itm.text(2)))
157 itm = self.callTrace.itemBelow(itm) 159 itm = self.callTrace.itemBelow(itm)
158 f.close() 160 f.close()
159 except IOError as err: 161 except IOError as err:
160 E5MessageBox.critical(self, 162 E5MessageBox.critical(
163 self,
161 self.trUtf8("Error saving Call Trace Info"), 164 self.trUtf8("Error saving Call Trace Info"),
162 self.trUtf8("""<p>The call trace info could not""" 165 self.trUtf8("""<p>The call trace info could not"""
163 """ be written to <b>{0}</b></p>""" 166 """ be written to <b>{0}</b></p>"""
164 """<p>Reason: {1}</p>""")\ 167 """<p>Reason: {1}</p>""")\
165 .format(fname, str(err))) 168 .format(fname, str(err)))
227 230
228 if self.__projectMode: 231 if self.__projectMode:
229 fromFile = self.__project.getRelativePath(fromFile) 232 fromFile = self.__project.getRelativePath(fromFile)
230 toFile = self.__project.getRelativePath(toFile) 233 toFile = self.__project.getRelativePath(toFile)
231 234
232 itm = QTreeWidgetItem(parentItem, ["", 235 itm = QTreeWidgetItem(
233 self.__entryFormat.format(fromFile, fromLine, fromFunction), 236 parentItem,
234 self.__entryFormat.format(toFile, toLine, toFunction)]) 237 ["",
238 self.__entryFormat.format(fromFile, fromLine, fromFunction),
239 self.__entryFormat.format(toFile, toLine, toFunction)])
235 itm.setIcon(0, icon) 240 itm.setIcon(0, icon)
236 itm.setData(0, Qt.UserRole, isCall) 241 itm.setData(0, Qt.UserRole, isCall)
237 itm.setExpanded(True) 242 itm.setExpanded(True)
238 243
239 if isCall: 244 if isCall:

eric ide

mercurial