From b9c83ff54db8a83e6adfba77c08db9aad71bbbf1 Mon Sep 17 00:00:00 2001 From: Kentaro Wada Date: Wed, 18 Sep 2024 10:18:53 +0900 Subject: [PATCH] Make duplicateSelectedShape use copySelectedShape and pasteSelectedShape --- labelme/app.py | 6 ++---- labelme/widgets/canvas.py | 6 ------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/labelme/app.py b/labelme/app.py index 8ef10358a..207a769cf 100644 --- a/labelme/app.py +++ b/labelme/app.py @@ -1471,10 +1471,8 @@ def format_shape(s): return False def duplicateSelectedShape(self): - added_shapes = self.canvas.duplicateSelectedShapes() - for shape in added_shapes: - self.addLabel(shape) - self.setDirty() + self.copySelectedShape() + self.pasteSelectedShape() def pasteSelectedShape(self): self.loadShapes(self._copied_shapes, replace=False) diff --git a/labelme/widgets/canvas.py b/labelme/widgets/canvas.py index b243d107a..d71a6125b 100644 --- a/labelme/widgets/canvas.py +++ b/labelme/widgets/canvas.py @@ -666,12 +666,6 @@ def deleteShape(self, shape): self.storeShapes() self.update() - def duplicateSelectedShapes(self): - if self.selectedShapes: - self.selectedShapesCopy = [s.copy() for s in self.selectedShapes] - self.endMove(copy=True) - return self.selectedShapes - def paintEvent(self, event): if not self.pixmap: return super(Canvas, self).paintEvent(event)