DataViews/PyProfileDialog.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3438
29717a5e8b97
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
78 self.resultList.headerItem().setText(self.resultList.columnCount(), "") 78 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
79 self.resultList.header().setSortIndicator(0, Qt.DescendingOrder) 79 self.resultList.header().setSortIndicator(0, Qt.DescendingOrder)
80 80
81 self.__menu = QMenu(self) 81 self.__menu = QMenu(self)
82 self.filterItm = self.__menu.addAction( 82 self.filterItm = self.__menu.addAction(
83 self.trUtf8('Exclude Python Library'), 83 self.tr('Exclude Python Library'),
84 self.__filter) 84 self.__filter)
85 self.__menu.addSeparator() 85 self.__menu.addSeparator()
86 self.__menu.addAction( 86 self.__menu.addAction(
87 self.trUtf8('Erase Profiling Info'), self.__eraseProfile) 87 self.tr('Erase Profiling Info'), self.__eraseProfile)
88 self.__menu.addAction( 88 self.__menu.addAction(
89 self.trUtf8('Erase Timing Info'), self.__eraseTiming) 89 self.tr('Erase Timing Info'), self.__eraseTiming)
90 self.__menu.addSeparator() 90 self.__menu.addSeparator()
91 self.__menu.addAction(self.trUtf8('Erase All Infos'), self.__eraseAll) 91 self.__menu.addAction(self.tr('Erase All Infos'), self.__eraseAll)
92 self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) 92 self.resultList.setContextMenuPolicy(Qt.CustomContextMenu)
93 self.resultList.customContextMenuRequested.connect( 93 self.resultList.customContextMenuRequested.connect(
94 self.__showContextMenu) 94 self.__showContextMenu)
95 self.summaryList.setContextMenuPolicy(Qt.CustomContextMenu) 95 self.summaryList.setContextMenuPolicy(Qt.CustomContextMenu)
96 self.summaryList.customContextMenuRequested.connect( 96 self.summaryList.customContextMenuRequested.connect(
206 self.resultList.setSortingEnabled(True) 206 self.resultList.setSortingEnabled(True)
207 self.resultList.setUpdatesEnabled(True) 207 self.resultList.setUpdatesEnabled(True)
208 self.__resortResultList() 208 self.__resortResultList()
209 209
210 # now do the summary stuff 210 # now do the summary stuff
211 self.__createSummaryItem(self.trUtf8("function calls"), 211 self.__createSummaryItem(self.tr("function calls"),
212 str(total_calls)) 212 str(total_calls))
213 if total_calls != prim_calls: 213 if total_calls != prim_calls:
214 self.__createSummaryItem(self.trUtf8("primitive calls"), 214 self.__createSummaryItem(self.tr("primitive calls"),
215 str(prim_calls)) 215 str(prim_calls))
216 self.__createSummaryItem(self.trUtf8("CPU seconds"), 216 self.__createSummaryItem(self.tr("CPU seconds"),
217 "{0:.3f}".format(total_tt)) 217 "{0:.3f}".format(total_tt))
218 218
219 def start(self, pfn, fn=None): 219 def start(self, pfn, fn=None):
220 """ 220 """
221 Public slot to start the calculation of the profile data. 221 Public slot to start the calculation of the profile data.
227 227
228 fname = "{0}.profile".format(self.basename) 228 fname = "{0}.profile".format(self.basename)
229 if not os.path.exists(fname): 229 if not os.path.exists(fname):
230 E5MessageBox.warning( 230 E5MessageBox.warning(
231 self, 231 self,
232 self.trUtf8("Profile Results"), 232 self.tr("Profile Results"),
233 self.trUtf8("""<p>There is no profiling data""" 233 self.tr("""<p>There is no profiling data"""
234 """ available for <b>{0}</b>.</p>""") 234 """ available for <b>{0}</b>.</p>""")
235 .format(pfn)) 235 .format(pfn))
236 self.close() 236 self.close()
237 return 237 return
238 try: 238 try:
239 f = open(fname, 'rb') 239 f = open(fname, 'rb')
240 self.stats = pickle.load(f) 240 self.stats = pickle.load(f)
241 f.close() 241 f.close()
242 except (EnvironmentError, pickle.PickleError, EOFError): 242 except (EnvironmentError, pickle.PickleError, EOFError):
243 E5MessageBox.critical( 243 E5MessageBox.critical(
244 self, 244 self,
245 self.trUtf8("Loading Profiling Data"), 245 self.tr("Loading Profiling Data"),
246 self.trUtf8("""<p>The profiling data could not be""" 246 self.tr("""<p>The profiling data could not be"""
247 """ read from file <b>{0}</b>.</p>""") 247 """ read from file <b>{0}</b>.</p>""")
248 .format(fname)) 248 .format(fname))
249 self.close() 249 self.close()
250 return 250 return
251 251
252 self.file = fn 252 self.file = fn
325 action. 325 action.
326 """ 326 """
327 self.__unfinish() 327 self.__unfinish()
328 if self.exclude: 328 if self.exclude:
329 self.exclude = False 329 self.exclude = False
330 self.filterItm.setText(self.trUtf8('Include Python Library')) 330 self.filterItm.setText(self.tr('Include Python Library'))
331 self.__populateLists(True) 331 self.__populateLists(True)
332 else: 332 else:
333 self.exclude = True 333 self.exclude = True
334 self.filterItm.setText(self.trUtf8('Exclude Python Library')) 334 self.filterItm.setText(self.tr('Exclude Python Library'))
335 self.__populateLists(False) 335 self.__populateLists(False)
336 self.__finish() 336 self.__finish()

eric ide

mercurial