If there no default saved dir, show a dialog for autosaving

This commit is contained in:
tzutalin 2017-09-27 18:43:24 +08:00
parent d8e961126a
commit cbc1761e9f
4 changed files with 21 additions and 13 deletions

View File

@ -342,7 +342,7 @@ class MainWindow(QMainWindow, WindowMixin):
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)
@ -1029,7 +1029,7 @@ class MainWindow(QMainWindow, WindowMixin):
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:
@ -1098,9 +1098,13 @@ class MainWindow(QMainWindow, WindowMixin):
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
@ -1118,10 +1122,14 @@ class MainWindow(QMainWindow, WindowMixin):
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

View File

@ -7,7 +7,7 @@ class Settings(object):
# 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

View File

@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.5.0
current_version = 1.5.1
commit = True
tag = True

View File

@ -15,7 +15,7 @@ requirements = [
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",
@ -46,4 +46,4 @@ setup(
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
)