Skip to content

Commit

Permalink
Implement auto-updating from the lovely cookies :)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregzaal committed Dec 21, 2016
1 parent df4d1e0 commit 557d709
Show file tree
Hide file tree
Showing 5 changed files with 1,934 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gaffer_updater
43 changes: 43 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from . import constants, functions, operators, ui

import bpy
from . import addon_updater_ops
from collections import OrderedDict
import bgl, blf
from math import pi, cos, sin, log
Expand All @@ -46,6 +47,47 @@
from bpy.app.handlers import persistent


class GafferPreferences(bpy.types.AddonPreferences):
bl_idname = __package__

# addon updater preferences
auto_check_update = bpy.props.BoolProperty(
name = "Auto-check for Update",
description = "If enabled, auto-check for updates using an interval",
default = True,
)
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=1,
min=0,
)
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
addon_updater_ops.update_settings_ui(self,context)


def do_set_world_refl_only(context):
scene = context.scene
if scene.gaf_props.WorldReflOnly and not scene.gaf_props.WorldVis:
Expand Down Expand Up @@ -237,6 +279,7 @@ class GafferProperties(bpy.types.PropertyGroup):
Blacklist = bpy.props.CollectionProperty(type=BlacklistedObject) # must be registered after classes

def register():
addon_updater_ops.register(bl_info)
bpy.types.NODE_PT_active_node_generic.append(ui.gaffer_node_menu_func)
bpy.utils.register_module(__name__)
bpy.types.Scene.gaf_props = bpy.props.PointerProperty(type=GafferProperties)
Expand Down

4 comments on commit 557d709

@TheDuckCow
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woo!

@gregzaal
Copy link
Owner Author

@gregzaal gregzaal commented on 557d709 Dec 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheDuckCow in the docs/tutorial you might want to mention adding the update folder to .gitignore.

Also #2 in step 7 here does not include the self, context params in the update_notice_box_ui() call if you just copy-paste from the text (though it is included in the screenshot).

@TheDuckCow
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the notice @gregzaal, fixed now. And yeah I'll make a note of that for gitignore, it's a good point.

Also tried testing the updater with your setup, UI all looks good but when trying to revert to 2.5 the updater (rightfully?) returns an error saying e.g. with this release that no __init__.py file is found. Seems that was back prior to having the .zip install method since it doesn't have files split up yet - for this reason, I'd just point to making use of the minimum version e.g. updater.version_min_update = (2,6,0) if 2.6 is the next release you expect to include with the updater itself and carry that forward.

@gregzaal
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, sure thing, thanks for checking :)

Please sign in to comment.