feat: auto_updater script
This commit is contained in:
parent
75839e60f0
commit
dbaff5df85
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ __pycache__/
|
||||
cache
|
||||
config
|
||||
*.code-workspace
|
||||
multi_user_updater/
|
||||
|
||||
# sphinx build folder
|
||||
_build
|
@ -1,7 +1,7 @@
|
||||
bl_info = {
|
||||
"name": "Multi-User",
|
||||
"author": "Swann Martinez",
|
||||
"version": (0, 0, 2),
|
||||
"version": (0, 0, 1),
|
||||
"description": "Enable real-time collaborative workflow inside blender",
|
||||
"blender": (2, 80, 0),
|
||||
"location": "3D View > Sidebar > Multi-User tab",
|
||||
@ -133,6 +133,7 @@ def register():
|
||||
from . import operators
|
||||
from . import ui
|
||||
from . import preferences
|
||||
from . import addon_updater_ops
|
||||
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
@ -146,6 +147,7 @@ def register():
|
||||
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
||||
|
||||
preferences.register()
|
||||
addon_updater_ops.register(bl_info)
|
||||
presence.register()
|
||||
operators.register()
|
||||
ui.register()
|
||||
@ -155,8 +157,10 @@ def unregister():
|
||||
from . import operators
|
||||
from . import ui
|
||||
from . import preferences
|
||||
from . import addon_updater_ops
|
||||
|
||||
presence.unregister()
|
||||
addon_updater_ops.unregister()
|
||||
ui.unregister()
|
||||
operators.unregister()
|
||||
preferences.unregister()
|
||||
|
1663
multi_user/addon_updater.py
Normal file
1663
multi_user/addon_updater.py
Normal file
File diff suppressed because it is too large
Load Diff
1454
multi_user/addon_updater_ops.py
Normal file
1454
multi_user/addon_updater_ops.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,11 @@
|
||||
import logging
|
||||
import bpy
|
||||
|
||||
from . import utils, bl_types, environment
|
||||
from . import utils, bl_types, environment, addon_updater_ops
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ReplicatedDatablock(bpy.types.PropertyGroup):
|
||||
type_name: bpy.props.StringProperty()
|
||||
bl_name: bpy.props.StringProperty()
|
||||
@ -14,6 +15,7 @@ class ReplicatedDatablock(bpy.types.PropertyGroup):
|
||||
auto_push: bpy.props.BoolProperty(default=True)
|
||||
icon: bpy.props.StringProperty()
|
||||
|
||||
|
||||
class SessionPrefs(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
|
||||
@ -58,16 +60,16 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
subtype="DIR_PATH",
|
||||
default=environment.DEFAULT_CACHE_DIR)
|
||||
# for UI
|
||||
# category: bpy.props.EnumProperty(
|
||||
# name="Category",
|
||||
# description="Preferences Category",
|
||||
# items=[
|
||||
# ('INFO', "Information", "Information about this add-on"),
|
||||
# ('CONFIG', "Configuration", "Configuration about this add-on"),
|
||||
# ('UPDATE', "Update", "Update this add-on"),
|
||||
# ],
|
||||
# default='INFO'
|
||||
# )
|
||||
category: bpy.props.EnumProperty(
|
||||
name="Category",
|
||||
description="Preferences Category",
|
||||
items=[
|
||||
('INFO', "Information", "Information about this add-on"),
|
||||
('CONFIG', "Configuration", "Configuration about this add-on"),
|
||||
('UPDATE', "Update", "Update this add-on"),
|
||||
],
|
||||
default='INFO'
|
||||
)
|
||||
conf_session_identity_expanded: bpy.props.BoolProperty(
|
||||
name="Identity",
|
||||
description="Identity",
|
||||
@ -94,16 +96,49 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
default=False
|
||||
)
|
||||
|
||||
auto_check_update: bpy.props.BoolProperty(
|
||||
name="Auto-check for Update",
|
||||
description="If enabled, auto-check for updates using an interval",
|
||||
default=False,
|
||||
)
|
||||
updater_intrval_months: bpy.props.IntProperty(
|
||||
name='Months',
|
||||
description="Number of months between checking for updates",
|
||||
default=0,
|
||||
min=0
|
||||
)
|
||||
updater_intrval_days: bpy.props.IntProperty(
|
||||
name='Days',
|
||||
description="Number of days between checking for updates",
|
||||
default=7,
|
||||
min=0,
|
||||
max=31
|
||||
)
|
||||
updater_intrval_hours: bpy.props.IntProperty(
|
||||
name='Hours',
|
||||
description="Number of hours between checking for updates",
|
||||
default=0,
|
||||
min=0,
|
||||
max=23
|
||||
)
|
||||
updater_intrval_minutes: bpy.props.IntProperty(
|
||||
name='Minutes',
|
||||
description="Number of minutes between checking for updates",
|
||||
default=0,
|
||||
min=0,
|
||||
max=59
|
||||
)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# layout.row().prop(self, "category", expand=True)
|
||||
layout.row().prop(self, "category", expand=True)
|
||||
|
||||
# if self.category == 'INFO':
|
||||
# layout.separator()
|
||||
# layout.label(text="Enable real-time collaborative workflow inside blender")
|
||||
# if self.category == 'CONFIG':
|
||||
if self.category == 'INFO':
|
||||
layout.separator()
|
||||
layout.label(text="Enable real-time collaborative workflow inside blender")
|
||||
|
||||
if self.category == 'CONFIG':
|
||||
grid = layout.column()
|
||||
|
||||
# USER INFORMATIONS
|
||||
@ -171,6 +206,10 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
if self.conf_session_cache_expanded:
|
||||
box.row().prop(self, "cache_directory", text="Cache directory")
|
||||
|
||||
if self.category == 'UPDATE':
|
||||
from . import addon_updater_ops
|
||||
addon_updater_ops.update_settings_ui_condensed(self, context)
|
||||
|
||||
def generate_supported_types(self):
|
||||
self.supported_datablocks.clear()
|
||||
|
||||
@ -184,16 +223,19 @@ class SessionPrefs(bpy.types.AddonPreferences):
|
||||
new_db.name = type_impl_name
|
||||
new_db.type_name = type_impl_name
|
||||
new_db.bl_delay_refresh = type_module_class.bl_delay_refresh
|
||||
new_db.bl_delay_apply =type_module_class.bl_delay_apply
|
||||
new_db.bl_delay_apply = type_module_class.bl_delay_apply
|
||||
new_db.use_as_filter = True
|
||||
new_db.icon = type_module_class.bl_icon
|
||||
new_db.auto_push =type_module_class.bl_automatic_push
|
||||
new_db.bl_name=type_module_class.bl_id
|
||||
new_db.auto_push = type_module_class.bl_automatic_push
|
||||
new_db.bl_name = type_module_class.bl_id
|
||||
|
||||
|
||||
classes = (
|
||||
ReplicatedDatablock,
|
||||
SessionPrefs,
|
||||
)
|
||||
|
||||
|
||||
def register():
|
||||
from bpy.utils import register_class
|
||||
|
||||
@ -205,6 +247,7 @@ def register():
|
||||
logger.info('Generating bl_types preferences')
|
||||
prefs.generate_supported_types()
|
||||
|
||||
|
||||
def unregister():
|
||||
from bpy.utils import unregister_class
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user