Эх сурвалжийг харах

Fix bugs introduced with previous merge

Undo close and Delete shape were partially broken.
Michael Pitidis 13 жил өмнө
parent
commit
1193c42127
3 өөрчлөгдсөн 8 нэмэгдсэн , 4 устгасан
  1. 4 3
      canvas.py
  2. 1 1
      labelme.py
  3. 3 0
      shape.py

+ 4 - 3
canvas.py

@@ -452,13 +452,14 @@ class Canvas(QWidget):
     def undoLastLine(self):
     def undoLastLine(self):
         assert self.shapes
         assert self.shapes
         self.current = self.shapes.pop()
         self.current = self.shapes.pop()
-        pos = self.current.popPoint()
-        self.line.points = [self.current[-1], pos]
-        self.setEditing()
+        self.current.setOpen()
+        self.line.points = [self.current[-1], self.current[0]]
+        self.drawingPolygon.emit(True)
 
 
     def deleteLastShape(self):
     def deleteLastShape(self):
         assert self.shapes
         assert self.shapes
         self.shapes.pop()
         self.shapes.pop()
+        self.drawingPolygon.emit(False)
 
 
     def loadPixmap(self, pixmap):
     def loadPixmap(self, pixmap):
         self.pixmap = pixmap
         self.pixmap = pixmap

+ 1 - 1
labelme.py

@@ -450,7 +450,7 @@ class MainWindow(QMainWindow, WindowMixin):
 
 
         position MUST be in global coordinates.
         position MUST be in global coordinates.
         """
         """
-        action = self.labelDialog.popUp(text='Enter name', position=position)
+        action = self.labelDialog.popUp(text="Enter object's name", position=position)
         if action == self.labelDialog.OK:
         if action == self.labelDialog.OK:
             self.addLabel(self.canvas.setLastLabel(self.labelDialog.text()))
             self.addLabel(self.canvas.setLastLabel(self.labelDialog.text()))
             self.actions.mode.setEnabled(True)
             self.actions.mode.setEnabled(True)

+ 3 - 0
shape.py

@@ -66,6 +66,9 @@ class Shape(object):
     def isClosed(self):
     def isClosed(self):
         return self._closed
         return self._closed
 
 
+    def setOpen(self):
+        self._closed = False
+
     def paint(self, painter):
     def paint(self, painter):
         if self.points:
         if self.points:
             color = self.select_line_color if self.selected else self.line_color
             color = self.select_line_color if self.selected else self.line_color