From 7814b55395a4643c5d000d87c31683e7d8ebf46e Mon Sep 17 00:00:00 2001 From: matterhorn103 <83813148+matterhorn103@users.noreply.github.com> Date: Mon, 9 Oct 2023 13:49:00 +0200 Subject: [PATCH] Added changelog to update notification, and users will receive a changelog when they update to 1.6.0 for first time --- mora_the_explorer.py | 18 +++++++++++++++--- version.txt | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/mora_the_explorer.py b/mora_the_explorer.py index 71e7b0b..32bea49 100644 --- a/mora_the_explorer.py +++ b/mora_the_explorer.py @@ -177,7 +177,7 @@ def __init__(self): # Title and version info header self.setWindowTitle("Mora the Explorer") with open(rsrc_dir / "version.txt", encoding="utf-8") as version_file: - version_info = version_file.read() + version_info = "".join(version_file.readlines()[:5]) version_box = QLabel(version_info) version_box.setAlignment(Qt.AlignHCenter) @@ -457,9 +457,16 @@ def update_check(self): try: if update_path_version_file.exists() is True: with open(update_path_version_file, encoding="utf-8") as newest_version_file: - self.newest_version_no = newest_version_file.readlines()[2].rstrip() + version_file_info = newest_version_file.readlines() + self.newest_version_no = version_file_info[2].rstrip() + self.changelog = "".join(version_file_info[5:]).rstrip() if self.version_no != self.newest_version_no: self.notify_update() + if self.version_no == "v1.6.0" and not (rsrc_dir / "notified.txt").exists(): + self.notify_changelog() + with open((rsrc_dir / "notified.txt"), "w") as record_file: + # Save empty file so that the user is not notified next time + pass return "remote_version_found" else: return "no_remote_version" @@ -483,7 +490,7 @@ def notify_update(self): update_dialog.setWindowTitle("Update available") update_dialog.setText(f"There appears to be a new update available at:\n{self.update_path}") update_dialog.setInformativeText( - f"Your version is {self.version_no}\nThe version on the server is {self.newest_version_no}" + f"Your version is {self.version_no}\nThe version on the server is {self.newest_version_no}\n{self.changelog}" ) update_dialog.setStandardButtons(QMessageBox.Ignore | QMessageBox.Open) update_dialog.setDefaultButton(QMessageBox.Ignore) @@ -493,6 +500,11 @@ def notify_update(self): # Extra quotes necessary because cmd.exe can't handle spaces in path names otherwise os.system(f'start "" "{self.update_path}"') + # Popup to show changelog for current version upon upgrade to v1.6.0 + def notify_changelog(self): + changelog_info = QMessageBox.information(self, "Changes in v1.6.0", self.changelog) + + # Spawn popup dialog that dissuades user from using the "since" function regularly, unless the nmr group has been selected def since_function_activated(self): since_message = """ diff --git a/version.txt b/version.txt index b11978b..8cf22cc 100644 --- a/version.txt +++ b/version.txt @@ -3,3 +3,8 @@ Matt Milner v1.6.0 License: GPLv3 Please report any bugs to milner@uni-muenster.de! +Changes in this version: +- No more endless notifications during a since check +- Ability to download spectra from 2022 +- Spectra as far back as 2019 available upon request to Klaus +- Eliminated a bug that caused program to hang when closed