50 self.resizeButton.setIcon(UI.PixmapCache.getIcon("resizeColumns.png")) |
50 self.resizeButton.setIcon(UI.PixmapCache.getIcon("resizeColumns.png")) |
51 self.clearButton.setIcon(UI.PixmapCache.getIcon("editDelete.png")) |
51 self.clearButton.setIcon(UI.PixmapCache.getIcon("editDelete.png")) |
52 self.saveButton.setIcon(UI.PixmapCache.getIcon("fileSave.png")) |
52 self.saveButton.setIcon(UI.PixmapCache.getIcon("fileSave.png")) |
53 |
53 |
54 self.__headerItem = QTreeWidgetItem( |
54 self.__headerItem = QTreeWidgetItem( |
55 ["", self.trUtf8("From"), self.trUtf8("To")]) |
55 ["", self.tr("From"), self.tr("To")]) |
56 self.__headerItem.setIcon(0, UI.PixmapCache.getIcon("callReturn.png")) |
56 self.__headerItem.setIcon(0, UI.PixmapCache.getIcon("callReturn.png")) |
57 self.callTrace.setHeaderItem(self.__headerItem) |
57 self.callTrace.setHeaderItem(self.__headerItem) |
58 |
58 |
59 self.__callStack = [] |
59 self.__callStack = [] |
60 |
60 |
120 Private slot to save the call trace info to a file. |
120 Private slot to save the call trace info to a file. |
121 """ |
121 """ |
122 if self.callTrace.topLevelItemCount() > 0: |
122 if self.callTrace.topLevelItemCount() > 0: |
123 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
123 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
124 self, |
124 self, |
125 self.trUtf8("Save Call Trace Info"), |
125 self.tr("Save Call Trace Info"), |
126 "", |
126 "", |
127 self.trUtf8("Text Files (*.txt);;All Files (*)"), |
127 self.tr("Text Files (*.txt);;All Files (*)"), |
128 None, |
128 None, |
129 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
129 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
130 if fname: |
130 if fname: |
131 ext = QFileInfo(fname).suffix() |
131 ext = QFileInfo(fname).suffix() |
132 if not ext: |
132 if not ext: |
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( |
137 res = E5MessageBox.yesNo( |
138 self, |
138 self, |
139 self.trUtf8("Save Call Trace Info"), |
139 self.tr("Save Call Trace Info"), |
140 self.trUtf8("<p>The file <b>{0}</b> already exists." |
140 self.tr("<p>The file <b>{0}</b> already exists." |
141 " Overwrite it?</p>").format(fname), |
141 " Overwrite it?</p>").format(fname), |
142 icon=E5MessageBox.Warning) |
142 icon=E5MessageBox.Warning) |
143 if not res: |
143 if not res: |
144 return |
144 return |
145 fname = Utilities.toNativeSeparators(fname) |
145 fname = Utilities.toNativeSeparators(fname) |
146 |
146 |
159 itm = self.callTrace.itemBelow(itm) |
159 itm = self.callTrace.itemBelow(itm) |
160 f.close() |
160 f.close() |
161 except IOError as err: |
161 except IOError as err: |
162 E5MessageBox.critical( |
162 E5MessageBox.critical( |
163 self, |
163 self, |
164 self.trUtf8("Error saving Call Trace Info"), |
164 self.tr("Error saving Call Trace Info"), |
165 self.trUtf8("""<p>The call trace info could not""" |
165 self.tr("""<p>The call trace info could not""" |
166 """ be written to <b>{0}</b></p>""" |
166 """ be written to <b>{0}</b></p>""" |
167 """<p>Reason: {1}</p>""") |
167 """<p>Reason: {1}</p>""") |
168 .format(fname, str(err))) |
168 .format(fname, str(err))) |
169 |
169 |
170 @pyqtSlot(QTreeWidgetItem, int) |
170 @pyqtSlot(QTreeWidgetItem, int) |
171 def on_callTrace_itemDoubleClicked(self, item, column): |
171 def on_callTrace_itemDoubleClicked(self, item, column): |
172 """ |
172 """ |