DataViews/PyProfileDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3021
801289962f4e
child 3145
a9de05d4a22f
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
83 self.__menu = QMenu(self) 83 self.__menu = QMenu(self)
84 self.filterItm = self.__menu.addAction( 84 self.filterItm = self.__menu.addAction(
85 self.trUtf8('Exclude Python Library'), 85 self.trUtf8('Exclude Python Library'),
86 self.__filter) 86 self.__filter)
87 self.__menu.addSeparator() 87 self.__menu.addSeparator()
88 self.__menu.addAction(self.trUtf8('Erase Profiling Info'), 88 self.__menu.addAction(
89 self.__eraseProfile) 89 self.trUtf8('Erase Profiling Info'), self.__eraseProfile)
90 self.__menu.addAction(self.trUtf8('Erase Timing Info'), 90 self.__menu.addAction(
91 self.__eraseTiming) 91 self.trUtf8('Erase Timing Info'), self.__eraseTiming)
92 self.__menu.addSeparator() 92 self.__menu.addSeparator()
93 self.__menu.addAction(self.trUtf8('Erase All Infos'), self.__eraseAll) 93 self.__menu.addAction(self.trUtf8('Erase All Infos'), self.__eraseAll)
94 self.resultList.setContextMenuPolicy(Qt.CustomContextMenu) 94 self.resultList.setContextMenuPolicy(Qt.CustomContextMenu)
95 self.resultList.customContextMenuRequested.connect( 95 self.resultList.customContextMenuRequested.connect(
96 self.__showContextMenu) 96 self.__showContextMenu)
170 # now go through all the files 170 # now go through all the files
171 for func, (cc, nc, tt, ct, callers) in list(self.stats.items()): 171 for func, (cc, nc, tt, ct, callers) in list(self.stats.items()):
172 if self.cancelled: 172 if self.cancelled:
173 return 173 return
174 174
175 if not (self.ericpath and 175 if not (self.ericpath and
176 func[0].startswith(self.ericpath)) and \ 176 func[0].startswith(self.ericpath)) and \
177 not func[0].startswith("DebugClients") and \ 177 not func[0].startswith("DebugClients") and \
178 func[0] != "profile" and \ 178 func[0] != "profile" and \
179 not (exclude and ( 179 not (exclude and (
180 func[0].startswith(self.pyLibPath) or func[0] == "")): 180 func[0].startswith(self.pyLibPath) or func[0] == "")):
227 """ 227 """
228 self.basename = os.path.splitext(pfn)[0] 228 self.basename = os.path.splitext(pfn)[0]
229 229
230 fname = "{0}.profile".format(self.basename) 230 fname = "{0}.profile".format(self.basename)
231 if not os.path.exists(fname): 231 if not os.path.exists(fname):
232 E5MessageBox.warning(self, 232 E5MessageBox.warning(
233 self,
233 self.trUtf8("Profile Results"), 234 self.trUtf8("Profile Results"),
234 self.trUtf8("""<p>There is no profiling data""" 235 self.trUtf8("""<p>There is no profiling data"""
235 """ available for <b>{0}</b>.</p>""") 236 """ available for <b>{0}</b>.</p>""")
236 .format(pfn)) 237 .format(pfn))
237 self.close() 238 self.close()
238 return 239 return
239 try: 240 try:
240 f = open(fname, 'rb') 241 f = open(fname, 'rb')
241 self.stats = pickle.load(f) 242 self.stats = pickle.load(f)
242 f.close() 243 f.close()
243 except (EnvironmentError, pickle.PickleError, EOFError): 244 except (EnvironmentError, pickle.PickleError, EOFError):
244 E5MessageBox.critical(self, 245 E5MessageBox.critical(
246 self,
245 self.trUtf8("Loading Profiling Data"), 247 self.trUtf8("Loading Profiling Data"),
246 self.trUtf8("""<p>The profiling data could not be""" 248 self.trUtf8("""<p>The profiling data could not be"""
247 """ read from file <b>{0}</b>.</p>""") 249 """ read from file <b>{0}</b>.</p>""")
248 .format(fname)) 250 .format(fname))
249 self.close() 251 self.close()
250 return 252 return
251 253
252 self.file = fn 254 self.file = fn
253 self.__populateLists() 255 self.__populateLists()

eric ide

mercurial