forked from openlp/openlp
Improved isComplete() validation for single file/folder.
This commit is contained in:
parent
676b0223b8
commit
2ccf92f543
@ -496,8 +496,11 @@ class SongImportSourcePage(QtGui.QWizardPage):
|
|||||||
|
|
||||||
def isComplete(self):
|
def isComplete(self):
|
||||||
"""
|
"""
|
||||||
Returns True if an available format is selected, and the
|
Returns True if:
|
||||||
file/folder/files widget is not empty.
|
* an available format is selected, and
|
||||||
|
* if MultipleFiles mode, at least one file is selected
|
||||||
|
* or if SingleFile mode, the specified file exists
|
||||||
|
* or if SingleFolder mode, the specified folder exists
|
||||||
|
|
||||||
When this method returns True, the wizard's Next button is enabled.
|
When this method returns True, the wizard's Next button is enabled.
|
||||||
"""
|
"""
|
||||||
@ -510,7 +513,12 @@ class SongImportSourcePage(QtGui.QWizardPage):
|
|||||||
if wizard.formatWidgets[format][u'fileListWidget'].count() > 0:
|
if wizard.formatWidgets[format][u'fileListWidget'].count() > 0:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
filepathEdit = wizard.formatWidgets[format][u'filepathEdit']
|
filepath = wizard.formatWidgets[format][u'filepathEdit'].text()
|
||||||
if not filepathEdit.text().isEmpty():
|
if not filepath.isEmpty():
|
||||||
return True
|
if select_mode == SongFormatSelect.SingleFile\
|
||||||
|
and os.path.isfile(filepath):
|
||||||
|
return True
|
||||||
|
elif select_mode == SongFormatSelect.SingleFolder\
|
||||||
|
and os.path.isdir(filepath):
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user