Fix an error in gui/workflow when enabling, and tweak color.

develop
Alexander Gavrilov 2012-10-26 11:52:41 +04:00
parent 1b9d11090f
commit e23052a570
2 changed files with 15 additions and 11 deletions

@ -14,6 +14,9 @@ DFHack future
- gui/guide-path: displays the cached path for minecart Guide orders.
- gui/workshop-job: displays inputs of a workshop job and allows tweaking them.
- gui/workflow: a front-end for the workflow plugin.
Workflow plugin:
- properly considers minecarts assigned to routes busy.
- code for deducing job outputs rewritten in lua for flexibility.
DFHack v0.34.11-r2

@ -9,26 +9,26 @@ local dlg = require 'gui.dialogs'
local workflow = require 'plugins.workflow'
function check_enabled(cb,...)
function check_enabled(cb)
if workflow.isEnabled() then
return cb(...)
return cb()
else
dlg.showYesNoPrompt(
'Enable Plugin',
{ 'The workflow plugin is not enabled currently.', NEWLINE, NEWLINE
{ 'The workflow plugin is not enabled currently.', NEWLINE, NEWLINE,
'Press ', { key = 'MENU_CONFIRM' }, ' to enable it.' },
COLOR_YELLOW,
curry(function(...)
function()
workflow.setEnabled(true)
return cb(...)
end,...)
return cb()
end
)
end
end
function check_repeat(job, cb)
if job.flags['repeat'] then
return cb(job)
return cb()
else
dlg.showYesNoPrompt(
'Not Repeat Job',
@ -37,7 +37,7 @@ function check_repeat(job, cb)
COLOR_YELLOW,
function()
job.flags['repeat'] = true
return cb(job)
return cb()
end
)
end
@ -188,7 +188,7 @@ function JobConstraints:initListChoices(clist, sel_token)
if cons.request == 'resume' then
order_pen = COLOR_GREEN
elseif cons.request == 'suspend' then
order_pen = COLOR_RED
order_pen = COLOR_BLUE
end
local itemstr = describe_item_type(cons)
if cons.min_quality > 0 then
@ -343,9 +343,10 @@ if not string.match(dfhack.gui.getCurFocus(), '^dwarfmode/QueryBuilding/Some/Wor
qerror("This script requires a workshop job selected in the 'q' mode")
end
check_enabled(function()
local job = dfhack.gui.getSelectedJob()
check_repeat(job, function(job)
check_enabled(function()
check_repeat(job, function()
local clist = workflow.listConstraints(job)
if not clist then
dlg.showMessage('Not Supported', 'This type of job is not supported by workflow.', COLOR_LIGHTRED)