Skip to content
Snippets Groups Projects
Commit 22a6a9df authored by Kentaro Wada's avatar Kentaro Wada
Browse files

Show errorMessage with not existing file to load

parent 135b4a81
No related branches found
No related tags found
No related merge requests found
......@@ -738,7 +738,10 @@ class MainWindow(QMainWindow, WindowMixin):
if filename is None:
filename = self.settings.get('filename', '')
filename = str(filename)
if QFile.exists(filename):
if not QFile.exists(filename):
self.errorMessage(
'Error opening file', 'No such file: <b>%s</b>' % filename)
return False
# assumes same name, but json extension
self.status("Loading %s..." % os.path.basename(str(filename)))
label_file = os.path.splitext(filename)[0] + '.json'
......@@ -799,7 +802,6 @@ class MainWindow(QMainWindow, WindowMixin):
if filename in self.imageList:
self.fileListWidget.setCurrentRow(self.imageList.index(filename))
return True
return False
def resizeEvent(self, event):
if self.canvas and not self.image.isNull()\
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment