5/17/2023 0 Comments Darktable shortcut keysWe simply test these results and print them to the console. If there is an exception it will return false and the error message of the exception. cell injury pathology notes ceh v11 practical github game dogs for sale mayday cgp ks3 science pdf free download what does unboil mean on boiler clicker heroes save. If there is no exception it will return true plus any result returned by the function. Pcall will run its first argument and catch any exception thrown by it. It would be trivial to add a check, but let’s go the complicated way and catch the error instead: darktable.register_event("shortcut",function(event,shortcut)ĭarktable.print_error("could not increase rating of image ". We have attempted to set a rating of 6 to an image, but a rating can only go as high as 5. If you select an image and press your shortcut a couple of times, it will work correctly at first but when you have reached five stars, darktable will start showing the following error on the console: This function makes it easy to follow darktable’s UI logic in lua. darktable will act on selected images if any image is selected, and on the image under the mouse if no image is selected. Image.rating is a field that gives the star rating of any image (between 0 and 5 stars, -1 means rejected).ĭ_images is a table containing all the images of interest. ![]() Instead of declaring a function and referencing it, we declare it directly in the call to darktable.register_event this is strictly equivalent but slightly more compact. ![]() Local images = _imagesĪt this point, most of this code should be self explanatory. This one will look at the images the user is currently interested in (selected or moused-over) and increase their rating: darktable = require "darktable"ĭarktable.register_event("shortcut",function(event,shortcut) Let’s try a shortcut that is a little more interactive. We tell it that we are registering a shortcut event, then we give the callback to call and finally, we give the string to use to describe the shortcut in the preferences window. To do that we call darktable.register_event which is a generic function for all types of events. Once that function is defined, we register it as a shortcut callback. The function itself calls darktable.print, which will print the message as an overlay in the main window. The first one is the type of event triggered (“shortcut”) and the second is the name of the shortcut (“A shortcut that prints its parameters”). We first define a function that takes two strings as input parameters. You should see a nice message printed on the screen. Now start darktable, go to “preferences > shortcuts > lua > A shortcut that prints its parameters”, assign a shortcut and try it. Local function hello_shortcut(event, shortcut)ĭarktable.print("Hello, I just received '".event.ĭarktable.register_event("shortcut",hello_shortcut, ![]() The most common event to react to is a keyboard shortcut. To do more advanced things we need to register a function that will be called on a given event. This is of limited use and doesn’t allow us to react to real user actions. So far, all our scripts have done things during startup.
0 Comments
Leave a Reply. |