From ef0a85724a219f36f69a59e877bdc2d40af7ffd2 Mon Sep 17 00:00:00 2001 From: unboundlopez <47876628+unboundlopez@users.noreply.github.com> Date: Sun, 13 Oct 2024 13:37:14 -0500 Subject: [PATCH 1/4] Update stockpiles.lua Added functionality to import export on the stockpile menu. --- plugins/lua/stockpiles.lua | 279 ++++++++++++++++++++----------------- 1 file changed, 155 insertions(+), 124 deletions(-) diff --git a/plugins/lua/stockpiles.lua b/plugins/lua/stockpiles.lua index c54cf6f7c9..a5fc5ccb20 100644 --- a/plugins/lua/stockpiles.lua +++ b/plugins/lua/stockpiles.lua @@ -5,6 +5,7 @@ local gui = require('gui') local logistics = require('plugins.logistics') local overlay = require('plugins.overlay') local widgets = require('gui.widgets') +local dialogs = require('gui.dialogs') local STOCKPILES_DIR = 'dfhack-config/stockpiles' local STOCKPILES_LIBRARY_DIR = 'hack/data/stockpiles' @@ -244,55 +245,64 @@ end -- dialogs -------------------- -StockpilesExport = defclass(StockpilesExport, widgets.Window) -StockpilesExport.ATTRS{frame_title='Export stockpile settings', frame={w=33, h=15}, resizable=true} - -function StockpilesExport:init() - self:addviews{ - widgets.EditField{ - view_id='edit', - frame={t=0, l=0, r=0}, - label_text='name: ', - on_char=function(ch) - return not ch:match(BAD_FILENAME_REGEX) - end, - }, widgets.Label{frame={t=2, l=0}, text='Include which elements?'}, - widgets.ToggleHotkeyLabel{frame={t=4, l=0}, label='General settings', initial_option=false}, - widgets.ToggleHotkeyLabel{ - frame={t=5, l=0}, - label='Container settings', - initial_option=false, - }, widgets.ToggleHotkeyLabel{frame={t=6, l=0}, label='Categories', initial_option=true}, - widgets.ToggleHotkeyLabel{frame={t=7, l=0}, label='Subtypes', initial_option=true}, - widgets.HotkeyLabel{ - frame={t=10, l=0}, - label='export', - key='SELECT', - enabled=function() - return #self.subviews.edit.text > 0 - end, - on_activate=self:callback('on_submit'), - }, - } -end - -function StockpilesExport:on_submit(text) - self:dismiss() -end - -StockpilesExportScreen = defclass(StockpilesExportScreen, gui.ZScreenModal) -StockpilesExportScreen.ATTRS{focus_path='stockpiles/export'} +-------------------- +-- dialogs export +-------------------- -function StockpilesExportScreen:init() - self:addviews{StockpilesExport{}} +function ExportOverlay() + dialogs.InputBox{ + frame_title='Export Manager Stockpiles', + on_input=function(text) + -- Print debug message to verify the function is being called + dfhack.println("User input received: " .. text) + + -- Introduce a short delay (e.g., 500 ms) to ensure stockpile is selected + dfhack.timeout(2, 'frames', function() + -- Test run the user-provided export name after the delay + dfhack.run_command('stockpiles', 'export', text) + end) + end + }:show() end -function StockpilesExportScreen:onDismiss() - export_view = nil -end +-------------------- +-- dialogs import +-------------------- -local function do_export() - export_view = export_view and export_view:raise() or StockpilesExportScreen{}:show() +local function get_import_choices() + return dfhack.run_command_silent('stockpiles', 'list'):split('\n') +end + +local function ImportOverlay() + local dlg + local function get_dlg() return dlg end + dlg = dialogs.ListBox{ + frame_title='Import/Delete Stockpiles', + with_filter=true, + choices=get_import_choices(), + on_select=function(_, choice) + dfhack.timeout(2, 'frames', function() -- Add the timeout before running the command + dfhack.run_command('stockpiles', 'import', choice.text) + end) + end, + dismiss_on_select2=false, + on_select2=function(_, choice) + if choice.text:startswith('library/') then return end + local fname = 'dfhack-config/stockpiles/'..choice.text..'.dfstock' + if not dfhack.filesystem.isfile(fname) then return end + dialogs.showYesNoPrompt('Delete stockpile file?', + 'Are you sure you want to delete "' .. fname .. '"?', nil, + function() + print('deleting ' .. fname) + os.remove(fname) + local list = get_dlg().subviews.list + local filter = list:getFilter() + list:setChoices(get_import_choices(), list:getSelected()) + list:setFilter(filter) + end) + end, + select2_hint='Delete file', + }:show() end -------------------- @@ -431,7 +441,7 @@ StockpilesOverlay.ATTRS{ default_pos={x=5, y=44}, default_enabled=true, viewscreens='dwarfmode/Stockpile/Some/Default', - frame={w=49, h=5}, + frame={w=49, h=8}, } function StockpilesOverlay:init() @@ -442,87 +452,99 @@ function StockpilesOverlay:init() end local main_panel = widgets.Panel{ - view_id='main', - frame_style=gui.MEDIUM_FRAME, - frame_background=gui.CLEAR_PEN, - visible=is_expanded, - subviews={ - -- widgets.HotkeyLabel{ - -- frame={t=0, l=0}, - -- label='import settings', - -- auto_width=true, - -- key='CUSTOM_CTRL_I', - -- on_activate=do_import, - -- }, widgets.HotkeyLabel{ - -- frame={t=1, l=0}, - -- label='export settings', - -- auto_width=true, - -- key='CUSTOM_CTRL_E', - -- on_activate=do_export, - -- }, - widgets.Panel{ - frame={t=0, l=0}, - subviews={ - widgets.Label{ - frame={t=0, l=0, h=1}, - auto_height=false, - text={'Auto-designate stockpile items/animals for:'}, - text_pen=COLOR_DARKGREY, - }, widgets.ToggleHotkeyLabel{ - view_id='melt', - frame={t=1, l=0}, - auto_width=true, - key='CUSTOM_CTRL_M', - option_gap=-1, - options={{label='Melting', value=true, pen=COLOR_RED}, - {label='Melting', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'melt'), - }, widgets.ToggleHotkeyLabel{ - view_id='trade', - frame={t=1, l=16}, - auto_width=true, - key='CUSTOM_CTRL_T', - option_gap=-1, - options={{label='Trading', value=true, pen=COLOR_YELLOW}, - {label='Trading', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'trade'), - }, widgets.ToggleHotkeyLabel{ - view_id='dump', - frame={t=2, l=0}, - auto_width=true, - key='CUSTOM_CTRL_U', - option_gap=-1, - options={{label='Dumping', value=true, pen=COLOR_LIGHTMAGENTA}, - {label='Dumping', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'dump'), - }, widgets.ToggleHotkeyLabel{ - view_id='train', - frame={t=1, l=32}, - auto_width=true, - key='CUSTOM_CTRL_A', - option_gap=-1, - options={{label='Training', value=true, pen=COLOR_LIGHTBLUE}, - {label='Training', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'train'), - }, widgets.CycleHotkeyLabel{ - view_id='forbid', - frame={t=2, l=16, w=16}, - key='CUSTOM_CTRL_F', - option_gap=-1, - options={{label='Forbid', value=0}, - {label='Forbid', value=1, pen=COLOR_LIGHTRED}, - {label='Claim', value=2, pen=COLOR_LIGHTBLUE}}, - initial_option=0, - on_change=self:callback('toggleLogisticsFeature', 'forbid'), - }, + view_id='main', + frame_style=gui.MEDIUM_FRAME, + frame_background=gui.CLEAR_PEN, + visible=is_expanded, + subviews={ + widgets.Label{ + frame={t=0, l=0, h=1}, + auto_height=false, + text={'Import/Export settings:'}, + text_pen=COLOR_DARKGREY, + }, + widgets.HotkeyLabel{ + frame={t=1, l=0}, + label='import', + auto_width=true, + key='CUSTOM_CTRL_I', + on_activate=self:callback('do_import'), -- Calls the do_import function + }, + widgets.HotkeyLabel{ + frame={t=1, l=16}, + label='export', + auto_width=true, + key='CUSTOM_CTRL_E', + on_activate=self:callback('do_export'), -- Calls the do_export function + }, + widgets.Panel{ + frame={t=2, l=0}, -- Start this panel below the import/export labels to avoid overlap + subviews={ + widgets.Label{ + frame={t=0, l=0, h=1}, + auto_height=false, + text={'Auto-designate stockpile items/animals for:'}, + text_pen=COLOR_DARKGREY, + }, + widgets.ToggleHotkeyLabel{ + view_id='melt', + frame={t=1, l=0}, + auto_width=true, + key='CUSTOM_CTRL_M', + option_gap=-1, + options={{label='Melting', value=true, pen=COLOR_RED}, + {label='Melting', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'melt'), + }, + widgets.ToggleHotkeyLabel{ + view_id='trade', + frame={t=1, l=16}, + auto_width=true, + key='CUSTOM_CTRL_T', + option_gap=-1, + options={{label='Trading', value=true, pen=COLOR_YELLOW}, + {label='Trading', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'trade'), + }, + widgets.ToggleHotkeyLabel{ + view_id='dump', + frame={t=2, l=0}, + auto_width=true, + key='CUSTOM_CTRL_U', + option_gap=-1, + options={{label='Dumping', value=true, pen=COLOR_LIGHTMAGENTA}, + {label='Dumping', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'dump'), + }, + widgets.ToggleHotkeyLabel{ + view_id='train', + frame={t=1, l=32}, + auto_width=true, + key='CUSTOM_CTRL_A', + option_gap=-1, + options={{label='Training', value=true, pen=COLOR_LIGHTBLUE}, + {label='Training', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'train'), + }, + widgets.CycleHotkeyLabel{ + view_id='forbid', + frame={t=2, l=16, w=16}, + key='CUSTOM_CTRL_F', + option_gap=-1, + options={{label='Forbid', value=0}, + {label='Forbid', value=1, pen=COLOR_LIGHTRED}, + {label='Claim', value=2, pen=COLOR_LIGHTBLUE}}, + initial_option=0, + on_change=self:callback('toggleLogisticsFeature', 'forbid'), }, }, }, - } + }, +} self:addviews{ main_panel, @@ -561,6 +583,15 @@ function StockpilesOverlay:onRenderFrame() end end +function StockpilesOverlay:do_export() +ExportOverlay() + +end + +function StockpilesOverlay:do_import() +ImportOverlay() +end + function StockpilesOverlay:toggleLogisticsFeature(feature) self.cur_stockpile = nil local sp = dfhack.gui.getSelectedStockpile(true) From 89301be76fa5ba88847aa95b4a6c85a10a463a40 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 18:54:57 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- plugins/lua/stockpiles.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/lua/stockpiles.lua b/plugins/lua/stockpiles.lua index a5fc5ccb20..7acfae3ce2 100644 --- a/plugins/lua/stockpiles.lua +++ b/plugins/lua/stockpiles.lua @@ -457,19 +457,19 @@ function StockpilesOverlay:init() frame_background=gui.CLEAR_PEN, visible=is_expanded, subviews={ - widgets.Label{ + widgets.Label{ frame={t=0, l=0, h=1}, auto_height=false, text={'Import/Export settings:'}, text_pen=COLOR_DARKGREY, - }, + }, widgets.HotkeyLabel{ frame={t=1, l=0}, label='import', auto_width=true, key='CUSTOM_CTRL_I', on_activate=self:callback('do_import'), -- Calls the do_import function - }, + }, widgets.HotkeyLabel{ frame={t=1, l=16}, label='export', @@ -485,7 +485,7 @@ function StockpilesOverlay:init() auto_height=false, text={'Auto-designate stockpile items/animals for:'}, text_pen=COLOR_DARKGREY, - }, + }, widgets.ToggleHotkeyLabel{ view_id='melt', frame={t=1, l=0}, @@ -496,7 +496,7 @@ function StockpilesOverlay:init() {label='Melting', value=false}}, initial_option=false, on_change=self:callback('toggleLogisticsFeature', 'melt'), - }, + }, widgets.ToggleHotkeyLabel{ view_id='trade', frame={t=1, l=16}, @@ -507,7 +507,7 @@ function StockpilesOverlay:init() {label='Trading', value=false}}, initial_option=false, on_change=self:callback('toggleLogisticsFeature', 'trade'), - }, + }, widgets.ToggleHotkeyLabel{ view_id='dump', frame={t=2, l=0}, @@ -518,7 +518,7 @@ function StockpilesOverlay:init() {label='Dumping', value=false}}, initial_option=false, on_change=self:callback('toggleLogisticsFeature', 'dump'), - }, + }, widgets.ToggleHotkeyLabel{ view_id='train', frame={t=1, l=32}, @@ -529,7 +529,7 @@ function StockpilesOverlay:init() {label='Training', value=false}}, initial_option=false, on_change=self:callback('toggleLogisticsFeature', 'train'), - }, + }, widgets.CycleHotkeyLabel{ view_id='forbid', frame={t=2, l=16, w=16}, From cd276e9b5b3782ad4c1a4acb7fb06511e7deec69 Mon Sep 17 00:00:00 2001 From: Myk Date: Wed, 25 Dec 2024 23:07:16 -0800 Subject: [PATCH 3/4] fix up and format code --- plugins/lua/stockpiles.lua | 253 ++++++++++++++++--------------------- 1 file changed, 109 insertions(+), 144 deletions(-) diff --git a/plugins/lua/stockpiles.lua b/plugins/lua/stockpiles.lua index 7acfae3ce2..ac48ed6fc9 100644 --- a/plugins/lua/stockpiles.lua +++ b/plugins/lua/stockpiles.lua @@ -1,11 +1,11 @@ local _ENV = mkmodule('plugins.stockpiles') local argparse = require('argparse') +local dialogs = require('gui.dialogs') local gui = require('gui') local logistics = require('plugins.logistics') local overlay = require('plugins.overlay') local widgets = require('gui.widgets') -local dialogs = require('gui.dialogs') local STOCKPILES_DIR = 'dfhack-config/stockpiles' local STOCKPILES_LIBRARY_DIR = 'hack/data/stockpiles' @@ -35,7 +35,7 @@ local function print_status() end end -local function list_dir(path, prefix, filters) +local function list_dir(path, prefix, filters, cb) local paths = dfhack.filesystem.listdir_recursive(path, 0, false) if not paths then dfhack.printerr(('Cannot find stockpile settings directory: "%s"'):format(path)) @@ -57,14 +57,15 @@ local function list_dir(path, prefix, filters) end if not matched then goto continue end end - print(('%s%s'):format(prefix, v.path:sub(1, -9))) + cb(('%s%s'):format(prefix, v.path:sub(1, -9))) ::continue:: end end -local function list_settings_files(filters) - list_dir(STOCKPILES_DIR, '', filters) - list_dir(STOCKPILES_LIBRARY_DIR, 'library/', filters) +local function list_settings_files(filters, cb) + cb = cb or print + list_dir(STOCKPILES_DIR, '', filters, cb) + list_dir(STOCKPILES_LIBRARY_DIR, 'library/', filters, cb) end local function assert_safe_name(name) @@ -241,56 +242,31 @@ function parse_commandline(args) return true end --------------------- --- dialogs --------------------- - --------------------- --- dialogs export --------------------- - -function ExportOverlay() - dialogs.InputBox{ - frame_title='Export Manager Stockpiles', - on_input=function(text) - -- Print debug message to verify the function is being called - dfhack.println("User input received: " .. text) - - -- Introduce a short delay (e.g., 500 ms) to ensure stockpile is selected - dfhack.timeout(2, 'frames', function() - -- Test run the user-provided export name after the delay - dfhack.run_command('stockpiles', 'export', text) - end) - end - }:show() -end - --------------------- --- dialogs import --------------------- +------------------------- +-- import/export dialogs +------------------------- local function get_import_choices() - return dfhack.run_command_silent('stockpiles', 'list'):split('\n') + local filenames = {} + list_settings_files({}, function(fname) table.insert(filenames, fname) end) + return filenames end -local function ImportOverlay() +local function do_import() + local sp = dfhack.gui.getSelectedStockpile(true) local dlg local function get_dlg() return dlg end dlg = dialogs.ListBox{ - frame_title='Import/Delete Stockpiles', + frame_title='Import/Delete Stockpile Settings', with_filter=true, choices=get_import_choices(), - on_select=function(_, choice) - dfhack.timeout(2, 'frames', function() -- Add the timeout before running the command - dfhack.run_command('stockpiles', 'import', choice.text) - end) - end, + on_select=function(_, choice) import_settings(choice.text, {id=sp and sp.id}) end, dismiss_on_select2=false, on_select2=function(_, choice) if choice.text:startswith('library/') then return end - local fname = 'dfhack-config/stockpiles/'..choice.text..'.dfstock' + local fname = ('%s/%s.dfstock'):format(STOCKPILES_DIR, choice.text) if not dfhack.filesystem.isfile(fname) then return end - dialogs.showYesNoPrompt('Delete stockpile file?', + dialogs.showYesNoPrompt('Delete saved stockpile settings file?', 'Are you sure you want to delete "' .. fname .. '"?', nil, function() print('deleting ' .. fname) @@ -305,6 +281,15 @@ local function ImportOverlay() }:show() end +local function do_export() + local sp = dfhack.gui.getSelectedStockpile(true) + dialogs.InputBox{ + frame_title='Export Stockpile Settings', + text='Please enter a filename', + on_input=function(text) export_settings(text, {id=sp and sp.id}) end, + }:show() +end + -------------------- -- ConfigModal -------------------- @@ -438,10 +423,11 @@ end StockpilesOverlay = defclass(StockpilesOverlay, overlay.OverlayWidget) StockpilesOverlay.ATTRS{ desc='Shows a panel when a stockpile is selected for stockpile automation.', - default_pos={x=5, y=44}, + default_pos={x=5, y=43}, default_enabled=true, + version=2, viewscreens='dwarfmode/Stockpile/Some/Default', - frame={w=49, h=8}, + frame={w=49, h=6}, } function StockpilesOverlay:init() @@ -452,99 +438,87 @@ function StockpilesOverlay:init() end local main_panel = widgets.Panel{ - view_id='main', - frame_style=gui.MEDIUM_FRAME, - frame_background=gui.CLEAR_PEN, - visible=is_expanded, - subviews={ - widgets.Label{ - frame={t=0, l=0, h=1}, - auto_height=false, - text={'Import/Export settings:'}, - text_pen=COLOR_DARKGREY, - }, - widgets.HotkeyLabel{ - frame={t=1, l=0}, - label='import', - auto_width=true, - key='CUSTOM_CTRL_I', - on_activate=self:callback('do_import'), -- Calls the do_import function - }, - widgets.HotkeyLabel{ - frame={t=1, l=16}, - label='export', - auto_width=true, - key='CUSTOM_CTRL_E', - on_activate=self:callback('do_export'), -- Calls the do_export function - }, - widgets.Panel{ - frame={t=2, l=0}, -- Start this panel below the import/export labels to avoid overlap - subviews={ - widgets.Label{ - frame={t=0, l=0, h=1}, - auto_height=false, - text={'Auto-designate stockpile items/animals for:'}, - text_pen=COLOR_DARKGREY, - }, - widgets.ToggleHotkeyLabel{ - view_id='melt', - frame={t=1, l=0}, - auto_width=true, - key='CUSTOM_CTRL_M', - option_gap=-1, - options={{label='Melting', value=true, pen=COLOR_RED}, - {label='Melting', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'melt'), - }, - widgets.ToggleHotkeyLabel{ - view_id='trade', - frame={t=1, l=16}, - auto_width=true, - key='CUSTOM_CTRL_T', - option_gap=-1, - options={{label='Trading', value=true, pen=COLOR_YELLOW}, - {label='Trading', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'trade'), - }, - widgets.ToggleHotkeyLabel{ - view_id='dump', - frame={t=2, l=0}, - auto_width=true, - key='CUSTOM_CTRL_U', - option_gap=-1, - options={{label='Dumping', value=true, pen=COLOR_LIGHTMAGENTA}, - {label='Dumping', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'dump'), - }, - widgets.ToggleHotkeyLabel{ - view_id='train', - frame={t=1, l=32}, - auto_width=true, - key='CUSTOM_CTRL_A', - option_gap=-1, - options={{label='Training', value=true, pen=COLOR_LIGHTBLUE}, - {label='Training', value=false}}, - initial_option=false, - on_change=self:callback('toggleLogisticsFeature', 'train'), - }, - widgets.CycleHotkeyLabel{ - view_id='forbid', - frame={t=2, l=16, w=16}, - key='CUSTOM_CTRL_F', - option_gap=-1, - options={{label='Forbid', value=0}, - {label='Forbid', value=1, pen=COLOR_LIGHTRED}, - {label='Claim', value=2, pen=COLOR_LIGHTBLUE}}, - initial_option=0, - on_change=self:callback('toggleLogisticsFeature', 'forbid'), + view_id='main', + frame_style=gui.MEDIUM_FRAME, + frame_background=gui.CLEAR_PEN, + visible=is_expanded, + subviews={ + widgets.HotkeyLabel{ + frame={t=0, l=0}, + label='import', + auto_width=true, + key='CUSTOM_CTRL_I', + on_activate=do_import, + }, widgets.HotkeyLabel{ + frame={t=0, l=16}, + label='export', + auto_width=true, + key='CUSTOM_CTRL_E', + on_activate=do_export, + }, + widgets.Panel{ + frame={t=1, l=0}, + subviews={ + widgets.Label{ + frame={t=0, l=0, h=1}, + auto_height=false, + text={'Auto-designate stockpile items/animals for:'}, + text_pen=COLOR_DARKGREY, + }, widgets.ToggleHotkeyLabel{ + view_id='melt', + frame={t=1, l=0}, + auto_width=true, + key='CUSTOM_CTRL_M', + option_gap=-1, + options={{label='Melting', value=true, pen=COLOR_RED}, + {label='Melting', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'melt'), + }, widgets.ToggleHotkeyLabel{ + view_id='trade', + frame={t=1, l=16}, + auto_width=true, + key='CUSTOM_CTRL_T', + option_gap=-1, + options={{label='Trading', value=true, pen=COLOR_YELLOW}, + {label='Trading', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'trade'), + }, widgets.ToggleHotkeyLabel{ + view_id='dump', + frame={t=2, l=0}, + auto_width=true, + key='CUSTOM_CTRL_U', + option_gap=-1, + options={{label='Dumping', value=true, pen=COLOR_LIGHTMAGENTA}, + {label='Dumping', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'dump'), + }, widgets.ToggleHotkeyLabel{ + view_id='train', + frame={t=1, l=32}, + auto_width=true, + key='CUSTOM_CTRL_A', + option_gap=-1, + options={{label='Training', value=true, pen=COLOR_LIGHTBLUE}, + {label='Training', value=false}}, + initial_option=false, + on_change=self:callback('toggleLogisticsFeature', 'train'), + }, widgets.CycleHotkeyLabel{ + view_id='forbid', + frame={t=2, l=16, w=16}, + key='CUSTOM_CTRL_F', + option_gap=-1, + options={{label='Forbid', value=0}, + {label='Forbid', value=1, pen=COLOR_LIGHTRED}, + {label='Claim', value=2, pen=COLOR_LIGHTBLUE}}, + initial_option=0, + on_change=self:callback('toggleLogisticsFeature', 'forbid'), + }, }, }, }, - }, -} + } self:addviews{ main_panel, @@ -583,15 +557,6 @@ function StockpilesOverlay:onRenderFrame() end end -function StockpilesOverlay:do_export() -ExportOverlay() - -end - -function StockpilesOverlay:do_import() -ImportOverlay() -end - function StockpilesOverlay:toggleLogisticsFeature(feature) self.cur_stockpile = nil local sp = dfhack.gui.getSelectedStockpile(true) From d0b67f9f0e29c89328a6a1fb05ad5ee6426a02ef Mon Sep 17 00:00:00 2001 From: Myk Date: Wed, 25 Dec 2024 23:11:08 -0800 Subject: [PATCH 4/4] Update changelog --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 8f1cee1958..a1335786d4 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -64,6 +64,7 @@ Template for new versions: ## Misc Improvements - `strangemood`: add ability to choose Stone Cutting and Stone Carving as the mood skill - `stonesense`: changed announcements to be right-aligned and limited it to only show the most recent 10 announcements. +- `stockpiles`: add simple import/export dialogs to stockpile overlay panel ## Documentation