refactoring
This commit is contained in:
+2
-2
@@ -4,13 +4,13 @@ aux 'post_tab' local scan, scan_util, post, history, info, persistence, item_lis
|
||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
|
||||
function property.default_settings.get()
|
||||
function default_settings.get()
|
||||
return -object('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
end
|
||||
|
||||
do
|
||||
local data
|
||||
function property.data.get()
|
||||
function data.get()
|
||||
if not data then
|
||||
local dataset = persistence.dataset
|
||||
data = dataset.post or t
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ function create_frames()
|
||||
if arg1 == 'LeftButton' then
|
||||
set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
set_tab(1)
|
||||
tab = 1
|
||||
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name)..'/exact')
|
||||
search_tab.execute(nil, false)
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ RESULTS, SAVED, FILTER = 1, 2, 3
|
||||
|
||||
function LOAD()
|
||||
create_frames()
|
||||
set_subtab(SAVED)
|
||||
subtab = SAVED
|
||||
update_auto_buy_filter()
|
||||
new_search ''
|
||||
current_search.placeholder = true
|
||||
@@ -78,8 +78,7 @@ function USE_ITEM(item_info)
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function set_subtab(tab)
|
||||
|
||||
function subtab.set(tab)
|
||||
search_results_button:UnlockHighlight()
|
||||
saved_searches_button:UnlockHighlight()
|
||||
new_filter_button:UnlockHighlight()
|
||||
|
||||
@@ -247,7 +247,7 @@ function create_frames()
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText 'Search Results'
|
||||
btn:SetScript('OnClick', function() set_subtab(RESULTS) end)
|
||||
btn:SetScript('OnClick', function() subtab = RESULTS end)
|
||||
search_results_button = btn
|
||||
end
|
||||
do
|
||||
@@ -256,7 +256,7 @@ function create_frames()
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText 'Saved Searches'
|
||||
btn:SetScript('OnClick', function() set_subtab(SAVED) end)
|
||||
btn:SetScript('OnClick', function() subtab = SAVED end)
|
||||
saved_searches_button = btn
|
||||
end
|
||||
do
|
||||
@@ -265,7 +265,7 @@ function create_frames()
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText 'Filter Builder'
|
||||
btn:SetScript('OnClick', function() set_subtab(FILTER) end)
|
||||
btn:SetScript('OnClick', function() subtab = FILTER end)
|
||||
new_filter_button = btn
|
||||
end
|
||||
do
|
||||
|
||||
@@ -80,13 +80,13 @@ do
|
||||
function previous_search()
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index - 1)
|
||||
set_subtab(RESULTS)
|
||||
subtab = RESULTS
|
||||
end
|
||||
|
||||
function next_search()
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index + 1)
|
||||
set_subtab(RESULTS)
|
||||
subtab = RESULTS
|
||||
end
|
||||
end
|
||||
|
||||
@@ -281,7 +281,7 @@ function start_search(queries, continuation)
|
||||
search.status_bar:set_text 'Scan complete'
|
||||
|
||||
if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then
|
||||
set_subtab(SAVED)
|
||||
subtab = SAVED
|
||||
end
|
||||
|
||||
search.active = false
|
||||
@@ -362,7 +362,7 @@ function public.execute(resume, real_time)
|
||||
current_search.active = true
|
||||
update_start_stop()
|
||||
|
||||
set_subtab(RESULTS)
|
||||
subtab = RESULTS
|
||||
if real_time then
|
||||
start_real_time_scan(queries[1], nil, continuation)
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user