Am Dienstag, 6. Oktober 2015, 19:24:31 schrieb Tobias Ellinghaus: > Am Dienstag, 6. Oktober 2015, 17:29:54 schrieb Tobias Ellinghaus:
So much self referencing. So wow. Very mail. > > Am Dienstag, 6. Oktober 2015, 07:16:04 schrieb darkta...@911networks.com: [...] > > > Easy for people with experience in Lua. Do you have some sample for > > > newbie like me? > > > > No sample, sorry. The general idea would be to register a new export > > storage and just output the list of images while not actually exporting > > anything. I will try to write some sample code later. As promised here are the three versions. The first two will only work in builds from git master, the last should also work in stable releases (1.6.8 at the moment). I don't have a build of that handy so I can't test, so there might be problems though. [...] Tobias
local dt = require "darktable" -- common helper function local function write_list(images, filename) local f = io.open(filename, "w") if not f then dt.print("error writing to `"..filename.."'") else for _, i in ipairs(images) do f:write(i.path.."/"..i.filename.."\n") end f:close() dt.print("list of selected images written to `"..filename.."'") end end -- VERSION 0 -- have a new lib that allows setting the filename -- TODO: remember the last selected path in config local target = dt.new_widget("entry"){placeholder = "/path/to/file"} dt.register_lib( "export_image_list", -- plugin name "export image list", -- name true, -- expandable false, -- resetable {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}, -- containers dt.new_widget("box") -- widget { orientation = "vertical", dt.new_widget("box") { orientation = "horizontal", dt.new_widget("label"){label = "destination", selectable = false}, -- GtkFileChooserButton doesn't support saving (i.e., selecting a file that isn't there yet) target }, dt.new_widget("button") { label = "export", clicked_callback = function (_) if target.text then write_list(dt.gui.action_images, target.text) end end } }, nil,-- view_enter nil -- view_leave ) -- VERSION 1 -- add the button to the selected images module dt.gui.libs.image.register_action( "export list", function(event, images) write_list(images, "/tmp/selected_images") end, "export a list of selected images to /tmp/selected_images.txt" ) -- VERSION 2 -- add a keyboard shortcut dt.register_event( "shortcut", function(event, shortcut) write_list(dt.gui.action_images, "/tmp/selected_images") end, "export list of selected images" )
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------
_______________________________________________ Darktable-users mailing list Darktable-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/darktable-users