Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kajitsy committed Aug 27, 2024
1 parent 4a12791 commit 2e0ecba
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
2 changes: 1 addition & 1 deletion emilia.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

warnings.filterwarnings("ignore", category=DeprecationWarning)

version = "2.2.4b2"
version = "2.2.4b3"
pre = True
sample_rate = 48000

Expand Down
3 changes: 1 addition & 2 deletions locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
"character_voice_changed": "The character's voice has been added/changed!"
},
"AutoUpdate": {
"upgrade_to": "Upgrade to Build",
"emilia_updated": "Emilia updated to Build",
"upgrade_to": "Upgrade to ",
"UpdateCompleteTitle": "Update Complete",
"UpdateCompleteMessage": "The update has been successfully installed. Please restart the application."
},
Expand Down
3 changes: 1 addition & 2 deletions locales/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
"character_voice_changed": "Голос персонажа был добавлен/изменен!"
},
"AutoUpdate": {
"upgrade_to": "Обновление до Build",
"emilia_updated": "Emilia обновлена до Build",
"upgrade_to": "Обновление до ",
"UpdateCompleteTitle": "Обновление завершено",
"UpdateCompleteMessage": "Обновление успешно установлено. Пожалуйста, перезапустите приложение."
},
Expand Down
39 changes: 26 additions & 13 deletions modules/auto_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,36 @@ def check_for_updates(ver, target_filename, pre=False, parent=None):

releases = response.json()

latest_release = None
latest_prerelease = None
for release in releases:
latest_version = release["tag_name"]
if pre or not release["prerelease"]:
if version.parse(latest_version) > version.parse(ver):
reply = QMessageBox.question(
parent, 'An update is available',
f"{trls.tr('AutoUpdate', 'upgrade_to')} {latest_version}?",
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
)

if reply == QMessageBox.StandardButton.Yes:
update(release, target_filename, parent)
return
if not latest_release and not release["prerelease"]:
latest_release = release
elif not latest_prerelease and release["prerelease"]:
latest_prerelease = release

target_release = None
if pre and latest_prerelease:
target_release = latest_prerelease
else:
target_release = latest_release

if target_release:
latest_version = target_release["tag_name"]
if version.parse(latest_version) > version.parse(ver):
reply = QMessageBox.question(
parent, 'An update is available',
f"{trls.tr('AutoUpdate', 'upgrade_to')} {latest_version}?",
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
)

if reply == QMessageBox.StandardButton.Yes:
update(target_release, target_filename, parent)
return

except requests.exceptions.RequestException as e:
QMessageBox.warning(
parent, trls.tr('Errors', 'Error'),
parent, trls.tr('Errors', 'Error'),
f"{trls.tr('Errors', 'UpdateCheckError')} {e}"
)
writeconfig('autoupdate_enable', False)
Expand Down

0 comments on commit 2e0ecba

Please sign in to comment.