eric7/DataViews/PyProfileDialog.py

branch
eric7
changeset 8943
23f9c7b9e18e
parent 8881
54e42bc2437a
equal deleted inserted replaced
8940:e91951ff3bbd 8943:23f9c7b9e18e
7 Module implementing a dialog to display profile data. 7 Module implementing a dialog to display profile data.
8 """ 8 """
9 9
10 import os 10 import os
11 import pickle # secok 11 import pickle # secok
12 import time
12 13
13 from PyQt6.QtCore import Qt 14 from PyQt6.QtCore import Qt
14 from PyQt6.QtWidgets import ( 15 from PyQt6.QtWidgets import (
15 QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, 16 QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem,
16 QApplication 17 QApplication
171 # disable updates of the list for speed 172 # disable updates of the list for speed
172 self.resultList.setUpdatesEnabled(False) 173 self.resultList.setUpdatesEnabled(False)
173 self.resultList.setSortingEnabled(False) 174 self.resultList.setSortingEnabled(False)
174 175
175 # now go through all the files 176 # now go through all the files
177 now = time.monotonic()
176 for progress, (func, (cc, nc, tt, ct, _callers)) in enumerate( 178 for progress, (func, (cc, nc, tt, ct, _callers)) in enumerate(
177 list(self.stats.items()), start=1 179 list(self.stats.items()), start=1
178 ): 180 ):
179 if self.cancelled: 181 if self.cancelled:
180 return 182 return
210 cpc = "{0: 8.3f}".format(ct / cc) 212 cpc = "{0: 8.3f}".format(ct / cc)
211 self.__createResultItem(c, tt, tpc, ct, cpc, func[0], 213 self.__createResultItem(c, tt, tpc, ct, cpc, func[0],
212 func[1], func[2]) 214 func[1], func[2])
213 215
214 self.checkProgress.setValue(progress) 216 self.checkProgress.setValue(progress)
215 QApplication.processEvents() 217 if time.monotonic() - now > 0.01:
218 QApplication.processEvents()
219 now = time.monotonic()
216 finally: 220 finally:
217 # reenable updates of the list 221 # reenable updates of the list
218 self.resultList.setSortingEnabled(True) 222 self.resultList.setSortingEnabled(True)
219 self.resultList.setUpdatesEnabled(True) 223 self.resultList.setUpdatesEnabled(True)
220 self.__resortResultList() 224 self.__resortResultList()

eric ide

mercurial