Removed warning popup when canceling "add new mod"

Solves issue #1
When the file selection dialog closes without any selection it no longer causes "is no file" and "not a valid mod file" prompts to occur.
dev
Peery 11 months ago
parent 332f69f2de
commit 9e6cab5cba
Signed by: pandro
SSH Key Fingerprint: SHA256:iBUZSuDxqYr4hYpe9U3BA9NJmXKpbGt4H0S8hUwIbrA

@ -102,12 +102,16 @@ class MainWindow(QtWidgets.QMainWindow):
result = dialog.getOpenFileName(filter='ZIP (*.zip)') result = dialog.getOpenFileName(filter='ZIP (*.zip)')
self.__logger.debug(f"user selected \"{result[0]}\"") self.__logger.debug(f"user selected \"{result[0]}\"")
if result == ('', ''):
self.__logger.debug("Action: \"add new mod\" was cancelled!")
return
if not os.path.isfile(result[0]): if not os.path.isfile(result[0]):
dialog = QtWidgets.QMessageBox() dialog = QtWidgets.QMessageBox()
dialog.setWindowTitle("Not a file") dialog.setWindowTitle("Not a file")
dialog.setInformativeText(f"The given file \"{result}\" did not look like a file!") dialog.setInformativeText(f"The given file \"{result}\" did not look like a file!")
dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning)
dialog.exec() dialog.exec()
return
if not self.parent.is_valid_mod_file(result[0]): if not self.parent.is_valid_mod_file(result[0]):
dialog = QtWidgets.QMessageBox() dialog = QtWidgets.QMessageBox()
dialog.setWindowTitle("Not a valid mod file") dialog.setWindowTitle("Not a valid mod file")
@ -115,6 +119,7 @@ class MainWindow(QtWidgets.QMainWindow):
f"The given file \"{result}\" did not look like a mod file. Is the manifest.json present?") f"The given file \"{result}\" did not look like a mod file. Is the manifest.json present?")
dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning)
dialog.exec() dialog.exec()
return
self.parent.add_mod_file(result[0]) self.parent.add_mod_file(result[0])

Loading…
Cancel
Save