Use u() functions to convert string for python2/3

This commit is contained in:
tzutalin 2017-03-09 13:18:55 +08:00
parent 634fc0c637
commit ef13a1ede5

View File

@ -1033,13 +1033,10 @@ class MainWindow(QMainWindow, WindowMixin):
def openFile(self, _value=False):
if not self.mayContinue():
return
path = os.path.dirname(str(self.filePath))\
if self.filePath else '.'
path = os.path.dirname(u(self.filePath)) if self.filePath else '.'
formats = ['*.%s' % fmt.data().decode("ascii").lower() for fmt in QImageReader.supportedImageFormats()]
filters = "Image & Label files (%s)" % \
' '.join(formats + ['*%s' % LabelFile.suffix])
filename = QFileDialog.getOpenFileName(self,
'%s - Choose Image or Label file' % __appname__, path, filters)
filters = "Image & Label files (%s)" % ' '.join(formats + ['*%s' % LabelFile.suffix])
filename = QFileDialog.getOpenFileName(self, '%s - Choose Image or Label file' % __appname__, path, filters)
if filename:
if isinstance(filename, (tuple, list)):
filename = filename[0]