Skip to content

Commit

Permalink
If there no default saved dir, show a dialog for autosaving
Browse files Browse the repository at this point in the history
  • Loading branch information
tzutalin committed Sep 27, 2017
1 parent d8e9611 commit cbc1761
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
26 changes: 17 additions & 9 deletions labelImg.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def __init__(self, defaultFilename=None, defaultPrefdefClassFile=None):
recentFiles=QMenu('Open &Recent'),
labelList=labelMenu)

# Auto saving : Enble auto saving if pressing next
# Auto saving : Enable auto saving if pressing next
self.autoSaving = QAction("Auto Saving", self)
self.autoSaving.setCheckable(True)

Expand Down Expand Up @@ -1029,7 +1029,7 @@ def changeSavedir(self, _value=False):
path = '.'

dirpath = ustr(QFileDialog.getExistingDirectory(self,
'%s - Save to the directory' % __appname__, path, QFileDialog.ShowDirsOnly
'%s - Save annotations to the directory' % __appname__, path, QFileDialog.ShowDirsOnly
| QFileDialog.DontResolveSymlinks))

if dirpath is not None and len(dirpath) > 1:
Expand Down Expand Up @@ -1098,9 +1098,13 @@ def verifyImg(self, _value=False):

def openPrevImg(self, _value=False):
# Proceding prev image without dialog if having any label
if self.autoSaving.isChecked() and self.defaultSaveDir is not None:
if self.dirty is True:
self.saveFile()
if self.autoSaving.isChecked():
if self.defaultSaveDir is not None:
if self.dirty is True:
self.saveFile()
else:
self.changeSavedir()
return

if not self.mayContinue():
return
Expand All @@ -1118,10 +1122,14 @@ def openPrevImg(self, _value=False):
self.loadFile(filename)

def openNextImg(self, _value=False):
# Proceding next image without dialog if having any label
if self.autoSaving.isChecked() and self.defaultSaveDir is not None:
if self.dirty is True:
self.saveFile()
# Proceding prev image without dialog if having any label
if self.autoSaving.isChecked():
if self.defaultSaveDir is not None:
if self.dirty is True:
self.saveFile()
else:
self.changeSavedir()
return

if not self.mayContinue():
return
Expand Down
2 changes: 1 addition & 1 deletion libs/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def __init__(self):
# Be default, the home will be in the same folder as labelImg
home = os.path.expanduser("~")
self.data = {}
self.path = os.path.join(home, '.settings.pkl')
self.path = os.path.join(home, '.labelImgSettings.pkl')

def __setitem__(self, key, value):
self.data[key] = value
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.5.0
current_version = 1.5.1
commit = True
tag = True

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setup(
name='labelImg',
version='1.5.0',
version='1.5.1',
description="LabelImg is a graphical image annotation tool and label object bounding boxes in images",
long_description=readme + '\n\n' + history,
author="TzuTa Lin",
Expand Down Expand Up @@ -46,4 +46,4 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
)

0 comments on commit cbc1761

Please sign in to comment.