"Fossies" - the Fresh Open Source Software Archive

Member "darktable-3.6.1/tools/lua_doc/content.lua" (10 Sep 2021, 89281 Bytes) of package /linux/misc/darktable-3.6.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lua source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "content.lua": 3.2.1_vs_3.4.0.

    1 real_darktable = require "darktable"
    2 require "darktable.debug"
    3 local tmp_node
    4 
    5 local function sorted_pairs (t, f)
    6   local a = {}
    7   for n in pairs(t) do table.insert(a, n) end
    8   table.sort(a, f)
    9   local i = 0      -- iterator variable
   10   local iter = function ()   -- iterator function
   11     i = i + 1
   12     if a[i] == nil then return nil
   13     else return a[i], t[a[i]]
   14     end
   15   end
   16   return iter
   17 end
   18 
   19 
   20 ---------------------
   21 -- check for generator functions
   22 ---------------------
   23 for _,v in pairs({"node_to_string","para","startlist","listel","endlist","code","emphasis","url"})   do
   24     if _ENV[v]== nil then
   25         error("function '"..v.."' not defined when requiring content")
   26     end
   27 end
   28 ---------------------
   29 -- check for database content
   30 ---------------------
   31 if  #real_darktable.database == 0 then
   32     error("The database needs to contain at least one image to generate documentation")
   33 end
   34 if  #real_darktable.styles == 0 then
   35     error("The database needs to contain at least one style to generate documentation")
   36 end
   37 
   38 real_darktable.gui.libs.collect.filter({})
   39 
   40 doc = require "core"
   41 darktable = doc.toplevel.darktable
   42 types = doc.toplevel.types
   43 events = doc.toplevel.events
   44 attributes = doc.toplevel.attributes
   45 
   46 
   47 local function my_tostring(obj)
   48     if not obj then
   49         error("incorrect object")
   50     end
   51     return tostring(obj)
   52 end
   53 
   54 local function remove_all_children(node)
   55     for k, v in node:all_children() do
   56         v:remove_parent(node)
   57         node[k] = nil
   58     end
   59 end
   60 -- prevent some objects to appear at the wrong end of the tree
   61 remove_all_children(types.dt_lua_lib_t.views)
   62 
   63 ----------------------
   64 --  REANAMINGS      --
   65 ----------------------
   66 
   67 ----------------------
   68 --  TOPLEVEL        --
   69 ----------------------
   70 local prefix
   71 if real_darktable.configuration.api_version_suffix ~= "" then
   72   prefix = [[This documentation is for the *development* version of darktable. for the stable version, please visit the user manual]]..para()
   73 else
   74   prefix = ""
   75 end
   76 doc.toplevel:set_text(prefix..[[To access the darktable specific functions you must load the darktable environment:]]..
   77 code([[darktable = require "darktable"]])..
   78 [[All functions and data are accessed through the darktable module.]]..para()..
   79 [[This documentation for API version ]]..real_darktable.configuration.api_version_string..[[.]])
   80 ----------------------
   81 --  DARKTABLE       --
   82 ----------------------
   83 darktable:set_text([[The darktable library is the main entry point for all access to the darktable internals.]])
   84 darktable.print:set_text([[Will print a string to the darktable control log (the long overlaid window that appears over the main panel).]])
   85 darktable.print:add_parameter("message","string",[[The string to display which should be a single line.]])
   86 
   87 darktable.print_log:set_text([[This function will print its parameter if the Lua logdomain is activated. Start darktable with the "-d lua" command line option to enable the Lua logdomain.]])
   88 darktable.print_log:add_parameter("message","string",[[The string to display.]])
   89 darktable.print_error:set_text([[This function is similar to]]..my_tostring(darktable.print_log)..[[ but adds an ERROR prefix for clarity.]])
   90 darktable.print_error:add_parameter("message","string",[[The string to display.]])
   91 
   92 darktable.register_event:set_text([[This function registers a callback to be called when a given event happens.]]..para()..
   93 [[Events are documented ]]..node_to_string(events,[[in the event section.]]))
   94 darktable.register_event:add_parameter("event_type","string",[[The name of the event to register to.]])
   95 darktable.register_event:add_parameter("callback","function",[[The function to call on event. The signature of the function depends on the type of event.]])
   96 darktable.register_event:add_parameter("...","variable",[[Some events need extra parameters at registration time; these must be specified here.]])
   97 
   98 darktable.register_storage:set_text([[This function will add a new storage implemented in Lua.]]..para()..
   99 [[A storage is a module that is responsible for handling images once they have been generated during export. Examples of core storages include filesystem, e-mail, facebook...]])
  100 darktable.register_storage:add_parameter("plugin_name","string",[[A Unique name for the plugin.]])
  101 darktable.register_storage:add_parameter("name","string",[[A human readable name for the plugin.]])
  102 tmp_node = darktable.register_storage:add_parameter("store","function",[[This function is called once for each exported image. Images can be exported in parallel but the calls to this function will be serialized.]])
  103 tmp_node:set_attribute("optional",true)
  104 tmp_node:add_parameter("storage",types.dt_imageio_module_storage_t,[[The storage object used for the export.]])
  105 tmp_node:add_parameter("image",types.dt_lua_image_t,[[The exported image object.]])
  106 tmp_node:add_parameter("format",types.dt_imageio_module_format_t,[[The format object used for the export.]])
  107 tmp_node:add_parameter("filename","string",[[The name of a temporary file where the processed image is stored.]])
  108 tmp_node:add_parameter("number","integer",[[The number of the image out of the export series.]])
  109 tmp_node:add_parameter("total","integer",[[The total number of images in the export series.]])
  110 tmp_node:add_parameter("high_quality","boolean",[[True if the export is high quality.]])
  111 tmp_node:add_parameter("extra_data","table",[[An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export series.]])
  112 tmp_node = darktable.register_storage:add_parameter("finalize","function",[[This function is called once all images are processed and all store calls are finished.]])
  113 tmp_node:set_attribute("optional",true)
  114 tmp_node:add_parameter("storage",types.dt_imageio_module_storage_t,[[The storage object used for the export.]])
  115 tmp_node:add_parameter("image_table","table",[[A table keyed by the exported image objects and valued with the corresponding temporary export filename.]])
  116 tmp_node:add_parameter("extra_data","table",[[An empty Lua table to store extra data. This table is common to all calls to store and the call to finalize in a given export series.]])
  117 tmp_node = darktable.register_storage:add_parameter("supported","function",[[A function called to check if a given image format is supported by the Lua storage; this is used to build the dropdown format list for the GUI.]]..para()..
  118 [[Note that the parameters in the format are the ones currently set in the GUI; the user might change them before export.]])
  119 tmp_node:set_attribute("optional",true)
  120 tmp_node:add_parameter("storage",types.dt_imageio_module_storage_t,[[The storage object tested.]])
  121 tmp_node:add_parameter("format",types.dt_imageio_module_format_t,[[The format object to report about.]])
  122 tmp_node:add_return("boolean",[[True if the corresponding format is supported.]])
  123 tmp_node = darktable.register_storage:add_parameter("initialize","function",[[A function called before storage happens]]..para()..
  124 [[This function can change the list of exported functions]])
  125 tmp_node:set_attribute("optional",true)
  126 tmp_node:add_parameter("storage",types.dt_imageio_module_storage_t,[[The storage object tested.]])
  127 tmp_node:add_parameter("format",types.dt_imageio_module_format_t,[[The format object to report about.]])
  128 tmp_node:add_parameter("images","table of "..my_tostring(types.dt_lua_image_t),[[A table containing images to be exported.]])
  129 tmp_node:add_parameter("high_quality","boolean",[[True if the export is high quality.]])
  130 tmp_node:add_parameter("extra_data","table",[[An empty Lua table to take extra data. This table is common to the initialize, store and finalize calls in an export series.]])
  131 tmp_node:add_return("table or nil",[[The modified table of images to export or nil]]..para()..
  132 [[If nil (or nothing) is returned, the original list of images will be exported]]..para()..
  133 [[If a table of images is returned, that table will be used instead. The table can be empty. The images parameter can be modified and returned]])
  134 darktable.register_storage:add_parameter("widget",types.lua_widget,[[A widget to display in the export section of darktable's UI]]):set_attribute("optional",true)
  135 darktable.register_lib:set_text("Register a new lib object. A lib is a graphical element of darktable's user interface")
  136 darktable.register_lib:add_parameter("plugin_name","string","A unique name for your library")
  137 darktable.register_lib:add_parameter("name","string","A user-visible name for your library")
  138 darktable.register_lib:add_parameter("expandable","boolean","whether this lib should be expandable or not")
  139 darktable.register_lib:add_parameter("resettable","boolean","whether this lib has a reset button or not")
  140 darktable.register_lib:add_parameter("containers","table of "..my_tostring(types.dt_lua_view_t).." => [ "..my_tostring(types.dt_ui_container_t)..", int ]","A table associating to each view containing the lib the corresponding container and position")
  141 darktable.register_lib:add_parameter("widget",types.lua_widget,"The widget to display in the lib")
  142 tmp = darktable.register_lib:add_parameter("view_enter","function","A callback called when a view displaying the lib is entered")
  143 tmp:add_parameter("self",types.dt_lua_lib_t,"The lib on which the callback is called"):set_attribute("is_self",true)
  144 tmp:add_parameter("old_view",types.dt_lua_view_t,"The view that we are leaving")
  145 tmp:add_parameter("new_view",types.dt_lua_view_t,"The view that we are entering")
  146 tmp = darktable.register_lib:add_parameter("view_leave","function","A callback called when leaving a view displaying the lib")
  147 tmp:add_parameter("self",types.dt_lua_lib_t,"The lib on which the callback is called"):set_attribute("is_self",true)
  148 tmp:add_parameter("old_view",types.dt_lua_view_t,"The view that we are leaving")
  149 tmp:add_parameter("new_view",types.dt_lua_view_t,"The view that we are entering")
  150 
  151 
  152 
  153 darktable.films:set_text([[A table containing all the film objects in the database.]])
  154 darktable.films['#']:set_text([[Each film has a numeric entry in the database.]])
  155 darktable.films.new:set_text([[Creates a new empty film]]..para()..
  156 [[ see ]]..my_tostring(darktable.database.import)..[[ to import a directory with all its images and to add images to a film]])
  157 darktable.films.new:add_parameter("directory","string",[[The directory that the new film will represent. The directory must exist]])
  158 darktable.films.new:add_return(types.dt_lua_film_t,"The newly created film, or the existing film if the directory is already imported")
  159 
  160 darktable.new_format:set_text("Creates a new format object to export images")
  161 tmp =""
  162 for k,v in sorted_pairs(debug.getregistry().dt_lua_modules.format) do
  163   tmp = tmp..listel(k)
  164 end
  165 darktable.new_format:add_parameter("type","string",[[The type of format object to create, one of : ]]..  startlist().. tmp..endlist())
  166 darktable.new_format:add_return(types.dt_imageio_module_format_t,"The newly created object. Exact type depends on the type passed")
  167 
  168 darktable.new_storage:set_text("Creates a new storage object to export images")
  169 tmp =""
  170 for k,v in sorted_pairs(debug.getregistry().dt_lua_modules.storage) do
  171   tmp = tmp..listel(k)
  172 end
  173 darktable.new_storage:add_parameter("type","string",[[The type of storage object to create, one of : ]]..  startlist().. tmp..endlist().."(Other, lua-defined, storage types may appear.)")
  174 darktable.new_storage:add_return(types.dt_imageio_module_storage_t,"The newly created object. Exact type depends on the type passed")
  175 
  176 darktable.new_widget:set_text("Creates a new widget object to display in the UI")
  177 tmp =""
  178 for k,v in sorted_pairs(debug.getregistry().dt_lua_modules.widget) do
  179   tmp = tmp..listel(k)
  180 end
  181 darktable.new_widget:add_parameter("type","string",[[The type of storage object to create, one of : ]]..  startlist().. tmp..endlist())
  182 darktable.new_widget:add_parameter("...","variable",[[Extra parameters, exact value are documented with each type]])
  183 darktable.new_widget:add_return(types.lua_widget,"The newly created object. Exact type depends on the type passed")
  184 ----------------------
  185 --  DARKTABLE.GUI   --
  186 ----------------------
  187 darktable.gui:set_text([[This subtable contains function and data to manipulate the darktable user interface with Lua.]]..para()..
  188 [[Most of these function won't do anything if the GUI is not enabled (i.e you are using the command line version darktable-cli instead of darktable).]])
  189 
  190 darktable.gui.action_images:set_text([[A table of ]]..my_tostring(types.dt_lua_image_t)..[[ on which the user expects UI actions to happen.]]..para()..
  191 [[It is based on both the hovered image and the selection and is consistent with the way darktable works.]]..para()..
  192 [[It is recommended to use this table to implement Lua actions rather than ]]..my_tostring(darktable.gui.hovered)..[[ or ]]..my_tostring(darktable.gui.selection)..[[ to be consistent with darktable's GUI.]])
  193 
  194 remove_all_children(darktable.gui.action_images)
  195 
  196 darktable.gui.hovered:set_text([[The image under the cursor or nil if no image is hovered.]])
  197 darktable.gui.hovered:set_reported_type(types.dt_lua_image_t)
  198 darktable.gui.selection:set_text([[Allows to change the set of selected images.]])
  199 darktable.gui.selection:add_parameter("selection","table of "..my_tostring(types.dt_lua_image_t),[[A table of images which will define the selected images. If this parameter is not given the selection will be untouched. If an empty table is given the selection will be emptied.]]):set_attribute("optional",true)
  200 darktable.gui.selection:add_return("table of "..my_tostring(types.dt_lua_image_t),[[A table containing the selection as it was before the function was called.]])
  201 darktable.gui.selection:set_attribute("implicit_yield",true)
  202 darktable.gui.current_view:set_text([[Allows to change the current view.]])
  203 darktable.gui.current_view:add_parameter("view",types.dt_lua_view_t,[[The view to switch to. If empty the current view is unchanged]]):set_attribute("optional",true)
  204 darktable.gui.current_view:add_return(types.dt_lua_view_t,[[the current view]])
  205 darktable.gui.create_job:set_text([[Create a new progress_bar displayed in ]]..my_tostring(darktable.gui.libs.backgroundjobs))
  206 darktable.gui.create_job:add_parameter("text","string",[[The text to display in the job entry]])
  207 darktable.gui.create_job:add_parameter("percentage","boolean",[[Should a progress bar be displayed]]):set_attribute("optional",true)
  208 tmp = darktable.gui.create_job:add_parameter("cancel_callback","function",[[A function called when the cancel button for that job is pressed]]..para().."note that the job won't be destroyed automatically. You need to set "..my_tostring(types.dt_lua_backgroundjob_t.valid).." to false for that")
  209 tmp:set_attribute("optional",true)
  210 tmp:add_parameter("job",types.dt_lua_backgroundjob_t,[[The job who is being cancelled]])
  211 darktable.gui.create_job:add_return(types.dt_lua_backgroundjob_t,[[The newly created job object]])
  212 
  213 -------------------------
  214 --  DARKTABLE.GUIDES   --
  215 -------------------------
  216 darktable.guides:set_text([[Guide lines to overlay over an image in crop and rotate.]]..para()..[[All guides are clipped to the drawing area.]])
  217 darktable.guides.register_guide:set_text([[Register a new guide.]])
  218 darktable.guides.register_guide:add_parameter("name", "string", [[The name of the guide to show in the GUI.]])
  219 tmp_node = darktable.guides.register_guide:add_parameter("draw_callback", "function", [[The function to call to draw the guide lines. The drawn lines will be stroked by darktable.]]..para()..[[THIS IS RUNNING IN THE GUI THREAD AND HAS TO BE FAST!]])
  220 tmp_node:add_parameter("cr", types.dt_lua_cairo_t, [[The cairo object used for drawing.]])
  221 tmp_node:add_parameter("x", "float", [[The x coordinate of the top left corner of the drawing area.]])
  222 tmp_node:add_parameter("y", "float", [[The y coordinate of the top left corner of the drawing area.]])
  223 tmp_node:add_parameter("width", "float", [[The width of the drawing area.]])
  224 tmp_node:add_parameter("height", "float", [[The height of the drawing area.]])
  225 tmp_node:add_parameter("zoom_scale", "float", [[The current zoom_scale. Only needed when setting the line thickness.]])
  226 darktable.guides.register_guide:add_parameter("gui_callback", "function", [[A function returning a widget to show when the guide is selected. It takes no arguments.]]):set_attribute("optional",true)
  227 
  228 ----------------------
  229 --  DARKTABLE.TAGS  --
  230 ----------------------
  231 darktable.tags:set_text([[Allows access to all existing tags.]])
  232 
  233 darktable.tags["#"]:set_text([[Each existing tag has a numeric entry in the tags table - use ipairs to iterate over them.]])
  234 darktable.tags.create:set_text([[Creates a new tag and return it. If the tag exists return the existing tag.]])
  235 darktable.tags.create:add_parameter("name","string",[[The name of the new tag.]])
  236 darktable.tags.find:set_text([[Returns the tag object or nil if the tag doesn't exist.]])
  237 darktable.tags.find:add_parameter("name","string",[[The name of the tag to find.]])
  238 darktable.tags.find:add_return(types.dt_lua_tag_t,[[The tag object or nil.]])
  239 darktable.tags.delete:set_text([[Deletes the tag object, detaching it from all images.]])
  240 darktable.tags.delete:add_parameter("tag",types.dt_lua_tag_t,[[The tag to be deleted.]])
  241 darktable.tags.delete:set_main_parent(darktable.tags)
  242 darktable.tags.attach:set_text([[Attach a tag to an image; the order of the parameters can be reversed.]])
  243 darktable.tags.attach:add_parameter("tag",types.dt_lua_tag_t,[[The tag to be attached.]])
  244 darktable.tags.attach:add_parameter("image",types.dt_lua_image_t,[[The image to attach the tag to.]])
  245 darktable.tags.attach:set_main_parent(darktable.tags)
  246 darktable.tags.detach:set_text([[Detach a tag from an image; the order of the parameters can be reversed.]])
  247 darktable.tags.detach:add_parameter("tag",types.dt_lua_tag_t,[[The tag to be detached.]])
  248 darktable.tags.detach:add_parameter("image",types.dt_lua_image_t,[[The image to detach the tag from.]])
  249 darktable.tags.detach:set_main_parent(darktable.tags)
  250 darktable.tags.get_tags:set_text([[Gets all tags attached to an image.]])
  251 darktable.tags.get_tags:add_parameter("image",types.dt_lua_image_t,[[The image to get the tags from.]])
  252 darktable.tags.get_tags:add_return("table of "..my_tostring(types.dt_lua_tag_t),[[A table of tags that are attached to the image.]])
  253 darktable.tags.get_tags:set_main_parent(darktable.tags)
  254 
  255 ------------------------------
  256 --  DARKTABLE.CONFIGURATION --
  257 ------------------------------
  258 darktable.configuration:set_text([[This table regroups values that describe details of the configuration of darktable.]])
  259 darktable.configuration.version:set_text([[The version number of darktable.]])
  260 darktable.configuration.has_gui:set_text([[True if darktable has a GUI (launched through the main darktable command, not darktable-cli).]])
  261 darktable.configuration.verbose:set_text([[True if the Lua logdomain is enabled.]])
  262 darktable.configuration.tmp_dir:set_text([[The name of the directory where darktable will store temporary files.]])
  263 darktable.configuration.config_dir:set_text([[The name of the directory where darktable will find its global configuration objects (modules).]])
  264 darktable.configuration.cache_dir:set_text([[The name of the directory where darktable will store its mipmaps.]])
  265 darktable.configuration.api_version_major:set_text([[The major version number of the lua API.]])
  266 darktable.configuration.api_version_minor:set_text([[The minor version number of the lua API.]])
  267 darktable.configuration.api_version_patch:set_text([[The patch version number of the lua API.]])
  268 darktable.configuration.api_version_suffix:set_text([[The version suffix of the lua API.]])
  269 darktable.configuration.api_version_string:set_text([[The version description of the lua API. This is a string compatible with the semantic versioning convention]])
  270 darktable.configuration.running_os:set_text([[The name of the Operating system darktable is currently running on]])
  271 darktable.configuration.check_version:set_text([[Check that a module is compatible with the running version of darktable]]..para().."Add the following line at the top of your module : "..
  272 code("darktable.configuration.check(...,{M,m,p},{M2,m2,p2})").."To document that your module has been tested with API version M.m.p and M2.m2.p2."..para()..
  273 "This will raise an error if the user is running a released version of DT and a warning if he is running a development version"..para().."(the ... here will automatically expand to your module name if used at the top of your script")
  274 darktable.configuration.check_version:add_parameter("module_name","string","The name of the module to report on error")
  275 darktable.configuration.check_version:add_parameter("...","table...","Tables of API versions that are known to work with the script")
  276 
  277 
  278 -----------------------------
  279 --  DARKTABLE.PREFERENCES  --
  280 -----------------------------
  281 darktable.preferences:set_text([[Lua allows you to manipulate preferences. Lua has its own namespace for preferences and you can't access nor write normal darktable preferences.]]..para()..
  282 [[Preference handling functions take a _script_ parameter. This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.]]..para()..
  283 [[Preference handling functions can't guess the type of a parameter. You must pass the type of the preference you are handling. ]]..para()..
  284 [[Note that the directory, enum, lua and file type preferences are stored internally as string. The user can only select valid values, but a lua script can set it to any string]])
  285 
  286 
  287 darktable.preferences.register:set_text([[Creates a new preference entry in the Lua tab of the preference screen. If this function is not called the preference can't be set by the user (you can still read and write invisible preferences).]])
  288 darktable.preferences.register:add_parameter("script","string",[[Invisible prefix to guarantee unicity of preferences.]])
  289 darktable.preferences.register:add_parameter("name","string",[[A unique name used with the script part to identify the preference.]])
  290 darktable.preferences.register:add_parameter("type",types.lua_pref_type,[[The type of the preference - one of the string values described above.]])
  291 darktable.preferences.register:add_parameter("label","string",[[The label displayed in the preference screen.]])
  292 darktable.preferences.register:add_parameter("tooltip","string",[[The tooltip to display in the preference menu.]])
  293 darktable.preferences.register:add_parameter("default","depends on type",[[Default value to use when not set explicitly or by the user.]]..para().."For the enum type of pref, this is mandatory"):set_attribute("optional",true)
  294 darktable.preferences.register:add_parameter("min","int or float",[[Minimum value (integer and float preferences only).]]):set_attribute("optional",true)
  295 darktable.preferences.register:add_parameter("max","int or float",[[Maximum value (integer and float preferences only).]]):set_attribute("optional",true)
  296 darktable.preferences.register:add_parameter("step","float",[[Step of the spinner (float preferences only).]]):set_attribute("optional",true)
  297 darktable.preferences.register:add_parameter("values","string...",[[Other allowed values (enum preferences only)]]):set_attribute("optional",true)
  298 darktable.preferences.register:add_parameter("wiget",types.lua_widget,[[The widget to use in preference(lua preferences only)]]):set_attribute("optional",true)
  299 tmp = darktable.preferences.register:add_parameter("set_callback","function",[[A function called when the widget needs to be updated from the preference]])
  300 tmp:set_attribute("optional",true)
  301 tmp:add_parameter("widget",types.lua_widget,"The widget to update")
  302 
  303 darktable.preferences.read:set_text([[Reads a value from a Lua preference.]])
  304 darktable.preferences.read:add_parameter("script","string",[[Invisible prefix to guarantee unicity of preferences.]])
  305 darktable.preferences.read:add_parameter("name","string",[[The name of the preference displayed in the preference screen.]])
  306 darktable.preferences.read:add_parameter("type",types.lua_pref_type,[[The type of the preference.]])
  307 darktable.preferences.read:add_return("depends on type",[[The value of the preference.]])
  308 
  309 darktable.preferences.write:set_text([[Writes a value to a Lua preference.]])
  310 darktable.preferences.write:add_parameter("script","string",[[Invisible prefix to guarantee unicity of preferences.]])
  311 darktable.preferences.write:add_parameter("name","string",[[The name of the preference displayed in the preference screen.]])
  312 darktable.preferences.write:add_parameter("type",types.lua_pref_type,[[The type of the preference.]])
  313 darktable.preferences.write:add_parameter("value","depends on type",[[The value to set the preference to.]])
  314 
  315 
  316 -----------------------
  317 --  DARKTABLE.STYLES --
  318 -----------------------
  319 
  320 darktable.styles:set_text([[This pseudo table allows you to access and manipulate styles.]])
  321 
  322 darktable.styles["#"]:set_text([[Each existing style has a numeric index; you can iterate them using ipairs.]])
  323 
  324 darktable.styles.create:set_text([[Create a new style based on an image.]])
  325 darktable.styles.create:add_parameter("image",types.dt_lua_image_t,[[The image to create the style from.]])
  326 darktable.styles.create:add_parameter("name","string",[[The name to give to the new style.]])
  327 darktable.styles.create:add_parameter("description","string",[[The description of the new style.]]):set_attribute("optional")
  328 darktable.styles.create:add_return(types.dt_style_t,[[The new style object.]])
  329 darktable.styles.create:set_main_parent(darktable.styles)
  330 
  331 darktable.styles.delete:set_text([[Deletes an existing style.]])
  332 darktable.styles.delete:add_parameter("style",types.dt_style_t,[[the style to delete]])
  333 darktable.styles.delete:set_main_parent(darktable.styles)
  334 
  335 darktable.styles.duplicate:set_text([[Create a new style based on an existing style.]])
  336 darktable.styles.duplicate:add_parameter("style",types.dt_style_t,[[The style to base the new style on.]])
  337 darktable.styles.duplicate:add_parameter("name","string",[[The new style's name.]])
  338 darktable.styles.duplicate:add_parameter("description","string",[[The new style's description.]]):set_attribute("optional")
  339 darktable.styles.duplicate:add_return(types.dt_style_t,[[The new style object.]])
  340 darktable.styles.duplicate:set_main_parent(darktable.styles)
  341 
  342 darktable.styles.apply:set_text([[Apply a style to an image. The order of parameters can be inverted.]])
  343 darktable.styles.apply:add_parameter("style",types.dt_style_t,[[The style to use.]])
  344 darktable.styles.apply:add_parameter("image",types.dt_lua_image_t,[[The image to apply the style to.]])
  345 darktable.styles.apply:set_main_parent(darktable.styles)
  346 
  347 darktable.styles.import:set_text([[Import a style from an external .dtstyle file]])
  348 darktable.styles.import:add_parameter("filename","string","The file to import");
  349 darktable.styles.import:set_main_parent(darktable.styles)
  350 
  351 darktable.styles.export:set_text([[Export a style to an external .dtstyle file]])
  352 darktable.styles.export:add_parameter("style",types.dt_style_t,"The style to export");
  353 darktable.styles.export:add_parameter("directory","string","The directory to export to");
  354 darktable.styles.export:add_parameter("overwrite","boolean","Is overwriting an existing file allowed"):set_attribute("optional")
  355 darktable.styles.export:set_main_parent(darktable.styles)
  356 -------------------------
  357 --  DARKTABLE.DATABASE --
  358 -------------------------
  359 
  360 darktable.database:set_text([[Allows to access the database of images. Note that duplicate images (images with the same RAW but different XMP) will appear multiple times with different duplicate indexes. Also note that all images are here. This table is not influenced by any GUI filtering (collections, stars etc...).]])
  361 
  362 
  363 darktable.database["#"]:set_text([[Each image in the database appears with a numerical index; you can iterate them using ipairs.]])
  364 darktable.database.duplicate:set_text([[Creates a duplicate of an image and returns it.]])
  365 darktable.database.duplicate:add_parameter("image",types.dt_lua_image_t,[[the image to duplicate]])
  366 darktable.database.duplicate:add_return(types.dt_lua_image_t,[[The new image object.]])
  367 darktable.database.duplicate:set_main_parent(darktable.database)
  368 
  369 darktable.database.import:set_text([[Imports new images into the database.]])
  370 darktable.database.import:add_parameter("location","string",[[The filename or directory to import images from.
  371 
  372 NOTE: If the images are set to be imported recursively in preferences only the toplevel film is returned (the one whose path was given as a parameter).
  373 
  374 NOTE2: If the parameter is a directory the call is non-blocking; the film object will not have the newly imported images yet. Use a post-import-film filtering on that film to react when images are actually imported.
  375 
  376 
  377 ]])
  378 darktable.database.import:add_return(types.dt_lua_image_t,[[The created image if an image is imported or the toplevel film object if a film was imported.]])
  379 darktable.database.move_image:set_text([[Physically moves an image (and all its duplicates) to another film.]]..para()..
  380 [[This will move the image file, the related XMP and all XMP for the duplicates to the directory of the new film]]..para()..
  381 [[Note that the parameter order is not relevant.]])
  382 darktable.database.move_image:add_parameter("image",types.dt_lua_image_t,[[The image to move]])
  383 darktable.database.move_image:add_parameter("film",types.dt_lua_film_t,[[The film to move to]])
  384 darktable.database.move_image:set_main_parent(darktable.database)
  385 darktable.database.copy_image:set_text([[Physically copies an image to another film.]]..para()..
  386 [[This will copy the image file and the related XMP to the directory of the new film]]..para()..
  387 [[If there is already a file with the same name as the image file, it will create a duplicate from that file instead]]..para()..
  388 [[Note that the parameter order is not relevant.]])
  389 darktable.database.copy_image:add_parameter("image",types.dt_lua_image_t,[[The image to copy]])
  390 darktable.database.copy_image:add_parameter("film",types.dt_lua_film_t,[[The film to copy to]])
  391 darktable.database.copy_image:add_return(types.dt_lua_image_t,[[The new image]])
  392 darktable.database.copy_image:set_main_parent(darktable.database)
  393 darktable.collection:set_text([[Allows to access the currently worked on images, i.e the ones selected by the collection lib. Filtering (rating etc) does not change that collection.]])
  394 
  395 
  396 darktable.collection["#"]:set_text([[Each image in the collection appears with a numerical index; you can iterate them using ipairs.]])
  397 
  398 
  399 for k, v in darktable.gui.views:unskiped_children() do
  400     v:set_main_parent(darktable.gui.views)
  401 end
  402 darktable.gui.views:set_text([[The different views in darktable]])
  403 darktable.gui.views.map:set_text([[The map view]])
  404 darktable.gui.views.map.latitude:set_text([[The latitude of the center of the map]])
  405 darktable.gui.views.map.longitude:set_text([[The longitude of the center of the map]])
  406 darktable.gui.views.map.zoom:set_text([[The current zoom level of the map]])
  407 
  408 darktable.gui.views.darkroom:set_text([[The darkroom view]])
  409 darktable.gui.views.lighttable:set_text([[The lighttable view]])
  410 darktable.gui.views.tethering:set_text([[The tethering view]])
  411 darktable.gui.views.slideshow:set_text([[The slideshow view]])
  412 darktable.gui.views.print:set_text([[The print view]])
  413 darktable.gui.views.knight:set_skiped()
  414 
  415 --[[
  416 for k, v in darktable.gui.libs:unskiped_children() do
  417     local real_node = real_darktable.gui.libs[k]
  418     v:set_attribute("position",real_node.position);
  419     v:set_attribute("container",real_node.container);
  420     local matching_views={}
  421     for k2,v2 in pairs(real_node.views) do
  422         table.insert(matching_views,darktable.gui.views[v2.id])
  423     end
  424     v:set_attribute("views",matching_views);
  425 end
  426 ]]
  427 darktable.gui.libs:set_text([[This table allows to reference all lib objects]]..para()..
  428 [[lib are the graphical blocks within each view.]]..para()..
  429 [[To quickly figure out what lib is what, you can use the following code which will make a given lib blink.]]..para()..
  430 code([[local tested_module="global_toolbox"
  431 dt.gui.libs[tested_module].visible=false
  432 coroutine.yield("WAIT_MS",2000)
  433 while true do
  434     dt.gui.libs[tested_module].visible = not dt.gui.libs[tested_module].visible
  435     coroutine.yield("WAIT_MS",2000)
  436 end]]))
  437 
  438 
  439 darktable.gui.libs.snapshots:set_text([[The UI element that manipulates snapshots in darkroom]])
  440 darktable.gui.libs.snapshots.ratio:set_text([[The place in the screen where the line separating the snapshot is. Between 0 and 1]])
  441 darktable.gui.libs.snapshots.direction:set_text([[The direction of the snapshot overlay]]):set_reported_type(types.snapshot_direction_t)
  442 
  443 darktable.gui.libs.snapshots["#"]:set_text([[The different snapshots for the image]])
  444 darktable.gui.libs.snapshots.selected:set_text([[The currently selected snapshot]])
  445 darktable.gui.libs.snapshots.selected:set_reported_type(types.dt_lua_snapshot_t)
  446 darktable.gui.libs.snapshots.take_snapshot:set_text([[Take a snapshot of the current image and add it to the UI]]..para()..[[The snapshot file will be generated at the next redraw of the main window]])
  447 darktable.gui.libs.snapshots.max_snapshot:set_text([[The maximum number of snapshots]])
  448 
  449 darktable.gui.libs.collect:set_text([[The collection UI element that allows to filter images by collection]])
  450 darktable.gui.libs.collect.filter:set_text([[Allows to get or change the list of visible images]])
  451 darktable.gui.libs.collect.filter:add_parameter("rules","array of"..my_tostring(types.dt_lib_collect_params_rule_t),[[A table of rules describing the filter. These rules will be applied after this call]]):set_attribute("optional",true)
  452 darktable.gui.libs.collect.filter:add_return("array of"..my_tostring(types.dt_lib_collect_params_rule_t),[[The rules that were applied before this call.]])
  453 darktable.gui.libs.collect.filter:set_attribute("implicit_yield",true)
  454 darktable.gui.libs.collect.new_rule:set_text([[Returns a newly created rule object]])
  455 darktable.gui.libs.collect.new_rule:add_return(my_tostring(types.dt_lib_collect_params_rule_t),[[The newly created rule]])
  456 
  457 darktable.gui.libs.import:set_text([[The buttons to start importing images]])
  458 darktable.gui.libs.import.register_widget:set_text([[Add a widget in the option expander of the import dialog]])
  459 darktable.gui.libs.import.register_widget:add_parameter("widget",types.lua_widget,[[The widget to add to the dialog. The reset callback of the widget will be called whenever the dialog is opened]])
  460 
  461 
  462 
  463 darktable.gui.libs.styles:set_text([[The style selection menu]])
  464 darktable.gui.libs.metadata_view:set_text([[The widget displaying metadata about the current image]])
  465 darktable.gui.libs.metadata_view.register_info:set_text([[Register a function providing extra info to display in the widget]])
  466 darktable.gui.libs.metadata_view.register_info:add_parameter("name","string","The name displayed for the new information")
  467 tmp = darktable.gui.libs.metadata_view.register_info:add_parameter("callback","function","The function providing the info")
  468 tmp:add_parameter("image",types.dt_lua_image_t,"The image to analyze")
  469 tmp:add_return("string","The extra information to display")
  470 darktable.gui.libs.metadata:set_text([[The widget allowing modification of metadata fields on the current image]])
  471 darktable.gui.libs.hinter:set_text([[The small line of text at the top of the UI showing the number of selected images]])
  472 darktable.gui.libs.filmstrip:set_text([[The filmstrip at the bottom of some views]])
  473 darktable.gui.libs.viewswitcher:set_text([[The labels allowing to switch view]])
  474 darktable.gui.libs.darktable_label:set_text([[The darktable logo in the upper left corner]])
  475 darktable.gui.libs.tagging:set_text([[The tag manipulation UI]])
  476 darktable.gui.libs.geotagging:set_text([[The geotagging time synchronisation UI]])
  477 darktable.gui.libs.recentcollect:set_text([[The recent collection UI element]])
  478 darktable.gui.libs.global_toolbox:set_text([[The common tools to all view (settings, grouping...)]])
  479 darktable.gui.libs.global_toolbox.grouping:set_text([[The current status of the image grouping option]])
  480 darktable.gui.libs.global_toolbox.show_overlays:set_text([[the current status of the image overlays option]])
  481 darktable.gui.libs.filter:set_text([[The image-filter menus at the top of the UI]])
  482 darktable.gui.libs.ratings:set_text([[The starts to set the rating of an image]])
  483 darktable.gui.libs.select:set_text([[The buttons that allow to quickly change the selection]])
  484 darktable.gui.libs.select.register_selection:set_text([[Add a new button and call a callback when it is clicked]])
  485 darktable.gui.libs.select.register_selection:add_parameter("label","string","The label to display on the button")
  486 tmp = darktable.gui.libs.select.register_selection:add_parameter("callback","function","The function to call when the button is pressed")
  487 tmp:add_parameter("event","string","The name of the button that was pressed")
  488 tmp:add_parameter("images","table of"..tostring(types.dt_lua_image_t),"The images in the current collection. This is the same content as"..my_tostring(darktable.collection))
  489 tmp:add_return("table of"..tostring(types.dt_lua_image_t),"The images to set the selection to")
  490 darktable.gui.libs.select.register_selection:add_parameter("tooltip","string","The tooltip to use on the new button"):set_attribute("optional",true)
  491 darktable.gui.libs.colorlabels:set_text([[The color buttons that allow to set labels on an image]])
  492 darktable.gui.libs.lighttable_mode:set_text([[The navigation and zoom level UI in lighttable]])
  493 darktable.gui.libs.copy_history:set_text([[The UI element that manipulates history]])
  494 darktable.gui.libs.image:set_text([[The UI element that manipulates the current images]])
  495 darktable.gui.libs.image.register_action:set_text([[Add a new button and call a callback when it is clicked]])
  496 darktable.gui.libs.image.register_action:add_parameter("label","string","The label to display on the button")
  497 tmp = darktable.gui.libs.image.register_action:add_parameter("callback","function","The function to call when the button is pressed")
  498 tmp:add_parameter("event","string","The name of the button that was pressed")
  499 tmp:add_parameter("images","table of"..tostring(types.dt_lua_image_t),"The images to act on when the button was clicked")
  500 darktable.gui.libs.image.register_action:add_parameter("tooltip","string","The tooltip to use on the new button"):set_attribute("optional",true)
  501 darktable.gui.libs.modulegroups:set_text([[The icons describing the different iop groups]])
  502 darktable.gui.libs.module_toolbox:set_text([[The tools on the bottom line of the UI (overexposure)]])
  503 darktable.gui.libs.session:set_text([[The session UI when tethering]])
  504 darktable.gui.libs.histogram:set_text([[The histogram widget]])
  505 darktable.gui.libs.export:set_text([[The export menu]])
  506 darktable.gui.libs.history:set_text([[The history manipulation menu]])
  507 darktable.gui.libs.colorpicker:set_text([[The colorpicker menu]])
  508 darktable.gui.libs.navigation:set_text([[The full image preview to allow navigation]])
  509 darktable.gui.libs.masks:set_text([[The masks window]])
  510 darktable.gui.libs.view_toolbox:set_text([[]])
  511 darktable.gui.libs.live_view:set_text([[The liveview window]])
  512 darktable.gui.libs.map_settings:set_text([[The map setting window]])
  513 darktable.gui.libs.camera:set_text([[The camera selection UI]])
  514 darktable.gui.libs.location:set_text([[The location ui]])
  515 darktable.gui.libs.backgroundjobs:set_text([[The window displaying the currently running jobs]])
  516 darktable.gui.libs.print_settings:set_text([[The settings window in the print view]])
  517 
  518 
  519 darktable.control:set_text([[This table contain function to manipulate the control flow of lua programs. It provides ways to do background jobs and other related functions]])
  520 darktable.control.ending:set_text([[TRUE when darktable is terminating]]..para()..
  521 [[Use this variable to detect when you should finish long running jobs]])
  522 darktable.control.dispatch:set_text([[Runs a function in the background. This function will be run at a later point, after luarc has finished running. If you do a loop in such a function, please check ]]..my_tostring(darktable.control.ending)..[[ in your loop to finish the function when DT exits]])
  523 darktable.control.dispatch:add_parameter("function","function",[[The call to dispatch]])
  524 darktable.control.dispatch:add_parameter("...","anything",[[extra parameters to pass to the function]])
  525 darktable.control.sleep:set_text("Suspends execution while not blocking darktable")
  526 darktable.control.sleep:add_parameter("delay","int","The delay in millisecond to sleep")
  527 darktable.control.execute:set_text("Run a command in a shell while not blocking darktable")
  528 darktable.control.execute:add_parameter("command","string","The command to run, as in 'sh -c'")
  529 darktable.control.execute:add_return("int","The result of the system call")
  530 darktable.control.read:set_text("Block until a file is readable while not blocking darktable"..para()..emphasis("This function is not available on Windows builds"))
  531 darktable.control.read:add_parameter("file","file","The file object to wait for")
  532 
  533 
  534 darktable.gettext:set_text([[This table contains functions related to translating lua scripts]])
  535 darktable.gettext.gettext:set_text([[Translate a string using the darktable textdomain]])
  536 darktable.gettext.gettext:add_parameter("msgid","string","The string to translate");
  537 darktable.gettext.gettext:add_return("string","The translated string");
  538 darktable.gettext.dgettext:set_text([[Translate a string using the specified textdomain]])
  539 darktable.gettext.dgettext:add_parameter("domainname","string","The domain to use for that translation");
  540 darktable.gettext.dgettext:add_parameter("msgid","string","The string to translate");
  541 darktable.gettext.dgettext:add_return("string","The translated string");
  542 darktable.gettext.ngettext:set_text([[Translate a string depending on the number of objects using the darktable textdomain]])
  543 darktable.gettext.ngettext:add_parameter("msgid","string","The string to translate");
  544 darktable.gettext.ngettext:add_parameter("msgid_plural","string","The string to translate in plural form");
  545 darktable.gettext.ngettext:add_parameter("n","int","The number of objects");
  546 darktable.gettext.ngettext:add_return("string","The translated string");
  547 darktable.gettext.dngettext:set_text([[Translate a string depending on the number of objects using the specified textdomain]])
  548 darktable.gettext.dngettext:add_parameter("domainname","string","The domain to use for that translation");
  549 darktable.gettext.dngettext:add_parameter("msgid","string","The string to translate");
  550 darktable.gettext.dngettext:add_parameter("msgid_plural","string","The string to translate in plural form");
  551 darktable.gettext.dngettext:add_parameter("n","int","The number of objects");
  552 darktable.gettext.dngettext:add_return("string","The translated string");
  553 darktable.gettext.bindtextdomain:set_text([[Tell gettext where to find the .mo file translating messages for a particular domain]])
  554 darktable.gettext.bindtextdomain:add_parameter("domainname","string","The domain to use for that translation");
  555 darktable.gettext.bindtextdomain:add_parameter("dirname","string","The base directory to look for the file. The file should be placed in "..emphasis("dirname").."/"..emphasis("locale name").."/LC_MESSAGES/"..emphasis("domain")..".mo");
  556 
  557 ----------------------
  558 --  DARKTABLE.DEBUG --
  559 ----------------------
  560 darktable.debug:set_text([[This section must be activated separately by calling
  561 
  562 require "darktable.debug"
  563 ]])
  564 
  565 darktable.debug.dump:set_text([[This will return a string describing everything Lua knows about an object, used to know what an object is.
  566 
  567 This function is recursion-safe and can be used to dump _G if needed.]])
  568 darktable.debug.dump:add_parameter("object","anything",[[The object to dump.]])
  569 darktable.debug.dump:add_parameter("name","string",[[A name to use for the object.]]):set_attribute("optional",true)
  570 tmp_node = darktable.debug.dump:add_parameter("known","table",[[A table of object,string pairs. Any object in that table will not be dumped, the string will be printed instead.]]..para().."defaults to "..my_tostring(darktable.debug.known).." if not set")
  571 tmp_node:set_attribute("optional",true)
  572 darktable.debug.dump:add_return("string",[[A string containing a text description of the object - can be very long.]])
  573 
  574 darktable.debug.debug:set_text([[Initialized to false; set it to true to also dump information about metatables.]])
  575 darktable.debug.max_depth:set_text([[Initialized to 10; The maximum depth to recursively dump content.]])
  576 
  577 remove_all_children(darktable.debug.known) -- debug values, not interesting
  578 darktable.debug.known:set_text([[A table containing the default value of ]]..my_tostring(tmp_node))
  579 darktable.debug.type:set_text([[Similar to the system function type() but it will return the real type instead of "userdata" for darktable specific objects.]])
  580   darktable.debug.type:add_parameter("object","anything",[[The object whose type must be reported.]])
  581     darktable.debug.type:add_return("string",[[A string describing the type of the object.]])
  582 
  583     ----------------------
  584     --  TYPES           --
  585     ----------------------
  586     types:set_text([[This section documents types that are specific to darktable's Lua API.]])
  587 
  588     types.lua_os_type:set_text([[The type of OS we darktable can run on]])
  589 
  590     types.dt_lua_image_t:set_text([[Image objects represent an image in the database. This is slightly different from a file on disk since a file can have multiple developments.
  591 
  592     Note that this is the real image object; changing the value of a field will immediately change it in darktable and will be reflected on any copy of that image object you may have kept.]])
  593 
  594 
  595     types.dt_lua_image_t.id:set_text([[A unique id identifying the image in the database.]])
  596     types.dt_lua_image_t.path:set_text([[The file the directory containing the image.]])
  597     types.dt_lua_image_t.film:set_text([[The film object that contains this image.]])
  598     types.dt_lua_image_t.filename:set_text([[The filename of the image.]])
  599   types.dt_lua_image_t.sidecar:set_text([[The filename of the image's sidecar file.]])
  600     types.dt_lua_image_t.duplicate_index:set_text([[If there are multiple images based on a same file, each will have a unique number, starting from 0.]])
  601 
  602 
  603     types.dt_lua_image_t.publisher:set_text([[The publisher field of the image.]])
  604     types.dt_lua_image_t.title:set_text([[The title field of the image.]])
  605     types.dt_lua_image_t.creator:set_text([[The creator field of the image.]])
  606     types.dt_lua_image_t.rights:set_text([[The rights field of the image.]])
  607     types.dt_lua_image_t.description:set_text([[The description field for the image.]])
  608 
  609     types.dt_lua_image_t.exif_maker:set_text([[The maker exif data.]])
  610     types.dt_lua_image_t.exif_model:set_text([[The camera model used.]])
  611     types.dt_lua_image_t.exif_lens:set_text([[The id string of the lens used.]])
  612     types.dt_lua_image_t.exif_aperture:set_text([[The aperture saved in the exif data.]])
  613     types.dt_lua_image_t.exif_exposure:set_text([[The exposure time of the image.]])
  614     types.dt_lua_image_t.exif_focal_length:set_text([[The focal length of the image.]])
  615     types.dt_lua_image_t.exif_iso:set_text([[The iso used on the image.]])
  616     types.dt_lua_image_t.exif_datetime_taken:set_text([[The date and time of the image.]])
  617     types.dt_lua_image_t.exif_focus_distance:set_text([[The distance of the subject.]])
  618     types.dt_lua_image_t.exif_crop:set_text([[The exif crop data.]])
  619     types.dt_lua_image_t.latitude:set_text([[GPS latitude data of the image, nil if not set.]])
  620     types.dt_lua_image_t.latitude:set_reported_type("float or nil")
  621     types.dt_lua_image_t.longitude:set_text([[GPS longitude data of the image, nil if not set.]])
  622     types.dt_lua_image_t.longitude:set_reported_type("float or nil")
  623     types.dt_lua_image_t.elevation:set_text([[GPS altitude data of the image, nil if not set.]])
  624     types.dt_lua_image_t.elevation:set_reported_type("float or nil")
  625     types.dt_lua_image_t.is_raw:set_text([[True if the image is a RAW file.]])
  626     types.dt_lua_image_t.is_ldr:set_text([[True if the image is a ldr image.]])
  627     types.dt_lua_image_t.is_hdr:set_text([[True if the image is a hdr image.]])
  628   types.dt_lua_image_t.has_txt:set_text([[True if the image has a txt sidecar file.]])
  629   types.dt_lua_image_t.width:set_text([[The width of the image.]])
  630     types.dt_lua_image_t.height:set_text([[The height of the image.]])
  631   types.dt_lua_image_t.rating:set_text([[The rating of the image (-1 for rejected).]])
  632   types.dt_lua_image_t.red:set_text([[True if the image has the corresponding colorlabel.]])
  633     types.dt_lua_image_t.red:set_alias(types.dt_lua_image_t.blue)
  634     types.dt_lua_image_t.red:set_alias(types.dt_lua_image_t.green)
  635     types.dt_lua_image_t.red:set_alias(types.dt_lua_image_t.yellow)
  636     types.dt_lua_image_t.red:set_alias(types.dt_lua_image_t.purple)
  637     types.dt_lua_image_t.reset:set_text([[Removes all processing from the image, resetting it back to its original state]])
  638     types.dt_lua_image_t.reset:add_parameter("self",types.dt_lua_image_t,[[The image whose history will be deleted]]):set_attribute("is_self",true)
  639     types.dt_lua_image_t.delete:set_text([[Removes an image from the database]])
  640     types.dt_lua_image_t.delete:add_parameter("self",types.dt_lua_image_t,[[The image to remove]]):set_attribute("is_self",true)
  641 
  642     types.dt_lua_image_t.group_with:set_text([[Puts the first image in the same group as the second image. If no second image is provided the image will be in its own group.]])
  643     types.dt_lua_image_t.group_with:add_parameter("self",types.dt_lua_image_t,[[The image whose group must be changed.]]):set_attribute("is_self",true)
  644     types.dt_lua_image_t.group_with:add_parameter("image",types.dt_lua_image_t,[[The image we want to group with.]]):set_attribute("optional",true)
  645     types.dt_lua_image_t.make_group_leader:set_text([[Makes the image the leader of its group.]])
  646     types.dt_lua_image_t.make_group_leader:add_parameter("self",types.dt_lua_image_t,[[The image we want as the leader.]]):set_attribute("is_self",true)
  647     types.dt_lua_image_t.get_group_members:set_text([[Returns a table containing all ]]..my_tostring(types.dt_lua_image_t)..[[ of the group. The group leader is both at a numeric key and at the "leader" special key (so you probably want to use ipairs to iterate through that table).]])
  648     types.dt_lua_image_t.get_group_members:add_parameter("self",types.dt_lua_image_t,[[The image whose group we are querying.]]):set_attribute("is_self",true)
  649     types.dt_lua_image_t.get_group_members:add_return("table of "..my_tostring(types.dt_lua_image_t),[[A table of image objects containing all images that are in the same group as the image.]])
  650     darktable.tags.attach:set_alias(types.dt_lua_image_t.attach_tag)
  651     types.dt_lua_image_t.group_leader:set_text([[The image which is the leader of the group this image is a member of.]])
  652     types.dt_lua_image_t.local_copy:set_text([[True if the image has a copy in the local cache]])
  653     types.dt_lua_image_t.drop_cache:set_text("drops the cached version of this image."..para()..
  654     "This function should be called if an image is modified out of darktable to force DT to regenerate the thumbnail"..para()..
  655     "darktable will regenerate the thumbnail by itself when it is needed")
  656     types.dt_lua_image_t.drop_cache:add_parameter("self",types.dt_lua_image_t,[[The image whose cache must be dropped.]]):set_attribute("is_self",true)
  657 
  658     types.dt_imageio_module_format_t:set_text([[A virtual type representing all format types.]])
  659     types.dt_imageio_module_format_t.plugin_name:set_text([[A unique name for the plugin.]])
  660     types.dt_imageio_module_format_t.name:set_text([[A human readable name for the plugin.]])
  661     types.dt_imageio_module_format_t.extension:set_text([[The typical filename extension for that format.]])
  662     types.dt_imageio_module_format_t.mime:set_text([[The mime type associated with the format.]])
  663     types.dt_imageio_module_format_t.max_width:set_text([[The max width allowed for the format (0 = unlimited).]])
  664     types.dt_imageio_module_format_t.max_height:set_text([[The max height allowed for the format (0 = unlimited).]])
  665     types.dt_imageio_module_format_t.write_image:set_text([[Exports an image to a file. This is a blocking operation that will not return until the image is exported.]])
  666     types.dt_imageio_module_format_t.write_image:set_attribute("implicit_yield",true)
  667     types.dt_imageio_module_format_t.write_image:add_parameter("self",types.dt_imageio_module_format_t,[[The format that will be used to export.]]):set_attribute("is_self",true)
  668     types.dt_imageio_module_format_t.write_image:add_parameter("image",types.dt_lua_image_t,[[The image object to export.]])
  669     types.dt_imageio_module_format_t.write_image:add_parameter("filename","string",[[The filename to export to.]])
  670     types.dt_imageio_module_format_t.write_image:add_parameter("allow_upscale","boolean",[[Set to true to allow upscaling of the image.]]):set_attribute("optional",true)
  671     types.dt_imageio_module_format_t.write_image:add_return("boolean",[[Returns true on success.]])
  672 
  673     types.dt_imageio_module_format_data_png:set_text([[Type object describing parameters to export to png.]])
  674     types.dt_imageio_module_format_data_png.bpp:set_text([[The bpp parameter to use when exporting.]])
  675     types.dt_imageio_module_format_data_tiff:set_text([[Type object describing parameters to export to tiff.]])
  676     types.dt_imageio_module_format_data_tiff.bpp:set_text([[The bpp parameter to use when exporting.]])
  677     types.dt_imageio_module_format_data_exr:set_text([[Type object describing parameters to export to exr.]])
  678     types.dt_imageio_module_format_data_exr.compression:set_text([[The compression parameter to use when exporting.]])
  679     types.dt_imageio_module_format_data_copy:set_text([[Type object describing parameters to export to copy.]])
  680     types.dt_imageio_module_format_data_pfm:set_text([[Type object describing parameters to export to pfm.]])
  681     types.dt_imageio_module_format_data_jpeg:set_text([[Type object describing parameters to export to jpeg.]])
  682     types.dt_imageio_module_format_data_jpeg.quality:set_text([[The quality to use at export time.]])
  683     types.dt_imageio_module_format_data_ppm:set_text([[Type object describing parameters to export to ppm.]])
  684     types.dt_imageio_module_format_data_webp:set_text([[Type object describing parameters to export to webp.]])
  685     types.dt_imageio_module_format_data_webp.quality:set_text([[The quality to use at export time.]])
  686     types.dt_imageio_module_format_data_webp.comp_type:set_text([[The overall quality to use; can be one of "webp_lossy" or "webp_lossless".]]):set_reported_type(types.comp_type_t);
  687     types.dt_imageio_module_format_data_webp.hint:set_text([[A hint on the overall content of the image.]]):set_reported_type(types.hint_t)
  688     types.dt_imageio_module_format_data_j2k:set_text([[Type object describing parameters to export to jpeg2000.]])
  689     types.dt_imageio_module_format_data_j2k.quality:set_text([[The quality to use at export time.]])
  690     types.dt_imageio_module_format_data_j2k.bpp:set_text([[The bpp parameter to use when exporting.]])
  691     types.dt_imageio_module_format_data_j2k.format:set_text([[The format to use.]]):set_reported_type(types.dt_imageio_j2k_format_t)
  692     types.dt_imageio_module_format_data_j2k.preset:set_text([[The preset to use.]]):set_reported_type(types.dt_imageio_j2k_preset_t)
  693 
  694 
  695     types.dt_imageio_module_format_data_pdf:set_text([[Type object describing parameters to export to pdf.]])
  696   types.dt_imageio_module_format_data_pdf.dpi:set_text([[The dot per inch value to use at export]])
  697   types.dt_imageio_module_format_data_pdf.icc:set_text([[Should the images be tagged with their embedded profile]])
  698   types.dt_imageio_module_format_data_pdf.border:set_text([[Empty space around the PDF images]])
  699   types.dt_imageio_module_format_data_pdf.orientation:set_text([[Orientation of the pages in the document]])
  700   types.dt_imageio_module_format_data_pdf.title:set_text([[The title for the document
  701   types.dt_imageio_module_format_data_pdf.rotate:set_text([[Should the images be rotated to match the PDF orientation]])
  702   types.dt_imageio_module_format_data_pdf.mode:set_text([[The image mode to use at export time]])
  703   types.dt_imageio_module_format_data_pdf.size:set_text([[The paper size to use]])
  704   types.dt_imageio_module_format_data_pdf.compression:set_text([[Compression mode to use for images]])
  705   types.dt_imageio_module_format_data_pdf.pages:set_text([[The page type to use]])
  706   types.dt_imageio_module_format_data_pdf.rotate:set_text([[Should the images be rotated in the resulting PDF]])
  707   types._pdf_mode_t:set_text([[The export mode to use for PDF document]])
  708   types._pdf_pages_t:set_text([[The different page types for PDF export]])
  709   types.dt_pdf_stream_encoder_t:set_text([[The compression mode for PDF document]])
  710 
  711 
  712     types.dt_imageio_module_storage_t:set_text([[A virtual type representing all storage types.]])
  713     types.dt_imageio_module_storage_t.plugin_name:set_text([[A unique name for the plugin.]])
  714     types.dt_imageio_module_storage_t.name:set_text([[A human readable name for the plugin.]])
  715     types.dt_imageio_module_storage_t.width:set_text([[The currently selected width for the plugin.]])
  716     types.dt_imageio_module_storage_t.height:set_text([[The currently selected height for the plugin.]])
  717     types.dt_imageio_module_storage_t.recommended_width:set_text([[The recommended width for the plugin.]])
  718     types.dt_imageio_module_storage_t.recommended_height:set_text([[The recommended height for the plugin.]])
  719     types.dt_imageio_module_storage_t.supports_format:set_text([[Checks if a format is supported by this storage.]])
  720     types.dt_imageio_module_storage_t.supports_format:add_parameter("self",types.dt_imageio_module_storage_t,[[The storage type to check against.]]):set_attribute("is_self",true)
  721     types.dt_imageio_module_storage_t.supports_format:add_parameter("format",types.dt_imageio_module_format_t,[[The format type to check.]])
  722     types.dt_imageio_module_storage_t.supports_format:add_return("boolean",[[True if the format is supported by the storage.]])
  723 
  724     types.dt_imageio_module_storage_data_email:set_text([[An object containing parameters to export to email.]])
  725     types.dt_imageio_module_storage_data_flickr:set_text([[An object containing parameters to export to flickr.]])
  726     types.dt_imageio_module_storage_data_facebook:set_text([[An object containing parameters to export to facebook.]])
  727     types.dt_imageio_module_storage_data_latex:set_text([[An object containing parameters to export to latex.]])
  728     types.dt_imageio_module_storage_data_latex.filename:set_text([[The filename to export to.]])
  729     types.dt_imageio_module_storage_data_latex.title:set_text([[The title to use for export.]])
  730     types.dt_imageio_module_storage_data_picasa:set_text([[An object containing parameters to export to picasa.]])
  731     types.dt_imageio_module_storage_data_gallery:set_text([[An object containing parameters to export to gallery.]])
  732     types.dt_imageio_module_storage_data_gallery.filename:set_text([[The filename to export to.]])
  733     types.dt_imageio_module_storage_data_gallery.title:set_text([[The title to use for export.]])
  734     types.dt_imageio_module_storage_data_disk:set_text([[An object containing parameters to export to disk.]])
  735     types.dt_imageio_module_storage_data_disk.filename:set_text([[The filename to export to.]])
  736 
  737     types.dt_lua_film_t:set_text([[A film in darktable; this represents a directory containing imported images.]])
  738     types.dt_lua_film_t["#"]:set_text([[The different images within the film.]])
  739     types.dt_lua_film_t.id:set_text([[A unique numeric id used by this film.]])
  740     types.dt_lua_film_t.path:set_text([[The path represented by this film.]])
  741     types.dt_lua_film_t.delete:set_text([[Removes the film from the database.]])
  742     types.dt_lua_film_t.delete:add_parameter("self",types.dt_lua_film_t,[[The film to remove.]]):set_attribute("is_self",true)
  743     types.dt_lua_film_t.delete:add_parameter("force","Boolean",[[Force removal, even if the film is not empty.]]):set_attribute("optional",true)
  744 
  745     types.dt_style_t:set_text([[A style that can be applied to an image.]])
  746     types.dt_style_t.name:set_text([[The name of the style.]])
  747     types.dt_style_t.description:set_text([[The description of the style.]])
  748     types.dt_style_t["#"]:set_text([[The different items that make the style.]])
  749 
  750     types.dt_style_item_t:set_text([[An element that is part of a style.]])
  751     types.dt_style_item_t.name:set_text([[The name of the style item.]])
  752     types.dt_style_item_t.num:set_text([[The position of the style item within its style.]])
  753 
  754     types.dt_lua_tag_t:set_text([[A tag that can be attached to an image.]])
  755     types.dt_lua_tag_t.name:set_text([[The name of the tag.]])
  756     types.dt_lua_tag_t["#"]:set_text([[The images that have that tag attached to them.]])
  757     types.dt_lua_tag_t["#"]:set_reported_type(types.dt_lua_image_t)
  758 
  759     types.dt_lua_lib_t:set_text([[The type of a UI lib]])
  760     types.dt_lua_lib_t.id:set_text([[A unit string identifying the lib]])
  761     types.dt_lua_lib_t.name:set_text([[The translated title of the UI element]])
  762     types.dt_lua_lib_t.version:set_text([[The version of the internal data of this lib]])
  763     types.dt_lua_lib_t.visible:set_text([[Allow to make a lib module completely invisible to the user.]]..para()..
  764     [[Note that if the module is invisible the user will have no way to restore it without lua]])
  765     types.dt_lua_lib_t.visible:set_attribute("implicit_yield",true)
  766     types.dt_lua_lib_t.container:set_text([[The location of the lib in the darktable UI]]):set_reported_type(types.dt_ui_container_t)
  767     types.dt_lua_lib_t.expandable:set_text([[True if the lib can be expanded/retracted]]);
  768     types.dt_lua_lib_t.expanded:set_text([[True if the lib is expanded]]);
  769     types.dt_lua_lib_t.position:set_text([[A value deciding the position of the lib within its container]])
  770     types.dt_lua_lib_t.views:set_text([[A table of all the views that display this widget]])
  771     types.dt_lua_lib_t.reset:set_text([[A function to reset the lib to its default values]]..para()..
  772     [[This function will do nothing if the lib is not visible or can't be reset]])
  773     types.dt_lua_lib_t.reset:add_parameter("self",types.dt_lua_lib_t,[[The lib to reset]]):set_attribute("is_self",true)
  774     types.dt_lua_lib_t.on_screen:set_text([[True if the lib is currently visible on the screen]])
  775 
  776     types.dt_lua_view_t:set_text([[A darktable view]])
  777     types.dt_lua_view_t.id:set_text([[A unique string identifying the view]])
  778     types.dt_lua_view_t.name:set_text([[The name of the view]])
  779 
  780 
  781     types.dt_lua_backgroundjob_t:set_text([[A lua-managed entry in the backgroundjob lib]])
  782     types.dt_lua_backgroundjob_t.percent:set_text([[The value of the progress bar, between 0 and 1. will return nil if there is no progress bar, will raise an error if read or written on an invalid job]])
  783     types.dt_lua_backgroundjob_t.valid:set_text([[True if the job is displayed, set it to false to destroy the entry]]..para().."An invalid job cannot be made valid again")
  784 
  785 
  786     types.dt_lua_snapshot_t:set_text([[The description of a snapshot in the snapshot lib]])
  787     types.dt_lua_snapshot_t.filename:set_text([[The filename of an image containing the snapshot]])
  788     types.dt_lua_snapshot_t.select:set_text([[Activates this snapshot on the display. To deactivate all snapshot you need to call this function on the active snapshot]])
  789     types.dt_lua_snapshot_t.select:add_parameter("self",types.dt_lua_snapshot_t,[[The snapshot to activate]]):set_attribute("is_self",true)
  790     types.dt_lua_snapshot_t.name:set_text([[The name of the snapshot, as seen in the UI]])
  791 
  792     types.hint_t:set_text([[a hint on the way to encode a webp image]])
  793     types.dt_ui_container_t:set_text([[A place in the darktable UI where a lib can be placed]])
  794     types.snapshot_direction_t:set_text([[Which part of the main window is occupied by a snapshot]])
  795     types.dt_imageio_j2k_format_t:set_text([[J2K format type]])
  796     types.dt_imageio_j2k_preset_t:set_text([[J2K preset type]])
  797     types.comp_type_t:set_text([[Type of compression for webp]])
  798     types.lua_pref_type:set_text([[The type of value to save in a preference]])
  799 
  800 
  801   types.dt_imageio_exr_compression_t:set_text("The type of compression to use for the EXR image")
  802 
  803   types.dt_lib_collect_params_rule_t:set_text("A single rule for filtering a collection");
  804   types.dt_lib_collect_params_rule_t.mode:set_text("How this rule is applied after the previous one. Unused for the first rule");
  805   types.dt_lib_collect_params_rule_t.mode:set_reported_type(types.dt_lib_collect_mode_t)
  806   types.dt_lib_collect_params_rule_t.data:set_text("The text segment of the rule. Exact content depends on the type of rule");
  807   types.dt_lib_collect_params_rule_t.item:set_text("The item on which this rule filter. i.e the type of the rule");
  808   types.dt_lib_collect_params_rule_t.item:set_reported_type(types.dt_collection_properties_t)
  809   types.dt_lib_collect_mode_t:set_text("The logical operators to apply between rules");
  810   types.dt_collection_properties_t:set_text("The different elements on which a collection can be filtered");
  811 
  812   types.dt_lua_orientation_t:set_text("A possible orientation for a widget")
  813 
  814   types.dt_lua_align_t:set_text("The alignment of a label")
  815 
  816   types.dt_lua_ellipsize_mode_t:set_text("The ellipsize mode of a label")
  817 
  818   types.dt_lua_cairo_t:set_text("A wrapper around a cairo drawing context."..para().."You probably shouldn't use this after the callback that got it passed returned."..para().."For more details of the member functions have a look at the cairo documentation for "..url("http://www.cairographics.org/manual/cairo-cairo-t.html", "the drawing context")..", "..url("http://www.cairographics.org/manual/cairo-Transformations.html", "transformations").." and "..url("http://www.cairographics.org/manual/cairo-Paths.html", "paths")..".")
  819   types.dt_lua_cairo_t.save:set_text("Save the state of the drawing context.")
  820   types.dt_lua_cairo_t.save:set_reported_type("function")
  821   types.dt_lua_cairo_t.save:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  822   types.dt_lua_cairo_t.restore:set_text("Restore a previously saved state.")
  823   types.dt_lua_cairo_t.restore:set_reported_type("function")
  824   types.dt_lua_cairo_t.restore:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  825   types.dt_lua_cairo_t.move_to:set_text("Begin a new sub-path.")
  826   types.dt_lua_cairo_t.move_to:set_reported_type("function")
  827   types.dt_lua_cairo_t.move_to:add_parameter("self", types.dt_lua_cairo_t, "The context to modify"):set_attribute("is_self", true)
  828   types.dt_lua_cairo_t.move_to:add_parameter("x", "float", "The x coordinate of the new position.")
  829   types.dt_lua_cairo_t.move_to:add_parameter("y", "float", "The y coordinate of the new position.")
  830   types.dt_lua_cairo_t.line_to:set_text("Add a line to the path.")
  831   types.dt_lua_cairo_t.line_to:set_reported_type("function")
  832   types.dt_lua_cairo_t.line_to:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  833   types.dt_lua_cairo_t.line_to:add_parameter("x", "float", "The x coordinate of the end of the new line.")
  834   types.dt_lua_cairo_t.line_to:add_parameter("y", "float", "The y coordinate of the end of the new line.")
  835   types.dt_lua_cairo_t.rectangle:set_text("Add a closed sub-path rectangle.")
  836   types.dt_lua_cairo_t.rectangle:set_reported_type("function")
  837   types.dt_lua_cairo_t.rectangle:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  838   types.dt_lua_cairo_t.rectangle:add_parameter("x", "float", "The x coordinate of the top left corner of the rectangle.")
  839   types.dt_lua_cairo_t.rectangle:add_parameter("y", "float", "The y coordinate of the top left corner of the rectangle.")
  840   types.dt_lua_cairo_t.rectangle:add_parameter("width", "float", "The width of the rectangle.")
  841   types.dt_lua_cairo_t.rectangle:add_parameter("height", "float", "The height of the rectangle.")
  842   types.dt_lua_cairo_t.arc:set_text("Add a circular arc.")
  843   types.dt_lua_cairo_t.arc:set_reported_type("function")
  844   types.dt_lua_cairo_t.arc:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  845   types.dt_lua_cairo_t.arc:add_parameter("x", "float", "The x position of the center of the arc.")
  846   types.dt_lua_cairo_t.arc:add_parameter("y", "float", "The y position of the center of the arc.")
  847   types.dt_lua_cairo_t.arc:add_parameter("radius", "float", "The radius of the arc.")
  848   types.dt_lua_cairo_t.arc:add_parameter("angle1", "float", "The start angle, in radians.")
  849   types.dt_lua_cairo_t.arc:add_parameter("angle2", "float", "The end angle, in radians.")
  850   types.dt_lua_cairo_t.arc_negative:set_text("Add a circular arc. It only differs in the direction from "..my_tostring(types.dt_lua_cairo_t.arc)..".")
  851   types.dt_lua_cairo_t.arc_negative:set_reported_type("function")
  852   types.dt_lua_cairo_t.arc_negative:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  853   types.dt_lua_cairo_t.arc_negative:add_parameter("x", "float", "The x position of the center of the arc.")
  854   types.dt_lua_cairo_t.arc_negative:add_parameter("y", "float", "The y position of the center of the arc.")
  855   types.dt_lua_cairo_t.arc_negative:add_parameter("radius", "float", "The radius of the arc.")
  856   types.dt_lua_cairo_t.arc_negative:add_parameter("angle1", "float", "The start angle, in radians.")
  857   types.dt_lua_cairo_t.arc_negative:add_parameter("angle2", "float", "The end angle, in radians.")
  858   types.dt_lua_cairo_t.rotate:set_text("Add a rotation to the transformation matrix.")
  859   types.dt_lua_cairo_t.rotate:set_reported_type("function")
  860   types.dt_lua_cairo_t.rotate:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  861   types.dt_lua_cairo_t.rotate:add_parameter("angle", "float", "The angle (in radians) by which the user-space axes will be rotated.")
  862   types.dt_lua_cairo_t.scale:set_text("Add a scaling to the transformation matrix.")
  863   types.dt_lua_cairo_t.scale:set_reported_type("function")
  864   types.dt_lua_cairo_t.scale:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  865   types.dt_lua_cairo_t.scale:add_parameter("x", "float", "The scale factor for the x dimension.")
  866   types.dt_lua_cairo_t.scale:add_parameter("y", "float", "The scale factor for the y dimension.")
  867   types.dt_lua_cairo_t.translate:set_text("Add a translation to the transformation matrix.")
  868   types.dt_lua_cairo_t.translate:set_reported_type("function")
  869   types.dt_lua_cairo_t.translate:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  870   types.dt_lua_cairo_t.translate:add_parameter("x", "float", "Amount to translate in the x direction")
  871   types.dt_lua_cairo_t.translate:add_parameter("y", "float", "Amount to translate in the y direction")
  872   types.dt_lua_cairo_t.new_sub_path:set_text("Begin a new sub-path.")
  873   types.dt_lua_cairo_t.new_sub_path:set_reported_type("function")
  874   types.dt_lua_cairo_t.new_sub_path:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  875   types.dt_lua_cairo_t.draw_line:set_text("Helper function to draw a line with a given start and end.")
  876   types.dt_lua_cairo_t.draw_line:set_reported_type("function")
  877   types.dt_lua_cairo_t.draw_line:add_parameter("self", types.dt_lua_cairo_t, "The context to modify."):set_attribute("is_self", true)
  878   types.dt_lua_cairo_t.draw_line:add_parameter("x_start", "float", "The x coordinate of the start of the new line.")
  879   types.dt_lua_cairo_t.draw_line:add_parameter("y_start", "float", "The y coordinate of the start of the new line.")
  880   types.dt_lua_cairo_t.draw_line:add_parameter("x_end", "float", "The x coordinate of the end of the new line.")
  881   types.dt_lua_cairo_t.draw_line:add_parameter("y_end", "float", "The y coordinate of the end of the new line.")
  882 
  883 
  884   types.lua_widget:set_text("Common parent type for all lua-handled widgets");
  885   types.lua_widget.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  886   types.lua_widget.sensitive:set_text("Set if the widget is enabled/disabled");
  887   types.lua_widget.tooltip:set_text("Tooltip to display for the widget");
  888   types.lua_widget.tooltip:set_reported_type("string or nil")
  889   types.lua_widget.reset_callback:set_text("A function to call when the widget needs to reset itself"..para()..
  890   "Note that some widgets have a default implementation that can be overridden, (containers in particular will recursively reset their children). If you replace that default implementation you need to reimplement that functionality or call the original function within your callback")
  891   types.lua_widget.reset_callback:set_reported_type("function")
  892   types.lua_widget.reset_callback:add_parameter("widget",types.lua_widget,"The widget that triggered the callback")
  893   types.lua_widget.__call:set_main_parent(types.lua_widget)
  894   types.lua_widget.__call:set_text("Using a lua widget as a function Allows to set multiple attributes of that widget at once. This is mainly used to create UI elements in a more readable way"..para()..
  895       "For example:"..code([[
  896 local widget = dt.new_widget("button"){
  897     label ="my label",
  898     clicked_callback = function() print "hello world" end
  899     }]]))
  900   types.lua_widget.__call:add_parameter("attributes","table","A table of attributes => value to set")
  901   types.lua_widget.__call:add_return(types.lua_widget,"The object called itself, to allow chaining")
  902 
  903 
  904   types.lua_container:set_text("A widget containing other widgets");
  905   types.lua_container.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  906     types.lua_container["#"]:set_reported_type(types.lua_widget)
  907     types.lua_container["#"]:set_text("The widgets contained by the box"..para()..
  908       "You can append widgets by adding them at the end of the list"..para()..
  909       "You can remove widgets by setting them to nil")
  910 
  911   types.lua_check_button:set_text("A checkable button with a label next to it");
  912   types.lua_check_button.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  913   types.lua_check_button.label:set_reported_type("string")
  914   types.lua_check_button.label:set_text("The label displayed next to the button");
  915   types.lua_check_button.value:set_text("If the widget is checked or not");
  916   types.lua_check_button.clicked_callback:set_text("A function to call on button click")
  917   types.lua_check_button.clicked_callback:set_reported_type("function")
  918   types.lua_check_button.clicked_callback:add_parameter("widget",types.lua_widget,"The widget that triggered the callback")
  919 
  920   types.lua_label:set_text("A label containing some text");
  921   types.lua_label.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  922   types.lua_label.label:set_text("The label displayed");
  923   types.lua_label.selectable:set_text("True if the label content should be selectable");
  924   types.lua_label.halign:set_text("The horizontal alignment of the label");
  925   types.lua_label.halign:set_reported_type(types.dt_lua_align_t)
  926   types.lua_label.ellipsize:set_text("The ellipsize mode of the label");
  927   types.lua_label.ellipsize:set_reported_type(types.dt_lua_ellipsize_mode_t)
  928 
  929   types.lua_button:set_text("A clickable button");
  930   types.lua_button.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  931   types.lua_button.label:set_reported_type("string")
  932   types.lua_button.label:set_text("The label displayed on the button");
  933   types.lua_button.clicked_callback:set_text("A function to call on button click")
  934   types.lua_button.clicked_callback:set_reported_type("function")
  935   types.lua_button.clicked_callback:add_parameter("widget",types.lua_widget,"The widget that triggered the callback")
  936 
  937   types.lua_box:set_text("A container for widget in a horizontal or vertical list");
  938   types.lua_box.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  939   types.lua_box.orientation:set_text("The orientation of the box.")
  940   types.lua_box.orientation:set_reported_type(types.dt_lua_orientation_t)
  941 
  942   types.lua_entry:set_text("A widget in which the user can input text")
  943   types.lua_entry.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  944   types.lua_entry.text:set_text("The content of the entry")
  945   types.lua_entry.placeholder:set_reported_type("string")
  946   types.lua_entry.placeholder:set_text("The text to display when the entry is empty")
  947   types.lua_entry.is_password:set_text("True if the text content should be hidden")
  948   types.lua_entry.editable:set_text("False if the entry should be read-only")
  949 
  950   types.lua_separator:set_text("A widget providing a separation in the UI.")
  951   types.lua_separator.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  952   types.lua_separator.orientation:set_text("The orientation of the separator.")
  953 
  954   types.lua_combobox:set_text("A widget with multiple text entries in a menu"..para()..
  955       "This widget can be set as editable at construction time."..para()..
  956       "If it is editable the user can type a value and is not constrained by the values in the menu")
  957   types.lua_combobox.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  958   types.lua_combobox.value:set_reported_type("string")
  959   types.lua_combobox.value:set_text("The text content of the selected entry, can be nil"..para()..
  960       "You can set it to a number to select the corresponding entry from the menu"..para()..
  961       "If the combo box is editable, you can set it to any string"..para()..
  962       "You can set it to nil to deselect all entries")
  963   types.lua_combobox.selected:set_text("The index of the selected entry, or 0 if nothing is selected"..para()..
  964       "You can set it to a number to select the corresponding entry from the menu, or to 0 to select nothing"..para()..
  965       "You can set it to nil to deselect all entries")
  966   types.lua_combobox.selected:set_reported_type("integer")
  967   types.lua_combobox["#"]:set_text("The various menu entries."..para()..
  968       "You can add new entries by writing to the first element beyond the end"..para()..
  969       "You can removes entries by setting them to nil")
  970   types.lua_combobox["#"]:set_reported_type("string")
  971   types.lua_combobox.changed_callback:set_text("A function to call when the value field changes (character entered or value selected)")
  972   types.lua_combobox.changed_callback:set_reported_type("function")
  973   types.lua_combobox.changed_callback:add_parameter("widget",types.lua_widget,"The widget that triggered the callback")
  974   types.lua_combobox.editable:set_text("True is the user is allowed to type a string in the combobox")
  975   types.lua_combobox.label:set_text("The label displayed on the combobox");
  976 
  977   types.lua_file_chooser_button:set_text("A button that allows the user to select an existing file")
  978   types.lua_file_chooser_button.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  979   types.lua_file_chooser_button.title:set_text("The title of the window when choosing a file")
  980   types.lua_file_chooser_button.value:set_text("The currently selected file")
  981   types.lua_file_chooser_button.value:set_reported_type("string")
  982   types.lua_file_chooser_button.changed_callback:set_text("A function to call when the value field changes (character entered or value selected)")
  983   types.lua_file_chooser_button.changed_callback:set_reported_type("function")
  984   types.lua_file_chooser_button.changed_callback:add_parameter("widget",types.lua_widget,"The widget that triggered the callback")
  985   types.lua_file_chooser_button.is_directory:set_text("True if the file chooser button only allows directories to be selected")
  986 
  987   types.lua_stack:set_text("A container that will only show one of its child at a time")
  988   types.lua_stack.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  989   types.lua_stack.active:set_text("The currently selected child, can be nil if the container has no child, can be set to one of the child widget or to an index in the child table")
  990   types.lua_stack.active:set_reported_type(my_tostring(types.lua_widget).." or nil")
  991 
  992   types.lua_slider:set_text("A slider that can be set by the user")
  993   types.lua_slider.extra_registration_parameters:set_text("This widget has no extra registration parameters")
  994   types.lua_slider.soft_min:set_text("The soft minimum value for the slider, the slider can't go beyond this point")
  995   types.lua_slider.soft_max:set_text("The soft maximum value for the slider, the slider can't go beyond this point")
  996   types.lua_slider.hard_min:set_text("The hard minimum value for the slider, the user can't manually enter a value beyond this point")
  997   types.lua_slider.hard_max:set_text("The hard maximum value for the slider, the user can't manually enter a value beyond this point")
  998   types.lua_slider.step:set_text("The step width of the slider")
  999   types.lua_slider.digits:set_text("The number of decimal digits shown on the slider")
 1000   types.lua_slider.digits:set_reported_type("integer")
 1001   types.lua_slider.value:set_text("The current value of the slider")
 1002   types.lua_slider.label:set_text("The label next to the slider")
 1003   types.lua_slider.label:set_reported_type("string")
 1004 
 1005   types.lua_text_view:set_text("A multiline text input widget")
 1006   types.lua_text_view.extra_registration_parameters:set_text("This widget has no extra registration parameters")
 1007   types.lua_text_view.text:set_text("The text in the widget")
 1008   types.lua_text_view.editable:set_text("False if the entry should be read-only")
 1009 
 1010   types.lua_section_label:set_text("A section label");
 1011   types.lua_section_label.extra_registration_parameters:set_text("This widget has no extra registration parameters")
 1012   types.lua_section_label.label:set_text("The section name");
 1013 
 1014     ----------------------
 1015     --  EVENTS          --
 1016     ----------------------
 1017     events:set_text([[This section documents events that can be used to trigger Lua callbacks.]])
 1018 
 1019 
 1020     events["intermediate-export-image"]:set_text([[This event is called each time an image is exported, once for each image after the image has been processed to an image format but before the storage has moved the image to its final destination. The call is blocking.]])
 1021     events["intermediate-export-image"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1022     events["intermediate-export-image"].callback:add_parameter("image",types.dt_lua_image_t,[[The image object that has been exported.]])
 1023     events["intermediate-export-image"].callback:add_parameter("filename","string",[[The name of the file that is the result of the image being processed.]])
 1024     events["intermediate-export-image"].callback:add_parameter("format",types.dt_imageio_module_format_t,[[The format used to export the image.]])
 1025     events["intermediate-export-image"].callback:add_parameter("storage",types.dt_imageio_module_storage_t,[[The storage used to export the image (can be nil).]])
 1026     events["intermediate-export-image"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1027 
 1028 
 1029     events["post-import-image"]:set_text([[This event is triggered whenever a new image is imported into the database.
 1030 
 1031     This event can be registered multiple times, all callbacks will be called. The call is blocking.]])
 1032     events["post-import-image"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1033     events["post-import-image"].callback:add_parameter("image",types.dt_lua_image_t,[[The image object that has been imported.]])
 1034     events["post-import-image"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1035 
 1036 
 1037     events["shortcut"]:set_text([[This event registers a new keyboard shortcut. The shortcut isn't bound to any key until the users does so in the preference panel.
 1038 
 1039     The event is triggered whenever the shortcut is triggered.
 1040 
 1041 
 1042     This event can only be registered once per value of shortcut.
 1043     ]])
 1044     events["shortcut"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1045 
 1046     events["shortcut"].callback:add_parameter("shortcut","string",[[The tooltip string that was given at registration time.]])
 1047     events["shortcut"].extra_registration_parameters:set_text("")
 1048     events["shortcut"].extra_registration_parameters:add_parameter("tooltip","string",[[The string that will be displayed on the shortcut preference panel describing the shortcut.]])
 1049 
 1050 
 1051 
 1052     events["post-import-film"]:set_text([[This event is triggered when an film import is finished (all post-import-image callbacks have already been triggered). This event can be registered multiple times.
 1053     ]])
 1054     events["post-import-film"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1055 
 1056     events["post-import-film"].callback:add_parameter("film",types.dt_lua_film_t,[[The new film that has been added. If multiple films were added recursively only the top level film is reported.]])
 1057     events["post-import-film"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1058 
 1059     events["view-changed"]:set_text([[This event is triggered after the user changed the active view]])
 1060     events["view-changed"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1061     events["view-changed"].callback:add_parameter("old_view",types.dt_lua_view_t,[[The view that we just left]])
 1062     events["view-changed"].callback:add_parameter("new_view",types.dt_lua_view_t,[[The view we are now in]])
 1063     events["view-changed"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1064 
 1065     events["global_toolbox-grouping_toggle"]:set_text([[This event is triggered after the user toggled the grouping button.]])
 1066     events["global_toolbox-grouping_toggle"].callback:add_parameter("toggle", "boolean", [[the new grouping status.]]);
 1067     events["global_toolbox-grouping_toggle"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1068     events["global_toolbox-overlay_toggle"]:set_text([[This event is triggered after the user toggled the overlay button.]])
 1069     events["global_toolbox-overlay_toggle"].callback:add_parameter("toggle", "boolean", [[the new overlay status.]]);
 1070     events["global_toolbox-overlay_toggle"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1071 
 1072   events["mouse-over-image-changed"]:set_text([[This event is triggered whenever the image under the mouse changes]])
 1073     events["mouse-over-image-changed"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1074   events["mouse-over-image-changed"].callback:add_parameter("image",types.dt_lua_image_t,[[The new image under the mouse, can be nil if there is no image under the mouse]])
 1075     events["mouse-over-image-changed"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1076   events["exit"]:set_text([[This event is triggered when darktable exits, it allows lua scripts to do cleanup jobs]])
 1077     events["exit"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1078 
 1079   events["pre-import"]:set_text("This event is trigger before any import action");
 1080     events["pre-import"].callback:add_parameter("event","string",[[The name of the event that triggered the callback.]])
 1081     events["pre-import"].callback:add_parameter("images","table of string",[[The files that will be imported. Modifying this table will change the list of files that will be imported"]])
 1082     events["pre-import"].extra_registration_parameters:set_text([[This event has no extra registration parameters.]])
 1083     ----------------------
 1084     --  ATTRIBUTES      --
 1085     ----------------------
 1086     function invisible_attr(attr)
 1087         attr:set_skiped()
 1088         attr:set_attribute("internal_attr",true);
 1089     end
 1090     attributes:set_text([[This section documents various attributes used throughout the documentation.]])
 1091     invisible_attr(attributes.ret_val)
 1092     invisible_attr(attributes.signature)
 1093     invisible_attr(attributes.reported_type)
 1094     invisible_attr(attributes.is_singleton)
 1095     invisible_attr(attributes.optional)
 1096     invisible_attr(attributes.skiped)
 1097     invisible_attr(attributes.is_attribute)
 1098     invisible_attr(attributes.internal_attr)
 1099     invisible_attr(attributes.read)
 1100     invisible_attr(attributes.has_pairs)
 1101     invisible_attr(attributes.is_self)
 1102     invisible_attr(attributes.has_length)
 1103     attributes.write:set_text([[This object is a variable that can be written to.]])
 1104   --attributes.has_pairs:set_text([[This object can be used as an argument to the system function "pairs" and iterated upon.]])
 1105     --attributes.has_equal:set_text([[This object has a specific comparison function that will be used when comparing it to an object of the same type.]])
 1106     --attributes.has_length:set_text([[This object has a specific length function that will be used by the # operator.]])
 1107     attributes.has_tostring:set_text([[This object has a specific reimplementation of the "tostring" method that allows pretty-printing it.]])
 1108     attributes.implicit_yield:set_text([[This call will release the Lua lock while executing, thus allowing other Lua callbacks to run.]])
 1109     attributes.parent:set_text([[This object inherits some methods from another object. You can call the methods from the parent on the child object]])
 1110     --attributes.views:set_skiped();
 1111     --attributes.position:set_skiped();
 1112     --attributes.container:set_skiped();
 1113     attributes.values:set_skiped();
 1114 
 1115 --
 1116 -- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua