From e0ae8b4428d53869caa89525020e58fe3854e609 Mon Sep 17 00:00:00 2001 From: Alchemist_W <2443176192@qq.com> Date: Thu, 22 Jul 2021 14:31:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E8=8F=9C=E5=8D=95edit=E5=92=8C?= =?UTF-8?q?=E9=BC=A0=E6=A0=87=E5=8F=B3=E9=94=AE=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=B7=A6=E5=8F=B3=E6=97=8B=E8=BD=AC=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20=E4=B8=94=E6=9C=89=E6=A0=87=E6=B3=A8=E6=A1=86?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E4=B8=8D=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E6=97=8B=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PPOCRLabel/PPOCRLabel.py | 42 ++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/PPOCRLabel/PPOCRLabel.py b/PPOCRLabel/PPOCRLabel.py index e52e5312..31a21e2a 100644 --- a/PPOCRLabel/PPOCRLabel.py +++ b/PPOCRLabel/PPOCRLabel.py @@ -800,13 +800,20 @@ class MainWindow(QMainWindow, WindowMixin): filename = self.mImgList[self.currIndex] if os.path.exists(filename): - _value = True - self.actions.rotateLeft.setEnabled(_value) - pix = cv2.imread(filename) - pix = np.rot90(pix, k=1) - cv2.imwrite(filename, pix) - self.canvas.update() - self.loadFile(filename) + if self.itemsToShapesbox: + if self.lang == 'ch': + self.msgBox.warning(self, "提示", "\n 该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。") + else: + self.msgBox.warning(self, "Warn", "\n The picture already has a label box, and rotation will disrupt the label.\ + It is recommended to clear the label box and rotate it.") + else: + _value = True + self.actions.rotateLeft.setEnabled(_value) + pix = cv2.imread(filename) + pix = np.rot90(pix, k=1) + cv2.imwrite(filename, pix) + self.canvas.update() + self.loadFile(filename) else: _value = False if self.lang == 'ch': @@ -821,13 +828,20 @@ class MainWindow(QMainWindow, WindowMixin): filename = self.mImgList[self.currIndex] if os.path.exists(filename): - _value = True - self.actions.rotateRight.setEnabled(_value) - pix = cv2.imread(filename) - pix = np.rot90(pix, k=-1) - cv2.imwrite(filename, pix) - self.canvas.update() - self.loadFile(filename) + if self.itemsToShapesbox: + if self.lang == 'ch': + self.msgBox.warning(self, "提示", "\n 该图片已经有标注框,旋转操作会打乱标注,建议清除标注框后旋转。") + else: + self.msgBox.warning(self, "Warn", "\n The picture already has a label box, and rotation will disrupt the label.\ + It is recommended to clear the label box and rotate it.") + else: + _value = True + self.actions.rotateRight.setEnabled(_value) + pix = cv2.imread(filename) + pix = np.rot90(pix, k=-1) + cv2.imwrite(filename, pix) + self.canvas.update() + self.loadFile(filename) else: _value = False -- GitLab