Mercurial > wow > ouroloot
changeset 149:df0ca8ed1aff
Be smarter when joining a raid. Add some more flow-control debug printing.
Given (A) joining a raid, which triggers a delayed addon load, and seeing the
"what to do next" popup, and (B) restoring previous data which contains only
a raid roster or generated text, fix the interaction in which the activation
from (B) overrides the user's choice in (A)'s popup.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Thu, 08 Jan 2015 15:22:27 -0500 |
parents | 113dd7c86222 |
children | 63bda09d88fe |
files | core.lua gui.lua |
diffstat | 2 files changed, 25 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/core.lua Wed Jan 07 17:37:43 2015 -0500 +++ b/core.lua Thu Jan 08 15:22:27 2015 -0500 @@ -1469,8 +1469,7 @@ -- event registration from onload, joined a raid, maybe show popup self.dprint('flow', "RRU check:", self.popped, opts.popup_on_join) if (not self.popped) and opts.popup_on_join then - self.popped = StaticPopup_Show "OUROL_REMIND" - self.popped.data = self + self.popped = StaticPopup_Show("OUROL_REMIND",nil,nil,self) return end elseif event == "Activate" then @@ -1882,9 +1881,9 @@ elseif cmd:find("^thre") then self:SetThreshold(arg) - elseif cmd == "on" then self:Activate(arg) + elseif cmd == "on" then self:Activate("cmdon",arg) elseif cmd == "off" then self:Deactivate() - elseif cmd == "broadcast" or cmd == "bcast" then self:Activate(nil,true) + elseif cmd == "broadcast" or cmd == "bcast" then self:Activate("cmdbcast",nil,true) elseif cmd == "toggle" then if self.display then @@ -1972,8 +1971,8 @@ ------ On/off -- Both of these need to be (effectively) idempotent. -function addon:Activate (opt_threshold, opt_bcast_only) - self.dprint('flow', ":Activate is running") +function addon:Activate (whence, opt_threshold, opt_bcast_only) + self.dprint('flow', ":Activate called from", whence) self:RegisterEvent("GROUP_ROSTER_UPDATE") self:RegisterEvent("PLAYER_ENTERING_WORLD", function() self:ScheduleTimer("GROUP_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end) @@ -2021,6 +2020,7 @@ self.enabled and "tracking" or "only broadcasting", self.thresholds[self.threshold]) self:broadcast('revcheck',version_large) + self.dprint('flow', ":Activate from", whence, "finished") end -- Note: running '/ouroloot off' will also avoid the popup reminder when @@ -2409,9 +2409,12 @@ end self.DO_ITEMID_FIX = dofix or nil _do_loot_metas() - self:ScheduleTimer("Activate", 12, opts.threshold) -- FIXME printed could be too large if entries were deleted, how much do we care? self.sharder = opts.autoshard + if self.popped then + -- Actual loot got restored, potentially re-activate. + self:ScheduleTimer("Activate", 12, "_init-restore", opts.threshold) + end else g_loot = {} end @@ -4001,7 +4004,7 @@ local bcast_on = addon.format_hypertext ([[the red pill]], '|cffff4040', function (self) if not self.rebroadcast then - self:Activate(nil,true) + self:Activate("bcast-respond",nil,true) end self:broadcast('bcast_responder') end)
--- a/gui.lua Wed Jan 07 17:37:43 2015 -0500 +++ b/gui.lua Thu Jan 08 15:22:27 2015 -0500 @@ -2194,8 +2194,8 @@ b:SetList{"Full Tracking", "Broadcasting", "Disabled"} b:SetValue(self.enabled and 1 or (self.rebroadcast and 2 or 3)) b:SetCallback("OnValueChanged", function(_w,event,choice) - if choice == 1 then self:Activate() - elseif choice == 2 then self:Activate(nil,true) + if choice == 1 then self:Activate("dropdown") + elseif choice == 2 then self:Activate("dropdownbc",nil,true) else self:Deactivate() end _w = display:GetUserData('comm_ident') @@ -2578,13 +2578,18 @@ button2 = "Broadcast Only", -- "cancel", middle button3 = HELP_LABEL, -- "alt", right OnAccept = function (dialog, addon) - addon:Activate() + pprint('remind', "OnAccept") + addon:Activate("remind") end, noCancelOnEscape = true, + noCancelOnReuse = true, + closeButton = true, OnCancel = function (dialog, addon) - addon:Activate(nil,true) + pprint('remind', "OnCancel") + addon:Activate("remindbc",nil,true) end, OnAlt = function (dialog, addon) + pprint('remind', "OnAlt") -- hitting escape also calls this, but the 3rd arg would be "clicked" -- in both cases, not useful here. if MouseIsOver(dialog.button3) then @@ -2595,6 +2600,11 @@ addon.popped = true end end, + --@debug@ + OnHide = function (dialog, addon) + pprint('remind', "OnHide") + end, + --@end-debug@ } -- Callback for each Next/Accept stage of inserting a new loot or boss row via