Skip to content

Commit

Permalink
Added changelog to update notification, and users will receive a chan…
Browse files Browse the repository at this point in the history
…gelog when they update to 1.6.0 for first time
  • Loading branch information
matterhorn103 committed Oct 9, 2023
1 parent e22eead commit 7814b55
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
18 changes: 15 additions & 3 deletions mora_the_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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"
Expand All @@ -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)
Expand All @@ -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 = """
Expand Down
5 changes: 5 additions & 0 deletions version.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ Matt Milner
v1.6.0
License: GPLv3
Please report any bugs to [email protected]!
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

0 comments on commit 7814b55

Please sign in to comment.