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