[Fix] Remove confirmation status and "done" icon after image rotation#216
[Fix] Remove confirmation status and "done" icon after image rotation#216GreatV merged 1 commit intoPFCCLab:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request fixes the image rotation functionality to properly reset the confirmation status and visual indicators after an image is rotated. This ensures users are prompted to re-review modified images.
- Clears confirmation status from
fileStatedictafter image rotation - Removes the "done" icon from the file list widget for rotated images
- Maintains visual consistency by indicating that rotated images need re-confirmation
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| # Remove confirmation status after rotation | ||
| img_idx = self.getImglabelidx(filename) | ||
| if img_idx in self.fileStatedict: |
There was a problem hiding this comment.
The code should handle the case where getImglabelidx(filename) returns None or an invalid value. If img_idx is None, the in check will still pass but pop() could fail or behave unexpectedly.
| if img_idx in self.fileStatedict: | |
| if img_idx is not None and img_idx in self.fileStatedict: |
| if filename in self.mImgList: | ||
| currIndex = self.mImgList.index(filename) | ||
| item = self.fileListWidget.item(currIndex) | ||
| if item: | ||
| item.setIcon(QIcon()) |
There was a problem hiding this comment.
Using list.index() after checking membership with in results in two linear searches through the list. Store the index from the first search or use a try-catch block with index() directly to avoid the redundant search.
| if filename in self.mImgList: | |
| currIndex = self.mImgList.index(filename) | |
| item = self.fileListWidget.item(currIndex) | |
| if item: | |
| item.setIcon(QIcon()) | |
| try: | |
| currIndex = self.mImgList.index(filename) | |
| item = self.fileListWidget.item(currIndex) | |
| if item: | |
| item.setIcon(QIcon()) | |
| except ValueError: | |
| pass |
This pull request updates the image rotation functionality to ensure that after rotating an image, its confirmation status is cleared and the "done" icon is removed from the file list. This helps prevent confusion by indicating that the image needs to be reviewed again after modification.
Image rotation and status reset:
rotateImg, the confirmation status is removed fromfileStatedictfor the affected image, ensuring that users are prompted to re-confirm the image.