eric6/DataViews/CodeMetricsDialog.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8218
7c09585bd960
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
31 """ 31 """
32 Constructor 32 Constructor
33 33
34 @param parent parent widget (QWidget) 34 @param parent parent widget (QWidget)
35 """ 35 """
36 super(CodeMetricsDialog, self).__init__(parent) 36 super().__init__(parent)
37 self.setupUi(self) 37 self.setupUi(self)
38 self.setWindowFlags(Qt.WindowType.Window) 38 self.setWindowFlags(Qt.WindowType.Window)
39 39
40 self.buttonBox.button( 40 self.buttonBox.button(
41 QDialogButtonBox.StandardButton.Close).setEnabled(False) 41 QDialogButtonBox.StandardButton.Close).setEnabled(False)
167 QApplication.processEvents() 167 QApplication.processEvents()
168 168
169 total = collections.defaultdict(int) 169 total = collections.defaultdict(int)
170 CodeMetrics.summarize(total, 'files', len(files)) 170 CodeMetrics.summarize(total, 'files', len(files))
171 171
172 progress = 0
173
174 try: 172 try:
175 # disable updates of the list for speed 173 # disable updates of the list for speed
176 self.resultList.setUpdatesEnabled(False) 174 self.resultList.setUpdatesEnabled(False)
177 self.resultList.setSortingEnabled(False) 175 self.resultList.setSortingEnabled(False)
178 176
179 # now go through all the files 177 # now go through all the files
180 for file in files: 178 for progress, file in enumerate(files, start=1):
181 if self.cancelled: 179 if self.cancelled:
182 return 180 return
183 181
184 stats = CodeMetrics.analyze(file, total) 182 stats = CodeMetrics.analyze(file, total)
185 183
191 v = self.__getValues(loc, stats, identifier) 189 v = self.__getValues(loc, stats, identifier)
192 190
193 self.__createResultItem(fitm, [identifier] + v) 191 self.__createResultItem(fitm, [identifier] + v)
194 self.resultList.expandItem(fitm) 192 self.resultList.expandItem(fitm)
195 193
196 progress += 1
197 self.checkProgress.setValue(progress) 194 self.checkProgress.setValue(progress)
198 QApplication.processEvents() 195 QApplication.processEvents()
199 finally: 196 finally:
200 # reenable updates of the list 197 # reenable updates of the list
201 self.resultList.setSortingEnabled(True) 198 self.resultList.setSortingEnabled(True)

eric ide

mercurial