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'), recentFiles=QMenu('Open &Recent'),
labelList=labelMenu) 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 = QAction("Auto Saving", self)
self.autoSaving.setCheckable(True) self.autoSaving.setCheckable(True)
@ -1029,7 +1029,7 @@ class MainWindow(QMainWindow, WindowMixin):
path = '.' path = '.'
dirpath = ustr(QFileDialog.getExistingDirectory(self, 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)) | QFileDialog.DontResolveSymlinks))
if dirpath is not None and len(dirpath) > 1: if dirpath is not None and len(dirpath) > 1:
@ -1098,9 +1098,13 @@ class MainWindow(QMainWindow, WindowMixin):
def openPrevImg(self, _value=False): def openPrevImg(self, _value=False):
# Proceding prev image without dialog if having any label # Proceding prev image without dialog if having any label
if self.autoSaving.isChecked() and self.defaultSaveDir is not None: if self.autoSaving.isChecked():
if self.dirty is True: if self.defaultSaveDir is not None:
self.saveFile() if self.dirty is True:
self.saveFile()
else:
self.changeSavedir()
return
if not self.mayContinue(): if not self.mayContinue():
return return
@ -1118,10 +1122,14 @@ class MainWindow(QMainWindow, WindowMixin):
self.loadFile(filename) self.loadFile(filename)
def openNextImg(self, _value=False): def openNextImg(self, _value=False):
# Proceding next image without dialog if having any label # Proceding prev image without dialog if having any label
if self.autoSaving.isChecked() and self.defaultSaveDir is not None: if self.autoSaving.isChecked():
if self.dirty is True: if self.defaultSaveDir is not None:
self.saveFile() if self.dirty is True:
self.saveFile()
else:
self.changeSavedir()
return
if not self.mayContinue(): if not self.mayContinue():
return return

View File

@ -7,7 +7,7 @@ class Settings(object):
# Be default, the home will be in the same folder as labelImg # Be default, the home will be in the same folder as labelImg
home = os.path.expanduser("~") home = os.path.expanduser("~")
self.data = {} self.data = {}
self.path = os.path.join(home, '.settings.pkl') self.path = os.path.join(home, '.labelImgSettings.pkl')
def __setitem__(self, key, value): def __setitem__(self, key, value):
self.data[key] = value self.data[key] = value

View File

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

View File

@ -15,7 +15,7 @@ requirements = [
setup( setup(
name='labelImg', 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", description="LabelImg is a graphical image annotation tool and label object bounding boxes in images",
long_description=readme + '\n\n' + history, long_description=readme + '\n\n' + history,
author="TzuTa Lin", author="TzuTa Lin",
@ -46,4 +46,4 @@ setup(
'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
], ],
) )