39 Commits

Author SHA1 Message Date
wpferguson
025f4299ea Merge pull request #435 from ddittmar/feature/select_non_existing
select non-existing images
2023-11-10 18:42:01 -05:00
ddittmar
dc50d40886 select non-existing images 2023-10-28 11:14:51 +02:00
wpferguson
867c49b1b9 Merge pull request #433 from wpferguson/script_manager_quote_fix
tools/script_manager - fixed quote
2023-10-17 16:04:42 -04:00
Bill Ferguson
13f02c95ea tools/script_manager - fixed quote with a " instead of s 2023-10-17 16:02:27 -04:00
wpferguson
d55dae73f0 Merge pull request #431 from wpferguson/script_manager_username_space_fix
Fix script_manager doesn't start on windows when username has a space
2023-10-16 22:44:10 -04:00
Bill Ferguson
34b9831472 tools/script_manager.lua - wrapped the scipt_dir in quotes to handle
the space in username problem on windows.
2023-10-16 22:41:12 -04:00
wpferguson
014a0fc1c9 Merge pull request #430 from wpferguson/explicitly_set_false
Explicitly set non running scriopts to FALSE
2023-09-20 13:54:02 -04:00
Bill Ferguson
bf17dccd69 tools/script_manager.lua - Explicitly set non running scriopts to FALSE
instead of relying on no value being intrepreted
                           as false.
2023-09-20 13:48:18 -04:00
wpferguson
890168d0d0 Merge pull request #426 from wpferguson/425_fix_executable_manager_not_appearing
Change window position of executable_manager and script_manager
2023-08-18 12:27:28 -04:00
Bill Ferguson
191aecacdf tools - Moved script_manager to bottom of lower left panel and
moved executable_manager to middle of lower left panel
        to work around windows GTK window placement error.
2023-08-18 12:23:24 -04:00
wpferguson
44ec01b136 Merge pull request #424 from wpferguson/fix_check_for_updates_comment
official/check_for_updates - updated instructions for additional modules
2023-07-17 17:41:10 -04:00
Bill Ferguson
a177da2040 official/check_for_updates = updated instructions for additional modules
required
2023-07-17 17:39:24 -04:00
wpferguson
c899040688 Merge pull request #423 from wpferguson/update_flatpak_readme
README.md - updated (fixed typos) echo commands to build luarc file
2023-07-16 13:24:56 -04:00
Bill Ferguson
e8af665b3c README.md - updated (fixed typos) echo commands to build luarc file 2023-07-16 13:22:06 -04:00
wpferguson
875734d455 Merge pull request #422 from wpferguson/fix_script_data_show
Fix script data show
2023-07-16 13:08:05 -04:00
Bill Ferguson
14d5a79db2 Added script_data.show to script_data blocks 2023-07-16 13:04:00 -04:00
Bill Ferguson
e1b2715ee9 contrib/gpx_export - added show function to script_data to fix #418 and #419. 2023-07-16 12:50:28 -04:00
wpferguson
7ecd5ca55d Merge pull request #421 from wpferguson/script_manager_updates
Script manager updates
2023-07-15 20:00:24 -04:00
wpferguson
931e7a4d37 Merge pull request #416 from wpferguson/check_max_api_version
Add check for max api version
2023-07-15 19:58:57 -04:00
Bill Ferguson
1792410efe lib/dtutils.lua - corrected test 2023-07-15 19:52:39 -04:00
wpferguson
8cbd9224f1 Merge pull request #377 from spaceChRiS/filter_manager_tooltip
Added tooltip to filter manager to better match new import scheme.
2023-07-14 17:40:10 -04:00
Bill Ferguson
24b552d619 lib/dtutils.lua - fix typo from testing 2023-07-12 13:18:01 -04:00
Bill Ferguson
68ae9326bf tools/script_manager.lua - added translation to preference setting 2023-07-12 12:37:14 -04:00
Bill Ferguson
b4626f2787 lib/dtutils.lua - changed log message to error on fail to load. Added
printing of the returned error.
2023-07-04 15:57:12 -04:00
Bill Ferguson
2fc8ed78e4 tools/script_manager.lua - added check to ensure script_data.show() runction
was passed as part of the script_data table
                           before trying to use it. Fixes #418.
2023-07-03 23:44:13 -04:00
Bill Ferguson
236b25a235 tools/script_manager.lua - clean up formatting and documentation 2023-07-03 23:42:47 -04:00
Bill Ferguson
a4f6af73ec tools/script_manager.lua - enabled log levels in callback routines 2023-06-24 19:56:51 -04:00
Bill Ferguson
fad74d6438 tools/script_manager.lua - cleaned up deactivate comments 2023-06-23 19:09:57 -04:00
Bill Ferguson
3e2d4c956d tools/script_manager.lua - Documented more fields for the sm.scripts table
Removed extra declaration of check_update preference
2023-06-22 16:04:26 -04:00
wpferguson
cd1d623390 Merge pull request #409 from dterrahe/x_touch_mimic
example slider mimic script for x-touch mini
2023-05-30 18:38:48 -04:00
Bill Ferguson
9e0374d597 lib/dtutils.lua - fix typos 2023-05-06 14:56:58 -04:00
Bill Ferguson
e47672b495 lib/dtutils.lua - added delay in check_min_api_version to sllow display of the error
message before script_manager displays an error message.
2023-05-06 14:36:22 -04:00
Bill Ferguson
1905be8577 lib/dtutils.lua - added check_max_api_version to handle the case where part of
the API is removed as in the case of the darktable.gui.libs.fixter functions.
2023-05-06 14:31:15 -04:00
dterrahe
4726821e7d Fix 8th knob 2023-05-05 23:19:00 +01:00
dterrahe
7ac37ddc1a Probe individual mask sliders 2023-05-03 23:43:01 +01:00
dterrahe
3889742e06 add x-touch mini script documentation 2023-03-25 18:49:55 +00:00
dterrahe
6bf3706455 add x-touch color calibration customisation 2023-03-25 18:14:19 +00:00
dterrahe
8e412c3eb3 example slider mimic script for x-touch mini 2023-03-25 10:59:19 -04:00
Christian Mandel
3070ca0bc4 Added tooltip to filter manager to better match new import scheme. 2022-01-09 15:46:29 +01:00
52 changed files with 443 additions and 33 deletions

View File

@@ -66,6 +66,7 @@ change_group_leader|Yes|LMW|Change which image leads group
[rename_images](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename_images)|Yes|LMW|Rename single or multiple images [rename_images](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename_images)|Yes|LMW|Rename single or multiple images
[rename-tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename-tags)|Yes|LMW|Change a tag name [rename-tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rename-tags)|Yes|LMW|Change a tag name
[RL_out_sharp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rl_out_sharp)|No|LW|Output sharpening using GMic (Richardson-Lucy algorithm) [RL_out_sharp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rl_out_sharp)|No|LW|Output sharpening using GMic (Richardson-Lucy algorithm)
[select_non_existing](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/select_non_existing)|Yes|LMW|Enable selection of non-existing images in the the currently worked on images
[select_untagged](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/select_untagged)|Yes|LMW|Enable selection of untagged images [select_untagged](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/select_untagged)|Yes|LMW|Enable selection of untagged images
[slideshowMusic](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/slideshowMusic)|No|L|Play music during a slideshow [slideshowMusic](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/slideshowMusic)|No|L|Play music during a slideshow
[transfer_hierarchy](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/transfer_hierarchy)|Yes|LMW|Image move/copy preserving directory hierarchy [transfer_hierarchy](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/transfer_hierarchy)|Yes|LMW|Image move/copy preserving directory hierarchy
@@ -174,7 +175,7 @@ The recommended way to enable and disable specific scripts is using the script m
### Windows ### Windows
echo "require 'tools/script_manager'" > %LOCALAPPDATA%\darktable\luarc echo require "tools/script_manager" > %LOCALAPPDATA%\darktable\luarc
### Snap ### Snap
@@ -182,7 +183,7 @@ The recommended way to enable and disable specific scripts is using the script m
### Flatpak ### Flatpak
echo require "tools/script_manager"' > ~/.var/app/org.darktable.Darktable/config/darktable/luarc echo 'require "tools/script_manager"' > ~/.var/app/org.darktable.Darktable/config/darktable/luarc
You can also create or add lines to the luarc file from the command line: You can also create or add lines to the luarc file from the command line:

View File

@@ -50,6 +50,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext local gettext = dt.gettext
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
@@ -215,4 +216,4 @@ script_data.destroy_method = "hide"
script_data.restart = restart script_data.restart = restart
script_data.show = restart script_data.show = restart
return script_data return script_data

View File

@@ -63,6 +63,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local function _(msgid) local function _(msgid)
return gettext.dgettext("CollectHelper", msgid) return gettext.dgettext("CollectHelper", msgid)

View File

@@ -58,6 +58,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local mod = 'module_HDRMerge' local mod = 'module_HDRMerge'

View File

@@ -59,6 +59,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Lua 5.3 no longer has "unpack" but "table.unpack" -- Lua 5.3 no longer has "unpack" but "table.unpack"
unpack = unpack or table.unpack unpack = unpack or table.unpack

View File

@@ -63,6 +63,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("OpenInExplorer",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("OpenInExplorer",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -72,6 +72,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- OS compatibility -- OS compatibility
local PS = dt.configuration.running_os == "windows" and "\\" or "/" local PS = dt.configuration.running_os == "windows" and "\\" or "/"

View File

@@ -49,6 +49,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- run command and retrieve stdout -- run command and retrieve stdout
local function get_stdout(cmd) local function get_stdout(cmd)

View File

@@ -49,6 +49,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain(MODULE, dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain(MODULE, dt.configuration.config_dir.."/lua/locale/")

View File

@@ -46,6 +46,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext local gettext = dt.gettext

View File

@@ -51,6 +51,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("copy_attach_detach_tags",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("copy_attach_detach_tags",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -44,6 +44,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local queue = {} local queue = {}
local processed_files = {} local processed_files = {}

View File

@@ -74,6 +74,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
local gettext = dt.gettext local gettext = dt.gettext

View File

@@ -40,6 +40,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local gettext = dt.gettext local gettext = dt.gettext

View File

@@ -82,6 +82,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- OS compatibility -- OS compatibility
local PS = dt.configuration.running_os == "windows" and "\\" or "/" local PS = dt.configuration.running_os == "windows" and "\\" or "/"

View File

@@ -61,6 +61,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- namespace -- namespace

View File

@@ -70,6 +70,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local function detect_dynamic_range(event, image) local function detect_dynamic_range(event, image)
if image.exif_maker ~= "FUJIFILM" then if image.exif_maker ~= "FUJIFILM" then

View File

@@ -37,6 +37,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir.."/lua/locale/")

View File

@@ -46,6 +46,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -39,6 +39,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoToolbox",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("geoToolbox",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -81,6 +81,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gimp",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("gimp",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -36,6 +36,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gpx_export",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("gpx_export",dt.configuration.config_dir.."/lua/locale/")
@@ -203,5 +204,6 @@ end
script_data.destroy = destroy script_data.destroy = destroy
script_data.restart = restart script_data.restart = restart
script_data.destroy_method = "hide" script_data.destroy_method = "hide"
script_data.show = restart
return script_data return script_data

View File

@@ -63,6 +63,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("hugin",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("hugin",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -80,6 +80,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("image_stack",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("image_stack",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -122,6 +122,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain

View File

@@ -52,6 +52,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -65,6 +65,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
dt.preferences.register dt.preferences.register
("pdf_slideshow","open with","string", ("pdf_slideshow","open with","string",

View File

@@ -51,6 +51,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local PS = dt.configuration.running_os == "windows" and "\\" or "/" local PS = dt.configuration.running_os == "windows" and "\\" or "/"

View File

@@ -51,6 +51,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local function apply_rating(rating) local function apply_rating(rating)
local images = dt.gui.action_images local images = dt.gui.action_images

View File

@@ -43,6 +43,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local rt = {} local rt = {}
rt.module_installed = false rt.module_installed = false

View File

@@ -75,6 +75,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -

View File

@@ -0,0 +1,77 @@
--[[
This file is part of darktable,
copyright (c) 2023 Dirk Dittmar
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
Enable selection of non-existing images in the the currently worked on images, e.g. the ones selected by the collection module.
]]
local dt = require "darktable"
local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
-- module name
local MODULE = "select_non_existing"
du.check_min_api_version("9.1.0", MODULE)
-- figure out the path separator
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
local gettext = dt.gettext
gettext.bindtextdomain(MODULE, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
local function _(msgid)
return gettext.dgettext(MODULE, msgid)
end
local function stop_job(job)
job.valid = false
end
local function select_nonexisting_images(event, images)
local selection = {}
local job = dt.gui.create_job(_("select non existing images"), true, stop_job)
for key,image in ipairs(images) do
if(job.valid) then
job.percent = (key - 1)/#images
local filepath = image.path..PS..image.filename
local file_exists = df.test_file(filepath, "e")
dt.print_log(filepath.." exists? => "..tostring(file_exists))
if (not file_exists) then
table.insert(selection, image)
end
else
break
end
end
stop_job(job)
return selection
end
local function destroy()
dt.gui.libs.select.destroy_selection(MODULE)
end
dt.gui.libs.select.register_selection(
MODULE,
_("select non existing"),
select_nonexisting_images,
_("select all non-existing images in the current images"))
local script_data = {}
script_data.destroy = destroy
return script_data

View File

@@ -31,6 +31,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -38,6 +38,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("slideshowMusic",dt.configuration.config_dir.."/lua/locale/") gettext.bindtextdomain("slideshowMusic",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -87,6 +87,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local MKDIR_COMMAND = darktable.configuration.running_os == "windows" and "mkdir " or "mkdir -p " local MKDIR_COMMAND = darktable.configuration.running_os == "windows" and "mkdir " or "mkdir -p "
local PATH_SEPARATOR = darktable.configuration.running_os == "windows" and "\\\\" or "/" local PATH_SEPARATOR = darktable.configuration.running_os == "windows" and "\\\\" or "/"

View File

@@ -48,6 +48,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local MODULE_NAME = "video_ffmpeg" local MODULE_NAME = "video_ffmpeg"

View File

@@ -42,6 +42,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- translation -- translation

150
examples/x-touch.lua Normal file
View File

@@ -0,0 +1,150 @@
--[[
This file is part of darktable,
copyright (c) 2023 Diederik ter Rahe
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
X-Touch Mini flexible encoder shortcuts
This script will create virtual sliders that are mapped dynamically to
the most relevant sliders for the currently focused processing module.
Tailored modules are color zones, tone equalizer, color calibration and
mask manager properties. The script can easily be amended for other
devices or personal preferences. Virtual "toggle" buttons can be created
as well, that dynamically change meaning depending on current status.
USAGE
* require this script from your main lua file
* restart darktable
* create shortcuts for each of the encoders on the x-touch mini
to a virtual slider under lua/x-touch
or import the following shortcutsrc file in the shortcuts dialog/preferences tab:
None;midi:CC1=lua/x-touch/knob 1
None;midi:CC2=lua/x-touch/knob 2
None;midi:CC3=lua/x-touch/knob 3
None;midi:CC4=lua/x-touch/knob 4
None;midi:CC5=lua/x-touch/knob 5
None;midi:CC6=lua/x-touch/knob 6
None;midi:CC7=lua/x-touch/knob 7
None;midi:CC8=lua/x-touch/knob 8
midi:E0=global/modifiers
midi:F0=global/modifiers;ctrl
midi:F#0=global/modifiers;alt
midi:G#-1=iop/blend/tools/show and edit mask elements
midi:A-1=iop/colorzones;focus
midi:A#-1=iop/toneequal;focus
midi:B-1=iop/colorbalancergb;focus
midi:C0=iop/channelmixerrgb;focus
]]
local dt = require "darktable"
local du = require "lib/dtutils"
du.check_min_api_version("9.1.0", "x-touch")
-- set up 8 mimic sliders with the same function
for k = 1,8 do
dt.gui.mimic("slider", "knob ".. k,
function(action, element, effect, size)
-- take the number from the mimic name
local k = tonumber(action:sub(-1))
-- only operate in darkroom; return NAN otherwise
if dt.gui.current_view() ~= dt.gui.views.darkroom then
return 0/0
end
local maskval = 0/0
if k < 8 then
-- first try if the mask slider at that position is active
local s = { "opacity",
"size",
"feather",
"hardness",
"rotation",
"curvature",
"compression" }
maskval = dt.gui.action("lib/masks/properties/" .. s[k],
element, effect, size)
end
-- if a value different from NAN is returned, the slider was active
if maskval == maskval then
return maskval
-- try if colorzones module is focused; if so select element of graph
elseif dt.gui.action("iop/colorzones", "focus") ~= 0 then
which = "iop/colorzones/graph"
local e = { "red",
"orange",
"yellow",
"green",
"aqua",
"blue",
"purple",
"magenta" }
element = e[k]
-- if the tone equalizer is focused,
-- select one of the sliders in the "simple" tab
elseif dt.gui.action("iop/toneequal", "focus") ~= 0 then
which ="iop/toneequal/simple/"..(k-9).." EV"
-- if color calibration is focused,
-- the last 4 knobs are sent there
elseif dt.gui.action("iop/channelmixerrgb", "focus") ~= 0
and k >= 5 then
-- knob 5 selects the active tab; pressing it resets to CAT
if k == 5 then
which = "iop/channelmixerrgb/page"
element = "CAT"
-- since the tab action is not a slider,
-- the effects need to be translated
if effect == "up" then effect = "next"
elseif effect == "down" then effect = "previous"
else effect = "activate"
end
else
-- knobs 6, 7 and 8 are for the three color sliders on each tab
which = "iop/focus/sliders"
local e = { "1st",
"2nd",
"3rd" }
element = e[k - 5]
end
-- the 4th knob is contrast;
-- either colorbalance if it is focused, or filmic
elseif dt.gui.action("iop/colorbalancergb", "focus") ~= 0
and k == 4 then
which = "iop/colorbalancergb/contrast"
-- in all other cases use a default selection
else
local s = { "iop/exposure/exposure",
"iop/filmicrgb/white relative exposure",
"iop/filmicrgb/black relative exposure",
"iop/filmicrgb/contrast",
"iop/crop/left",
"iop/crop/right",
"iop/crop/top",
"iop/crop/bottom" }
which = s[k]
end
-- now pass the element/effect/size to the selected slider
return dt.gui.action(which, element, effect, size)
end)
end

View File

@@ -65,10 +65,47 @@ function dtutils.check_min_api_version(min_api, script_name)
dt.print_error("This application is written for lua api version " .. min_api .. " or later.") dt.print_error("This application is written for lua api version " .. min_api .. " or later.")
dt.print_error("The current lua api version is " .. current_api) dt.print_error("The current lua api version is " .. current_api)
dt.print("ERROR: " .. script_name .. " failed to load. Lua API version " .. min_api .. " or later required.") dt.print("ERROR: " .. script_name .. " failed to load. Lua API version " .. min_api .. " or later required.")
dt.control.sleep(2000) -- allow time for the error to display before script_manager writes it's error message
error("Minimum API " .. min_api .. " not met for " .. script_name .. ".", 0) error("Minimum API " .. min_api .. " not met for " .. script_name .. ".", 0)
end end
end end
dtutils.libdoc.functions["check_max_api_version"] = {
Name = [[check_max_api_version]],
Synopsis = [[check the maximum required api version against the current api version]],
Usage = [[local du = require "lib/dtutils"
local result = du.check_max_api_version(max_api, script_name)
max_api - string - the api version that the application was written for (example: "5.0.0")
script_name - string - the name of the script]],
Description = [[check_max_api_version compares the maximum api required for the appllication to
run against the current api version. This function is used when a part of the Lua API that
the script relies on is removed. If the maximum api version is not met, then an
error message is printed saying the script_name failed to load, then an error is thrown causing the
program to stop executing.
Return_Value = [[result - true if the maximum api version is available, false if not.]],
Limitations = [[When using the default handler on a script being executed from the luarc file, the error thrown
will stop the luarc file from executing any remaining statements. This limitation does not apply to script_manger.]],
Example = [[check_max_api_version("9.0.0") does nothing if the api is less than or equal to 9.0.0 otherwise an
error message is printed and an error is thrown stopping execution of the script.]],
See_Also = [[]],
Reference = [[]],
License = [[]],
Copyright = [[]],
}
function dtutils.check_max_api_version(max_api, script_name)
local current_api = dt.configuration.api_version_string
if current_api > max_api then
dt.print_error("This application is written for lua api version " .. max_api .. " or earlier.")
dt.print_error("The current lua api version is " .. current_api)
dt.print("ERROR: " .. script_name .. " failed to load. Lua API version " .. max_api .. " or earlier required.")
dt.control.sleep(2000) -- allow time for the error to display before script_manager writes it's error message
error("Maximum API " .. max_api .. " not met for " .. script_name .. ".", 0)
end
end
dtutils.libdoc.functions["split"] = { dtutils.libdoc.functions["split"] = {
Name = [[split]], Name = [[split]],
Synopsis = [[split a string on a specified separator]], Synopsis = [[split a string on a specified separator]],
@@ -184,7 +221,8 @@ function dtutils.prequire(req_name)
if status then if status then
log.msg(log.info, "Loaded " .. req_name) log.msg(log.info, "Loaded " .. req_name)
else else
log.msg(log.info, "Error loading " .. req_name) log.msg(log.error, "Error loading " .. req_name)
log.msg(log.error, "Error returned is " .. lib)
end end
return status, lib return status, lib
end end

View File

@@ -0,0 +1,12 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
msgid "select non existing images"
msgstr "nicht vorhandene Bilder auswählen"
msgid "select non existing"
msgstr "nicht vorhandene auswählen"
msgid "select all non-existing images in the current images"
msgstr "alle nicht vorhandenen Bilder in den aktuellen Bildern auswählen"

View File

@@ -21,7 +21,7 @@ a simple script that will automatically look for newer releases on github and in
when there is something. it will only check on startup and only once a week. when there is something. it will only check on startup and only once a week.
USAGE USAGE
* install luasec and cjson for Lua 5.2 on your system * install luasec and cjson for Lua 5.4 on your system
* require this script from your main lua file * require this script from your main lua file
* restart darktable * restart darktable
@@ -41,6 +41,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- compare two version strings of the form "major.minor.patch" -- compare two version strings of the form "major.minor.patch"
-- returns -1, 0, 1 if the first version is smaller, equal, greater than the second version, -- returns -1, 0, 1 if the first version is smaller, equal, greater than the second version,

View File

@@ -38,6 +38,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- set this to "false" if you don't want to overwrite metadata fields -- set this to "false" if you don't want to overwrite metadata fields
-- (title, description, creator, publisher and rights) that are already set -- (title, description, creator, publisher and rights) that are already set

View File

@@ -40,6 +40,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
dt.preferences.register("delete_long_tags", "length", "integer", dt.preferences.register("delete_long_tags", "length", "integer",
"maximum length of tags to keep", "maximum length of tags to keep",

View File

@@ -44,6 +44,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- deleting while iterating the tags list seems to break the iterator! -- deleting while iterating the tags list seems to break the iterator!
local unused_tags = {} local unused_tags = {}

View File

@@ -50,6 +50,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
-- Tell gettext where to find the .mo file translating messages for a particular domain -- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("enfuse",dt.configuration.config_dir..PS .. "lua" .. PS .. "locale" .. PS) gettext.bindtextdomain("enfuse",dt.configuration.config_dir..PS .. "lua" .. PS .. "locale" .. PS)

View File

@@ -47,6 +47,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
dt.preferences.register("generate_image_txt", dt.preferences.register("generate_image_txt",
"enabled", "enabled",

View File

@@ -40,6 +40,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local ipiu = {} local ipiu = {}
ipiu.module_installed = false ipiu.module_installed = false

View File

@@ -45,6 +45,7 @@ local filter_dropdown = dt.new_widget("combobox")
{ {
label = "import filter", label = "import filter",
editable = false, editable = false,
tooltip = "import filters are applied after completion of the import dialog",
changed_callback = function(widget) changed_callback = function(widget)
dt.preferences.write("import_filter_manager", "active_filter", "string", widget.value) dt.preferences.write("import_filter_manager", "active_filter", "string", widget.value)

View File

@@ -45,6 +45,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local buffer_count = 5 local buffer_count = 5

View File

@@ -45,6 +45,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
dt.preferences.register dt.preferences.register
("selection_to_pdf","Open with","string", ("selection_to_pdf","Open with","string",

View File

@@ -41,6 +41,7 @@ local script_data = {}
script_data.destroy = nil -- function to destory the script script_data.destroy = nil -- function to destory the script
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
script_data.show = nil -- only required for libs since the destroy_method only hides them
local PS = dt.configuration.running_os == "windows" and "\\" or "/" local PS = dt.configuration.running_os == "windows" and "\\" or "/"
@@ -105,7 +106,7 @@ local function install_module()
"executable manager", -- Visible name "executable manager", -- Visible name
true, -- expandable true, -- expandable
false, -- resetable false, -- resetable
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_BOTTOM", 100}}, -- containers {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_BOTTOM", 600}}, -- containers
dt.new_widget("box") -- widget dt.new_widget("box") -- widget
{ {
orientation = "vertical", orientation = "vertical",

View File

@@ -1,6 +1,6 @@
--[[ --[[
This file is part of darktable, This file is part of darktable,
copyright (c) 2018, 2020 Bill Ferguson <wpferguson@gmail.com> copyright (c) 2018, 2020, 2023 Bill Ferguson <wpferguson@gmail.com>
darktable is free software: you can redistribute it and/or modify darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -98,19 +98,8 @@ local LUA_API_VER = "API-" .. dt.configuration.api_version_string
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
dt.preferences.register(MODULE, "check_update", "bool", dt.preferences.register(MODULE, "check_update", "bool",
"check for updated scripts on start up", _("check for updated scripts on start up"),
"automatically update scripts to correct version", _("automatically update scripts to correct version"),
true)
local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool")
-- - - - - - - - - - - - - - - - - - - - - - - -
-- P R E F E R E N C E S
-- - - - - - - - - - - - - - - - - - - - - - - -
dt.preferences.register(MODULE, "check_update", "bool",
"check for updated scripts on start up",
"automatically update scripts to correct version",
true) true)
local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool") local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool")
@@ -141,6 +130,10 @@ sm.event_registered = false
sm.widgets = {} sm.widgets = {}
sm.categories = {} sm.categories = {}
-- set log level for functions
sm.log_level = DEFAULT_LOG_LEVEL
--[[ --[[
sm.scripts is a table of tables for containing the scripts sm.scripts is a table of tables for containing the scripts
@@ -170,6 +163,8 @@ sm.categories = {}
storage_name name of the exporter (in the exporter storage menu) storage_name name of the exporter (in the exporter storage menu)
has_action true if it creates an action has_action true if it creates an action
action_name name on the button action_name name on the button
has_select true if it creates a select
select_name name on the button
has_event true if it creates an event handler has_event true if it creates an event handler
event_type type of event, shortcut, post-xxx, pre-xxx event_type type of event, shortcut, post-xxx, pre-xxx
callback name of the callback routine callback name of the callback routine
@@ -201,22 +196,42 @@ sm.run = false
-- F U N C T I O N S -- F U N C T I O N S
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
-------------------
-- helper functions
-------------------
local function set_log_level(level)
local old_log_level = log.log_level()
log.log_level(level)
return old_log_level
end
local function restore_log_level(level)
log.log_level(level)
end
local function pref_read(name, pref_type) local function pref_read(name, pref_type)
local old_log_level = set_log_level(sm.log_level)
log.msg(log.debug, "name is " .. name .. " and type is " .. pref_type) log.msg(log.debug, "name is " .. name .. " and type is " .. pref_type)
local val = dt.preferences.read(MODULE, name, pref_type) local val = dt.preferences.read(MODULE, name, pref_type)
if not string.match(pref_type, "bool") then log.msg(log.debug, "read value " .. tostring(val))
log.msg(log.debug, "read value " .. tostring(val)) restore_log_level(old_log_level)
end
return val return val
end end
local function pref_write(name, pref_type, value) local function pref_write(name, pref_type, value)
dt.preferences.write(MODULE, name, pref_type, value) local old_log_level = set_log_level(sm.log_level)
log.msg(log.debug, "writing value " .. tostring(value) .. " for name " .. name)
dt.preferences.write(MODULE, name, pref_type, value)
restore_log_level(old_log_level)
end end
----------------
-- git interface -- git interface
----------------
local function get_repo_status(repo) local function get_repo_status(repo)
local old_log_level = set_log_level(sm.log_level)
local p = io.popen("cd " .. repo .. CS .. "git status") local p = io.popen("cd " .. repo .. CS .. "git status")
if p then if p then
local data = p:read("*a") local data = p:read("*a")
@@ -224,10 +239,12 @@ local function get_repo_status(repo)
return data return data
end end
log.msg(log.error, "unable to get status of " .. repo) log.msg(log.error, "unable to get status of " .. repo)
restore_log_level(old_log_level)
return nil return nil
end end
local function get_current_repo_branch(repo) local function get_current_repo_branch(repo)
local old_log_level = set_log_level(sm.log_level)
local branch = nil local branch = nil
local p = io.popen("cd " .. repo .. CS .. "git branch --all") local p = io.popen("cd " .. repo .. CS .. "git branch --all")
if p then if p then
@@ -246,10 +263,12 @@ local function get_current_repo_branch(repo)
if not branch then if not branch then
log.msg(log.error, "no current branch detected in repo_data") log.msg(log.error, "no current branch detected in repo_data")
end end
restore_log_level(old_log_level)
return nil return nil
end end
local function get_repo_branches(repo) local function get_repo_branches(repo)
local old_log_level = set_log_level(sm.log_level)
local branches = {} local branches = {}
local p = io.popen("cd " .. repo .. CS .. "git pull --all" .. CS .. "git branch --all") local p = io.popen("cd " .. repo .. CS .. "git pull --all" .. CS .. "git branch --all")
if p then if p then
@@ -266,11 +285,12 @@ local function get_repo_branches(repo)
end end
end end
end end
restore_log_level(old_log_level)
return branches return branches
end end
local function is_repo_clean(repo_data) local function is_repo_clean(repo_data)
local old_log_level = set_log_level(sm.log_level)
if string.match(repo_data, "\n%s-%a.-%a:%s-%a%g-\n") then if string.match(repo_data, "\n%s-%a.-%a:%s-%a%g-\n") then
log.msg(log.info, "repo is dirty") log.msg(log.info, "repo is dirty")
return false return false
@@ -278,14 +298,22 @@ local function is_repo_clean(repo_data)
log.msg(log.info, "repo is clean") log.msg(log.info, "repo is clean")
return true return true
end end
restore_log_level(old_log_level)
end end
local function checkout_repo_branch(repo, branch) local function checkout_repo_branch(repo, branch)
local old_log_level = set_log_level(sm.log_level)
log.msg(log.info, "checkout out branch " .. branch .. " from repository " .. repo) log.msg(log.info, "checkout out branch " .. branch .. " from repository " .. repo)
os.execute("cd " .. repo .. CS .. "git checkout " .. branch) os.execute("cd " .. repo .. CS .. "git checkout " .. branch)
restore_log_level(old_log_level)
end end
--------------------
-- utility functions
--------------------
local function update_combobox_choices(combobox, choice_table, selected) local function update_combobox_choices(combobox, choice_table, selected)
local old_log_level = set_log_level(sm.log_level)
local items = #combobox local items = #combobox
local choices = #choice_table local choices = #choice_table
for i, name in ipairs(choice_table) do for i, name in ipairs(choice_table) do
@@ -301,11 +329,14 @@ local function update_combobox_choices(combobox, choice_table, selected)
end end
combobox.value = selected combobox.value = selected
restore_log_level(old_log_level)
end end
local function string_trim(str) local function string_trim(str)
local old_log_level = set_log_level(sm.log_level)
local result = string.gsub(str, "^%s+", "") local result = string.gsub(str, "^%s+", "")
result = string.gsub(result, "%s+$", "") result = string.gsub(result, "%s+$", "")
restore_log_level(old_log_level)
return result return result
end end
@@ -313,15 +344,22 @@ local function string_dequote(str)
return string.gsub(str, "['\"]", "") return string.gsub(str, "['\"]", "")
end end
------------------
-- script handling
------------------
local function add_script_category(category) local function add_script_category(category)
local old_log_level = set_log_level(sm.log_level)
if #sm.categories == 0 or not string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then if #sm.categories == 0 or not string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then
table.insert(sm.categories, category) table.insert(sm.categories, category)
sm.scripts[category] = {} sm.scripts[category] = {}
log.msg(log.debug, "created category " .. category) log.msg(log.debug, "created category " .. category)
end end
restore_log_level(old_log_level)
end end
local function get_script_doc(script) local function get_script_doc(script)
local old_log_level = set_log_level(sm.log_level)
local description = nil local description = nil
f = io.open(LUA_DIR .. PS .. script .. ".lua") f = io.open(LUA_DIR .. PS .. script .. ".lua")
if f then if f then
@@ -334,13 +372,16 @@ local function get_script_doc(script)
log.msg(log.error, _("Cant read from " .. script)) log.msg(log.error, _("Cant read from " .. script))
end end
if description then if description then
restore_log_level(old_log_level)
return description return description
else else
restore_log_level(old_log_level)
return "No documentation available" return "No documentation available"
end end
end end
local function activate(script) local function activate(script)
local old_log_level = set_log_level(sm.log_level)
local status = nil -- status of start function local status = nil -- status of start function
local err = nil -- error message returned if module doesn't start local err = nil -- error message returned if module doesn't start
log.msg(log.info, "activating " .. script.name) log.msg(log.info, "activating " .. script.name)
@@ -356,7 +397,7 @@ local function activate(script)
if err ~= true then if err ~= true then
log.msg(log.debug, "got lib data") log.msg(log.debug, "got lib data")
script.data = err script.data = err
if script.data.destroy_method and script.data.destroy_method == "hide" then if script.data.destroy_method and script.data.destroy_method == "hide" and script.data.show then
script.data.show() script.data.show()
end end
else else
@@ -373,16 +414,20 @@ local function activate(script)
status = true status = true
pref_write(script.script_name, "bool", true) pref_write(script.script_name, "bool", true)
end end
restore_log_level(old_log_level)
return status return status
end end
local function deactivate(script) local function deactivate(script)
-- presently the lua api doesn't support unloading gui elements however, we -- presently the lua api doesn't support unloading lib elements however, we
-- can hide libs, so we just mark those as hidden and hide the gui -- can hide libs, so we just mark those as hidden and hide the gui
-- can delete storage -- can delete storages
--therefore we just mark then inactive for the next time darktable starts -- can delete actions
-- can delete selects
-- and mark them inactive for the next time darktable starts
-- deactivate it.... -- deactivate it....
local old_log_level = set_log_level(sm.log_level)
pref_write(script.script_name, "bool", false) pref_write(script.script_name, "bool", false)
if script.data then if script.data then
script.data.destroy() script.data.destroy()
@@ -404,9 +449,11 @@ local function deactivate(script)
log.msg(log.info, "setting " .. script.script_name .. " to not start") log.msg(log.info, "setting " .. script.script_name .. " to not start")
log.msg(log.screen, script.name .. _(" will not start when darktable is restarted")) log.msg(log.screen, script.name .. _(" will not start when darktable is restarted"))
end end
restore_log_level(old_log_level)
end end
local function add_script_name(name, path, category) local function add_script_name(name, path, category)
local old_log_level = set_log_level(sm.log_level)
log.msg(log.debug, "category is " .. category) log.msg(log.debug, "category is " .. category)
log.msg(log.debug, "name is " .. name) log.msg(log.debug, "name is " .. name)
local script = { local script = {
@@ -420,10 +467,14 @@ local function add_script_name(name, path, category)
table.insert(sm.scripts[category], script) table.insert(sm.scripts[category], script)
if pref_read(script.script_name, "bool") then if pref_read(script.script_name, "bool") then
activate(script) activate(script)
else
pref_write(script.script_name, "bool", false)
end end
restore_log_level(old_log_level)
end end
local function process_script_data(script_file) local function process_script_data(script_file)
local old_log_level = set_log_level(sm.log_level)
-- the script file supplied is category/filename.filetype -- the script file supplied is category/filename.filetype
-- the following pattern splits the string into category, path, name, fileename, and filetype -- the following pattern splits the string into category, path, name, fileename, and filetype
@@ -454,13 +505,15 @@ local function process_script_data(script_file)
if name then if name then
add_script_name(name, path, category) add_script_name(name, path, category)
end end
restore_log_level(old_log_level)
end end
local function scan_scripts(script_dir) local function scan_scripts(script_dir)
local old_log_level = set_log_level(sm.log_level)
local script_count = 0 local script_count = 0
local find_cmd = "find -L " .. script_dir .. " -name \\*.lua -print | sort" local find_cmd = "find -L " .. script_dir .. " -name \\*.lua -print | sort"
if dt.configuration.running_os == "windows" then if dt.configuration.running_os == "windows" then
find_cmd = "dir /b/s " .. script_dir .. "\\*.lua | sort" find_cmd = "dir /b/s \"" .. script_dir .. "\\*.lua\" | sort"
end end
log.msg(log.debug, _("find command is ") .. find_cmd) log.msg(log.debug, _("find command is ") .. find_cmd)
-- scan the scripts -- scan the scripts
@@ -479,10 +532,12 @@ local function scan_scripts(script_dir)
end end
end end
end end
restore_log_level(old_log_level)
return script_count return script_count
end end
local function update_scripts() local function update_scripts()
local old_log_level = set_log_level(sm.log_level)
local result = false local result = false
local git = sm.executables.git local git = sm.executables.git
@@ -505,10 +560,16 @@ local function update_scripts()
dt.print(_("lua scripts successfully updated")) dt.print(_("lua scripts successfully updated"))
end end
restore_log_level(old_log_level)
return result return result
end end
--------------
-- UI handling
--------------
local function update_script_update_choices() local function update_script_update_choices()
local old_log_level = set_log_level(sm.log_level)
local installs = {} local installs = {}
local pref_string = "" local pref_string = ""
for i, repo in ipairs(sm.installed_repositories) do for i, repo in ipairs(sm.installed_repositories) do
@@ -518,9 +579,11 @@ local function update_script_update_choices()
update_combobox_choices(sm.widgets.update_script_choices, installs, 1) update_combobox_choices(sm.widgets.update_script_choices, installs, 1)
log.msg(log.debug, "repo pref string is " .. pref_string) log.msg(log.debug, "repo pref string is " .. pref_string)
pref_write("installed_repos", "string", pref_string) pref_write("installed_repos", "string", pref_string)
restore_log_level(old_log_level)
end end
local function scan_repositories() local function scan_repositories()
local old_log_level = set_log_level(sm.log_level)
local script_count = 0 local script_count = 0
local find_cmd = "find -L " .. LUA_DIR .. " -name \\*.git -print | sort" local find_cmd = "find -L " .. LUA_DIR .. " -name \\*.git -print | sort"
if dt.configuration.running_os == "windows" then if dt.configuration.running_os == "windows" then
@@ -555,15 +618,18 @@ local function scan_repositories()
end end
end end
update_script_update_choices() update_script_update_choices()
restore_log_level(old_log_level)
end end
local function install_scripts() local function install_scripts()
local old_log_level = set_log_level(sm.log_level)
local url = sm.widgets.script_url.text local url = sm.widgets.script_url.text
local category = sm.widgets.new_category.text local category = sm.widgets.new_category.text
if string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then if string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then
log.msg(log.screen, _("category ") .. category .. _(" is already in use. Please specify a different category name.")) log.msg(log.screen, _("category ") .. category .. _(" is already in use. Please specify a different category name."))
log.msg(log.error, "category " .. category .. " already exists, returning...") log.msg(log.error, "category " .. category .. " already exists, returning...")
restore_log_level(old_log_level)
return return
end end
@@ -573,6 +639,7 @@ local function install_scripts()
if not git then if not git then
dt.print(_("ERROR: git not found. Install or specify the location of the git executable.")) dt.print(_("ERROR: git not found. Install or specify the location of the git executable."))
restore_log_level(old_log_level)
return return
end end
@@ -614,28 +681,34 @@ local function install_scripts()
dt.print(_("failed to download scripts")) dt.print(_("failed to download scripts"))
end end
restore_log_level(old_log_level)
return result return result
end end
local function clear_button(number) local function clear_button(number)
local old_log_level = set_log_level(sm.log_level)
local button = sm.widgets.buttons[number] local button = sm.widgets.buttons[number]
button.label = "" button.label = ""
button.tooltip = "" button.tooltip = ""
button.sensitive = false button.sensitive = false
--button.name = "" --button.name = ""
restore_log_level(old_log_level)
end end
local function find_script(category, name) local function find_script(category, name)
local old_log_level = set_log_level(sm.log_level)
log.msg(log.debug, "looking for script " .. name .. " in category " .. category) log.msg(log.debug, "looking for script " .. name .. " in category " .. category)
for _, script in ipairs(sm.scripts[category]) do for _, script in ipairs(sm.scripts[category]) do
if string.match(script.name, "^" .. ds.sanitize_lua(name) .. "$") then if string.match(script.name, "^" .. ds.sanitize_lua(name) .. "$") then
return script return script
end end
end end
restore_log_level(old_log_level)
return nil return nil
end end
local function populate_buttons(category, first, last) local function populate_buttons(category, first, last)
local old_log_level = set_log_level(sm.log_level)
log.msg(log.debug, "category is " .. category .. " and first is " .. first .. " and last is " .. last) log.msg(log.debug, "category is " .. category .. " and first is " .. first .. " and last is " .. last)
local button_num = 1 local button_num = 1
for i = first, last do for i = first, last do
@@ -700,9 +773,11 @@ local function populate_buttons(category, first, last)
clear_button(i) clear_button(i)
end end
end end
restore_log_level(old_log_level)
end end
local function paginate(direction) local function paginate(direction)
local old_log_level = set_log_level(sm.log_level)
local category = sm.page_status.category local category = sm.page_status.category
log.msg(log.debug, "category is " .. category) log.msg(log.debug, "category is " .. category)
local num_scripts = #sm.scripts[category] local num_scripts = #sm.scripts[category]
@@ -754,9 +829,11 @@ local function paginate(direction)
sm.widgets.page_status.label = _("Page ") .. cur_page .. _(" of ") .. max_pages sm.widgets.page_status.label = _("Page ") .. cur_page .. _(" of ") .. max_pages
populate_buttons(category, first, last) populate_buttons(category, first, last)
restore_log_level(old_log_level)
end end
local function change_category(category) local function change_category(category)
local old_log_level = set_log_level(sm.log_level)
if not category then if not category then
log.msg(log.debug "setting category to selector value " .. sm.widgets.category_selector.value) log.msg(log.debug "setting category to selector value " .. sm.widgets.category_selector.value)
sm.page_status.category = sm.widgets.category_selector.value sm.page_status.category = sm.widgets.category_selector.value
@@ -766,9 +843,11 @@ local function change_category(category)
end end
paginate(2) paginate(2)
restore_log_level(old_log_level)
end end
local function change_num_buttons() local function change_num_buttons()
local old_log_level = set_log_level(sm.log_level)
cur_buttons = sm.page_status.num_buttons cur_buttons = sm.page_status.num_buttons
new_buttons = sm.widgets.num_buttons.value new_buttons = sm.widgets.num_buttons.value
pref_write("num_buttons", "integer", new_buttons) pref_write("num_buttons", "integer", new_buttons)
@@ -799,9 +878,11 @@ local function change_num_buttons()
log.msg(log.debug, "num_buttons set to " .. sm.page_status.num_buttons) log.msg(log.debug, "num_buttons set to " .. sm.page_status.num_buttons)
paginate(2) -- force the buttons to repopulate paginate(2) -- force the buttons to repopulate
sm.widgets.main_menu.selected = 3 -- jump back to start/stop scripts sm.widgets.main_menu.selected = 3 -- jump back to start/stop scripts
restore_log_level(old_log_level)
end end
local function load_preferences() local function load_preferences()
local old_log_level = set_log_level(sm.log_level)
-- load the prefs and update settings -- load the prefs and update settings
-- update_script_choices -- update_script_choices
local pref_string = pref_read("installed_repos", "string") local pref_string = pref_read("installed_repos", "string")
@@ -843,16 +924,18 @@ local function load_preferences()
log.msg(log.debug, "set main menu to val " .. val .. " which is " .. sm.widgets.main_menu.value) log.msg(log.debug, "set main menu to val " .. val .. " which is " .. sm.widgets.main_menu.value)
log.msg(log.debug, "set main menu to " .. sm.widgets.main_menu.value) log.msg(log.debug, "set main menu to " .. sm.widgets.main_menu.value)
restore_log_level(old_log_level)
end end
local function install_module() local function install_module()
local old_log_level = set_log_level(sm.log_level)
if not sm.module_installed then if not sm.module_installed then
dt.register_lib( dt.register_lib(
"script_manager", -- Module name "script_manager", -- Module name
"script manager", -- Visible name "script manager", -- Visible name
true, -- expandable true, -- expandable
false, -- resetable false, -- resetable
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_BOTTOM", 600}}, -- containers {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_BOTTOM", 100}}, -- containers
sm.widgets.main_box, sm.widgets.main_box,
nil,-- view_enter nil,-- view_enter
nil -- view_leave nil -- view_leave
@@ -875,6 +958,7 @@ local function install_module()
dt.control.sleep(5000) dt.control.sleep(5000)
dt.print_log("setting sm expanded true") dt.print_log("setting sm expanded true")
dt.gui.libs["script_manager"].expanded = true]] dt.gui.libs["script_manager"].expanded = true]]
restore_log_level(old_log_level)
end end
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
@@ -1164,6 +1248,7 @@ sm.widgets.main_box = dt.new_widget("box"){
} }
script_manager_running_script = nil script_manager_running_script = nil
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -
-- D A R K T A B L E I N T E G R A T I O N -- D A R K T A B L E I N T E G R A T I O N
-- - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - - - - - - - - - - - - - - -