diff --git a/window/main_window.py b/window/main_window.py index 89e79ee..66c148f 100755 --- a/window/main_window.py +++ b/window/main_window.py @@ -102,12 +102,16 @@ class MainWindow(QtWidgets.QMainWindow): result = dialog.getOpenFileName(filter='ZIP (*.zip)') 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]): dialog = QtWidgets.QMessageBox() dialog.setWindowTitle("Not a file") dialog.setInformativeText(f"The given file \"{result}\" did not look like a file!") dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) dialog.exec() + return if not self.parent.is_valid_mod_file(result[0]): dialog = QtWidgets.QMessageBox() 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?") dialog.setIcon(QtWidgets.QMessageBox.Icon.Warning) dialog.exec() + return self.parent.add_mod_file(result[0])