Fix bug: An index error after select a directory when open a new file.
This commit is contained in:
parent
6afd15aa88
commit
551fc7e00d
12
labelImg.py
12
labelImg.py
@ -967,13 +967,19 @@ class MainWindow(QMainWindow, WindowMixin):
|
|||||||
# Make sure that filePath is a regular python string, rather than QString
|
# Make sure that filePath is a regular python string, rather than QString
|
||||||
filePath = ustr(filePath)
|
filePath = ustr(filePath)
|
||||||
|
|
||||||
|
# Fix bug: An index error after select a directory when open a new file.
|
||||||
unicodeFilePath = ustr(filePath)
|
unicodeFilePath = ustr(filePath)
|
||||||
|
unicodeFilePath = os.path.abspath(unicodeFilePath)
|
||||||
# Tzutalin 20160906 : Add file list and dock to move faster
|
# Tzutalin 20160906 : Add file list and dock to move faster
|
||||||
# Highlight the file item
|
# Highlight the file item
|
||||||
if unicodeFilePath and self.fileListWidget.count() > 0:
|
if unicodeFilePath and self.fileListWidget.count() > 0:
|
||||||
index = self.mImgList.index(unicodeFilePath)
|
if unicodeFilePath in self.mImgList:
|
||||||
fileWidgetItem = self.fileListWidget.item(index)
|
index = self.mImgList.index(unicodeFilePath)
|
||||||
fileWidgetItem.setSelected(True)
|
fileWidgetItem = self.fileListWidget.item(index)
|
||||||
|
fileWidgetItem.setSelected(True)
|
||||||
|
else:
|
||||||
|
self.fileListWidget.clear()
|
||||||
|
self.mImgList.clear()
|
||||||
|
|
||||||
if unicodeFilePath and os.path.exists(unicodeFilePath):
|
if unicodeFilePath and os.path.exists(unicodeFilePath):
|
||||||
if LabelFile.isLabelFile(unicodeFilePath):
|
if LabelFile.isLabelFile(unicodeFilePath):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user