comparison DependencyLoader/Core.lua @ 18:e7995d599184 tip

updated pkgmeta fix the inversion in addon:Enable added support for late-loading
author mckenziemc
date Tue, 21 Dec 2010 00:23:57 -0800
parents f825ccf94a89
children
comparison
equal deleted inserted replaced
17:f825ccf94a89 18:e7995d599184
46 function Core:CanForceLoad() 46 function Core:CanForceLoad()
47 return self:IsForceLoadAvailable() and self:IsForceLoadAllowed() 47 return self:IsForceLoadAvailable() and self:IsForceLoadAllowed()
48 end 48 end
49 49
50 50
51 function Core:CanLoadLate()
52 -- assume we've already logged in
53 return true
54 -- TODO: check user settings
55 end
56
57
51 -- Enables any dependencies needed by the addons 58 -- Enables any dependencies needed by the addons
52 -- that have already been enabled 59 -- that have already been enabled
53 function Core:PrepareAllAddons() 60 function Core:PrepareAllAddons()
54 for i=1, GetNumAddOns() do 61 for i=1, GetNumAddOns() do
55 local addon = classes.Addon:Get(i) 62 local addon = classes.Addon:Get(i)
101 -- deps will all get loaded since req. for root to load 108 -- deps will all get loaded since req. for root to load
102 -- else 109 -- else
103 -- if it can be loaded with a reloadui then prepare after login 110 -- if it can be loaded with a reloadui then prepare after login
104 -- else 111 -- else
105 -- it can't be loaded, maybe tell the user 112 -- it can't be loaded, maybe tell the user
113
114 debug("EnableAddOn hook, checking", addon:GetName())
106 115
107 if tree:CanForceLoad() then 116 if tree:CanForceLoad() then
108 if addon:CanLoD() then 117 if addon:CanLoD() then
109 tree:PrepareForLoD() 118 tree:PrepareForLoD()
110 else 119 else
142 -- can't be loaded, maybe tell the user 151 -- can't be loaded, maybe tell the user
143 152
144 if tree:CanLoD() then 153 if tree:CanLoD() then
145 tree:PrepareForLoad() 154 tree:PrepareForLoad()
146 -- don't actually intend to reload, just enable everything 155 -- don't actually intend to reload, just enable everything
156 elseif self:CanLoadLate() and tree:CanLoadLate() then
157 tree:LoadLate()
147 elseif tree:CanLoad() then 158 elseif tree:CanLoad() then
148 tree:PrepareForLoad() 159 tree:PrepareForLoad()
149 requestReload = true 160 requestReload = true
150 else 161 else
151 -- TODO: tell user 162 -- TODO: tell user
199 self.queuedEnables[addon] = true 210 self.queuedEnables[addon] = true
200 end 211 end
201 212
202 213
203 function Core:RawEnableAddOn(...) 214 function Core:RawEnableAddOn(...)
215 debug("RawEnableAddOn: enabling", ...)
204 return self.hooks.EnableAddOn(...) 216 return self.hooks.EnableAddOn(...)
205 end 217 end
206 218
207 219
208 function Core:RawLoadAddOn(...) 220 function Core:RawLoadAddOn(...)