Auto update now works

This commit is contained in:
Yusarina
2024-10-22 00:18:19 +01:00
parent 1b908a4200
commit fd87d1d5d7
3 changed files with 15 additions and 10 deletions
+5
View File
@@ -7,6 +7,7 @@ if "bpy" not in locals():
from .core.register import __bl_ordered_classes from .core.register import __bl_ordered_classes
from .core import properties from .core import properties
from .core import addon_preferences from .core import addon_preferences
from .core.updater import check_for_update_on_start
else: else:
import importlib import importlib
importlib.reload(ui) importlib.reload(ui)
@@ -33,6 +34,8 @@ def register():
#finally register properties that may use some classes. #finally register properties that may use some classes.
core.register.register_properties() core.register.register_properties()
bpy.app.handlers.load_post.append(check_for_update_on_start)
from .functions.mesh_tools import AvatarToolkit_OT_ApplyShapeKey from .functions.mesh_tools import AvatarToolkit_OT_ApplyShapeKey
bpy.types.MESH_MT_shape_key_context_menu.append((lambda self, context: self.layout.separator())) bpy.types.MESH_MT_shape_key_context_menu.append((lambda self, context: self.layout.separator()))
@@ -41,6 +44,8 @@ def register():
def unregister(): def unregister():
print("Unregistering Avatar Toolkit") print("Unregistering Avatar Toolkit")
# Unregister the UI classes # Unregister the UI classes
if check_for_update_on_start in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.remove(check_for_update_on_start)
# Iterate over the classes to unregister in reverse order and unregister them # Iterate over the classes to unregister in reverse order and unregister them
for cls in reversed(list(__bl_ordered_classes)): for cls in reversed(list(__bl_ordered_classes)):
+2 -8
View File
@@ -6,6 +6,7 @@ import urllib
import shutil import shutil
import pathlib import pathlib
import zipfile import zipfile
import time
from threading import Thread from threading import Thread
from bpy.app.handlers import persistent from bpy.app.handlers import persistent
from ..functions.translations import t from ..functions.translations import t
@@ -13,7 +14,7 @@ from .addon_preferences import get_preference, get_current_version, save_prefere
from .register import register_wrap from .register import register_wrap
from ..ui.panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME from ..ui.panel import AvatarToolKit_PT_AvatarToolkitPanel, CATEGORY_NAME
GITHUB_REPO = "teamneoneko/Avatar-Toolkit" GITHUB_REPO = "Yusarina/avito"
is_checking_for_update = False is_checking_for_update = False
update_needed = False update_needed = False
@@ -292,10 +293,3 @@ def ui_refresh():
for window in windowManager.windows: for window in windowManager.windows:
for area in window.screen.areas: for area in window.screen.areas:
area.tag_redraw() area.tag_redraw()
def register():
bpy.app.handlers.load_post.append(check_for_update_on_start)
def unregister():
if check_for_update_on_start in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.remove(check_for_update_on_start)
+8 -2
View File
@@ -256,8 +256,14 @@
"Updater.UpdateToLatestButton.label": "Update to {name}", "Updater.UpdateToLatestButton.label": "Update to {name}",
"Updater.UpdateToSelectedButton.label": "Update", "Updater.UpdateToSelectedButton.label": "Update",
"Updater.currentVersion": "Current Version: {name}", "Updater.currentVersion": "Current Version: {name}",
"Scene.avatar_toolkit_updater_version_list.name": "Available Versions", "Updater.CheckForUpdateButton.desc": "Check for available updates",
"Scene.avatar_toolkit_updater_version_list.description": "List of available versions to update to", "UpdateToLatestButton.desc": "Update to the latest version",
"UpdateNotificationPopup.label": "Update Notification",
"UpdateNotificationPopup.desc": "Notification about available updates",
"UpdateNotificationPopup.newUpdate": "New update available: {version}",
"RestartBlenderPopup.label": "Restart Blender",
"RestartBlenderPopup.desc": "Restart Blender to complete the update",
"RestartBlenderPopup.message": "Update successful! Please restart Blender.",
"check_for_update.cantCheck": "Unable to check for updates", "check_for_update.cantCheck": "Unable to check for updates",
"download_file.cantConnect": "Cannot connect to update server", "download_file.cantConnect": "Cannot connect to update server",
"download_file.cantFindZip": "Update file not found", "download_file.cantFindZip": "Update file not found",