From baa29586d70e2954ad25624782288f1687c01e5b Mon Sep 17 00:00:00 2001 From: Joe Marshall Date: Fri, 12 Jan 2024 13:16:36 +0000 Subject: [PATCH] autoupdate disable option --- scripts/addons/cam/__init__.py | 6 +++--- scripts/addons/cam/autoupdate.py | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/addons/cam/__init__.py b/scripts/addons/cam/__init__.py index 5c9448c0..7581f190 100644 --- a/scripts/addons/cam/__init__.py +++ b/scripts/addons/cam/__init__.py @@ -137,9 +137,9 @@ class CamAddonPreferences(AddonPreferences): ("https://api.github.com/repos/pppalain/blendercam/releases", "Unstable", "Unstable releases (github.com/pppalain/blendercam)"), ("https://github.com/pppalain/blendercam/archive/refs/heads/master.zip", "Daily", "Direct from git repository (github.com/pppalain/blendercam)"), ("","Source","Where the release was downloaded from"), - ("","None","Don't do auto update"), + ("None","None","Don't do auto update"), ], - default="", + default="None", ) last_update_check: IntProperty( @@ -1195,7 +1195,7 @@ def check_operations_on_load(context): # load last used machine preset bpy.ops.script.execute_preset(filepath=machine_preset,menu_idname="CAM_MACHINE_MT_presets") _IS_LOADING_DEFAULTS=False - # check for updated plugin + # check for updated version of the plugin bpy.ops.render.cam_check_updates() diff --git a/scripts/addons/cam/autoupdate.py b/scripts/addons/cam/autoupdate.py index 7978968d..4614e710 100644 --- a/scripts/addons/cam/autoupdate.py +++ b/scripts/addons/cam/autoupdate.py @@ -18,10 +18,14 @@ class UpdateChecker(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} def execute(self, context): + print("update check") last_update_check = bpy.context.preferences.addons['cam'].preferences.last_update_check today=date.today().toordinal() + update_source = bpy.context.preferences.addons['cam'].preferences.update_source + if last_update_check!=today or True: # TODO: remove after testing - update_source = bpy.context.preferences.addons['cam'].preferences.update_source + if update_source=="None": + return {'FINISHED'} # get list of releases from github release if update_source.endswith("/releases"): with urlopen(update_source) as response: