Skip to content
Snippets Groups Projects
Commit c7442b77 authored by Kentaro Wada's avatar Kentaro Wada
Browse files

Overwrite existing label file with importDir

parent cc7ffeb8
No related branches found
No related tags found
No related merge requests found
...@@ -917,7 +917,7 @@ class MainWindow(QMainWindow, WindowMixin): ...@@ -917,7 +917,7 @@ class MainWindow(QMainWindow, WindowMixin):
if self.hasLabels(): if self.hasLabels():
if self.labelFile: if self.labelFile:
# DL20180323 - overwrite when in directory # DL20180323 - overwrite when in directory
self._saveFile(self.saveFileDialog()) self._saveFile(self.labelFile.filename)
elif self.output: elif self.output:
self._saveFile(self.output) self._saveFile(self.output)
else: else:
......
...@@ -38,6 +38,7 @@ class LabelFile(object): ...@@ -38,6 +38,7 @@ class LabelFile(object):
self.imageData = None self.imageData = None
if filename is not None: if filename is not None:
self.load(filename) self.load(filename)
self.filename = filename
def load(self, filename): def load(self, filename):
try: try:
...@@ -61,6 +62,7 @@ class LabelFile(object): ...@@ -61,6 +62,7 @@ class LabelFile(object):
self.imageData = imageData self.imageData = imageData
self.lineColor = lineColor self.lineColor = lineColor
self.fillColor = fillColor self.fillColor = fillColor
self.filename = filename
except Exception as e: except Exception as e:
raise LabelFileError(e) raise LabelFileError(e)
...@@ -78,6 +80,7 @@ class LabelFile(object): ...@@ -78,6 +80,7 @@ class LabelFile(object):
try: try:
with open(filename, 'wb' if PY2 else 'w') as f: with open(filename, 'wb' if PY2 else 'w') as f:
json.dump(data, f, ensure_ascii=True, indent=2) json.dump(data, f, ensure_ascii=True, indent=2)
self.filename = filename
except Exception as e: except Exception as e:
raise LabelFileError(e) raise LabelFileError(e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment