246 @pyqtSlot() |
248 @pyqtSlot() |
247 def __sortImportsButtonClicked(self): |
249 def __sortImportsButtonClicked(self): |
248 """ |
250 """ |
249 Private slot handling the selection of the 'Sort Imports' button. |
251 Private slot handling the selection of the 'Sort Imports' button. |
250 """ |
252 """ |
|
253 files = [] |
|
254 for row in range(self.resultsList.topLevelItemCount()): |
|
255 itm = self.resultsList.topLevelItem(row) |
|
256 if itm.data(0, IsortFormattingDialog.StatusRole) == "changed": |
|
257 files.append(itm.data(0, IsortFormattingDialog.FileNameRole)) |
|
258 if files: |
|
259 self.__filesList = files |
|
260 |
251 self.__config["__action__"] = IsortFormattingAction.Sort |
261 self.__config["__action__"] = IsortFormattingAction.Sort |
252 |
|
253 self.__performAction() |
262 self.__performAction() |
254 |
263 |
255 @pyqtSlot(QTreeWidgetItem, int) |
264 @pyqtSlot(QTreeWidgetItem, int) |
256 def on_resultsList_itemDoubleClicked(self, item, column): |
265 def on_resultsList_itemDoubleClicked(self, item, column): |
257 """ |
266 """ |
355 self.__statistics.processedCount += 1 |
364 self.__statistics.processedCount += 1 |
356 |
365 |
357 if self.__project: |
366 if self.__project: |
358 filename = self.__project.getRelativePath(filename) |
367 filename = self.__project.getRelativePath(filename) |
359 |
368 |
360 itm = QTreeWidgetItem(self.resultsList, [statusMsg, filename]) |
369 itm = QTreeWidgetItem( |
|
370 self.resultsList, |
|
371 [ |
|
372 statusMsg, |
|
373 self.__project.getRelativePath(filename) |
|
374 if self.__project |
|
375 else filename, |
|
376 ], |
|
377 ) |
|
378 itm.setData(0, IsortFormattingDialog.StatusRole, status) |
|
379 itm.setData(0, IsortFormattingDialog.FileNameRole, filename) |
361 if data: |
380 if data: |
362 itm.setData( |
381 itm.setData( |
363 0, IsortFormattingDialog.DataTypeRole, "error" if isError else "diff" |
382 0, IsortFormattingDialog.DataTypeRole, "error" if isError else "diff" |
364 ) |
383 ) |
365 itm.setData(0, IsortFormattingDialog.DataRole, data) |
384 itm.setData(0, IsortFormattingDialog.DataRole, data) |