Browse Source

Fix bugs introduced with previous merge

Undo close and Delete shape were partially broken.
Michael Pitidis 13 years ago
parent
commit
1193c42127
3 changed files with 8 additions and 4 deletions
  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):
         assert self.shapes
         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):
         assert self.shapes
         self.shapes.pop()
+        self.drawingPolygon.emit(False)
 
     def loadPixmap(self, pixmap):
         self.pixmap = pixmap

+ 1 - 1
labelme.py

@@ -450,7 +450,7 @@ class MainWindow(QMainWindow, WindowMixin):
 
         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:
             self.addLabel(self.canvas.setLastLabel(self.labelDialog.text()))
             self.actions.mode.setEnabled(True)

+ 3 - 0
shape.py

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