251 @pyqtSlot() |
253 @pyqtSlot() |
252 def __formatButtonClicked(self): |
254 def __formatButtonClicked(self): |
253 """ |
255 """ |
254 Private slot handling the selection of the 'Format Code' button. |
256 Private slot handling the selection of the 'Format Code' button. |
255 """ |
257 """ |
|
258 files = [] |
|
259 for row in range(self.resultsList.topLevelItemCount()): |
|
260 itm = self.resultsList.topLevelItem(row) |
|
261 if itm.data(0, BlackFormattingDialog.StatusRole) == "changed": |
|
262 files.append(itm.data(0, BlackFormattingDialog.FileNameRole)) |
|
263 if files: |
|
264 self.__filesList = files |
|
265 |
256 self.__config["__action__"] = BlackFormattingAction.Format |
266 self.__config["__action__"] = BlackFormattingAction.Format |
257 |
|
258 self.__performAction() |
267 self.__performAction() |
259 |
268 |
260 @pyqtSlot(QTreeWidgetItem, int) |
269 @pyqtSlot(QTreeWidgetItem, int) |
261 def on_resultsList_itemDoubleClicked(self, item, column): |
270 def on_resultsList_itemDoubleClicked(self, item, column): |
262 """ |
271 """ |
563 isError = True |
572 isError = True |
564 |
573 |
565 if status != "ignored": |
574 if status != "ignored": |
566 self.__statistics.processedCount += 1 |
575 self.__statistics.processedCount += 1 |
567 |
576 |
568 if self.__project: |
577 itm = QTreeWidgetItem( |
569 filename = self.__project.getRelativePath(filename) |
578 self.resultsList, |
570 |
579 [ |
571 itm = QTreeWidgetItem(self.resultsList, [statusMsg, filename]) |
580 statusMsg, |
|
581 self.__project.getRelativePath(filename) |
|
582 if self.__project |
|
583 else filename, |
|
584 ], |
|
585 ) |
|
586 itm.setData(0, BlackFormattingDialog.StatusRole, status) |
|
587 itm.setData(0, BlackFormattingDialog.FileNameRole, filename) |
572 if data: |
588 if data: |
573 itm.setData( |
589 itm.setData( |
574 0, BlackFormattingDialog.DataTypeRole, "error" if isError else "diff" |
590 0, BlackFormattingDialog.DataTypeRole, "error" if isError else "diff" |
575 ) |
591 ) |
576 itm.setData(0, BlackFormattingDialog.DataRole, data) |
592 itm.setData(0, BlackFormattingDialog.DataRole, data) |