4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing the Call Stack viewer widget. |
7 Module implementing the Call Stack viewer widget. |
8 """ |
8 """ |
9 |
|
10 |
9 |
11 from PyQt5.QtCore import pyqtSignal, Qt, QFileInfo |
10 from PyQt5.QtCore import pyqtSignal, Qt, QFileInfo |
12 from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QMenu |
11 from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QMenu |
13 |
12 |
14 from E5Gui.E5Application import e5App |
13 from E5Gui.E5Application import e5App |
178 if not res: |
177 if not res: |
179 return |
178 return |
180 fname = Utilities.toNativeSeparators(fname) |
179 fname = Utilities.toNativeSeparators(fname) |
181 |
180 |
182 try: |
181 try: |
183 f = open(fname, "w", encoding="utf-8") |
182 with open(fname, "w", encoding="utf-8") as f: |
184 itm = self.topLevelItem(0) |
183 itm = self.topLevelItem(0) |
185 while itm is not None: |
184 while itm is not None: |
186 f.write("{0}\n".format(itm.text(0))) |
185 f.write("{0}\n".format(itm.text(0))) |
187 f.write(78 * "=" + "\n") |
186 f.write(78 * "=" + "\n") |
188 itm = self.itemBelow(itm) |
187 itm = self.itemBelow(itm) |
189 f.close() |
|
190 except IOError as err: |
188 except IOError as err: |
191 E5MessageBox.critical( |
189 E5MessageBox.critical( |
192 self, |
190 self, |
193 self.tr("Error saving Call Stack Info"), |
191 self.tr("Error saving Call Stack Info"), |
194 self.tr("""<p>The call stack info could not be""" |
192 self.tr("""<p>The call stack info could not be""" |