Compare commits
110 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6548a12bf1 | ||
|
|
becfa5350b | ||
|
|
ebd2cd7bf7 | ||
|
|
52b4508e08 | ||
|
|
19fdbc14c5 | ||
|
|
63d5aad465 | ||
|
|
9d6ff85893 | ||
|
|
125af63bda | ||
|
|
65c22e475a | ||
|
|
e78e718769 | ||
|
|
40949b3855 | ||
|
|
06ab263e74 | ||
|
|
bccc86c70a | ||
|
|
12640c7d29 | ||
|
|
febc3b1659 | ||
|
|
9fdd69556c | ||
|
|
4735be470a | ||
|
|
3b8e802e42 | ||
|
|
f54d449316 | ||
|
|
1b0fe4d7b9 | ||
|
|
cf1dca9e1a | ||
|
|
45d54ef4e8 | ||
|
|
8bfab0325b | ||
|
|
4b99d00ab5 | ||
|
|
a5961eb066 | ||
|
|
95e19ef163 | ||
|
|
d4eb6577bf | ||
|
|
294b693905 | ||
|
|
23835edc1f | ||
|
|
5f29211f79 | ||
|
|
025f4299ea | ||
|
|
dc50d40886 | ||
|
|
867c49b1b9 | ||
|
|
13f02c95ea | ||
|
|
d55dae73f0 | ||
|
|
34b9831472 | ||
|
|
014a0fc1c9 | ||
|
|
bf17dccd69 | ||
|
|
890168d0d0 | ||
|
|
191aecacdf | ||
|
|
44ec01b136 | ||
|
|
a177da2040 | ||
|
|
c899040688 | ||
|
|
e8af665b3c | ||
|
|
875734d455 | ||
|
|
14d5a79db2 | ||
|
|
e1b2715ee9 | ||
|
|
7ecd5ca55d | ||
|
|
931e7a4d37 | ||
|
|
1792410efe | ||
|
|
8cbd9224f1 | ||
|
|
24b552d619 | ||
|
|
68ae9326bf | ||
|
|
b4626f2787 | ||
|
|
2fc8ed78e4 | ||
|
|
236b25a235 | ||
|
|
a4f6af73ec | ||
|
|
fad74d6438 | ||
|
|
3e2d4c956d | ||
|
|
cd1d623390 | ||
|
|
9e0374d597 | ||
|
|
e47672b495 | ||
|
|
1905be8577 | ||
|
|
4726821e7d | ||
|
|
7ac37ddc1a | ||
|
|
3889742e06 | ||
|
|
6bf3706455 | ||
|
|
612ecaff6c | ||
|
|
a85364ecff | ||
|
|
c0af03c503 | ||
|
|
9b61e4793b | ||
|
|
75a19e74a0 | ||
|
|
21d7e72b0c | ||
|
|
05d555eae5 | ||
|
|
8e412c3eb3 | ||
|
|
80147a9ebc | ||
|
|
3f6a3e25f1 | ||
|
|
800cbeef9d | ||
|
|
574f6a976f | ||
|
|
030b360e57 | ||
|
|
b883714192 | ||
|
|
d556f48168 | ||
|
|
cd7cac0eec | ||
|
|
9b31f18470 | ||
|
|
42a194b3d7 | ||
|
|
6748a7125e | ||
|
|
c2b3f29f3b | ||
|
|
572a634d90 | ||
|
|
652606ffb0 | ||
|
|
803537c63e | ||
|
|
4648c2d9af | ||
|
|
edceb3e7e9 | ||
|
|
da6bddcd77 | ||
|
|
b11f43e903 | ||
|
|
ef218a4d2e | ||
|
|
b061f27e7a | ||
|
|
8e64d54ab1 | ||
|
|
56b40a80ac | ||
|
|
d359d8ecb4 | ||
|
|
2bc55d00bb | ||
|
|
d3cf564b71 | ||
|
|
4fb8b97084 | ||
|
|
32c5cceb1d | ||
|
|
f38c14d6b5 | ||
|
|
3070ca0bc4 | ||
|
|
0122b3f717 | ||
|
|
79678fd82f | ||
|
|
034ddfbafb | ||
|
|
aebd26d03a | ||
|
|
28ae2ea501 |
17
ChangeLog.md
17
ChangeLog.md
@@ -1,6 +1,23 @@
|
|||||||
## Changes from most recent to oldest
|
## Changes from most recent to oldest
|
||||||
|
|
||||||
|
**25 Mar 2023 - wpferguson**
|
||||||
|
* Added script_manager darktable shortcut integration
|
||||||
|
* Moved filename/path/extension string functions to string library
|
||||||
|
|
||||||
|
**06 Mar 2023 - wpferguson - Added option to disable script_manager update check**
|
||||||
|
|
||||||
|
**12 Jan 2022 - wpferguson - Documented contrib/rename_images.lua**
|
||||||
|
|
||||||
|
**28 Dec 2021 - wpferguson - Replaced deprecated _which_ command with _command -v_ in lib/dtutils/file.lua**
|
||||||
|
|
||||||
|
**12 Dec 2021 - wpferguson**
|
||||||
|
* Added deprecated function to library
|
||||||
|
* Added deprecation warning to contrib/rename-tags.lua
|
||||||
|
|
||||||
**22 Oct 2021 - wpferguson for Volker Bödker - make sure sequence is 4 digits in rename_images.lua**
|
**22 Oct 2021 - wpferguson for Volker Bödker - make sure sequence is 4 digits in rename_images.lua**
|
||||||
|
|
||||||
**31 Aug 2021 - wpferguson - remove styles hiding from AutoGrouper.lua**
|
**31 Aug 2021 - wpferguson - remove styles hiding from AutoGrouper.lua**
|
||||||
|
|
||||||
**02 Jul 2021 - wpferguson - merged API-7.0.0-dev branch to master**
|
**02 Jul 2021 - wpferguson - merged API-7.0.0-dev branch to master**
|
||||||
* API-7.0.0 is darktable 3.6
|
* API-7.0.0 is darktable 3.6
|
||||||
* breaking changes
|
* breaking changes
|
||||||
|
|||||||
38
README.md
38
README.md
@@ -34,36 +34,39 @@ These scripts are contributed by users. They are meant to have an "owner", i.e.
|
|||||||
|
|
||||||
Name|Standalone|OS |Purpose
|
Name|Standalone|OS |Purpose
|
||||||
----|:--------:|:---:|-------
|
----|:--------:|:---:|-------
|
||||||
[AutoGrouper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/AutoGrouper)|Yes|LMW|Group images together by time
|
[AutoGrouper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/autogrouper)|Yes|LMW|Group images together by time
|
||||||
[autostyle](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/autostyle)|Yes|LMW|Automatically apply styles on import
|
[autostyle](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/autostyle)|Yes|LMW|Automatically apply styles on import
|
||||||
[clear_GPS](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/clear_GPS)|Yes|LMW|Reset GPS information for selected images
|
change_group_leader|Yes|LMW|Change which image leads group
|
||||||
[CollectHelper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/CollectHelper)|Yes|LMW|Add buttons to selected images module to manipulate the collection
|
[clear_GPS](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/clear_gps)|Yes|LMW|Reset GPS information for selected images
|
||||||
|
[CollectHelper](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/collecthelper)|Yes|LMW|Add buttons to selected images module to manipulate the collection
|
||||||
[copy_attach_detach_tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/copy_attach_detach_tags)|Yes|LMW|Copy and paste tags from/to images
|
[copy_attach_detach_tags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/copy_attach_detach_tags)|Yes|LMW|Copy and paste tags from/to images
|
||||||
[cr2hdr](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/cr2hdr)|Yes|L|Process image created with Magic Lantern Dual ISO
|
[cr2hdr](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/cr2hdr)|Yes|L|Process image created with Magic Lantern Dual ISO
|
||||||
[enfuseAdvanced](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/enfuseAdvanced)|No|LMW|Merge multiple images into Dynamic Range Increase (DRI) or Depth From Focus (DFF) images
|
[enfuseAdvanced](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/enfuseadvanced)|No|LMW|Merge multiple images into Dynamic Range Increase (DRI) or Depth From Focus (DFF) images
|
||||||
[exportLUT](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/exportLUT)|Yes|LMW|Create a LUT from a style and export it
|
[exportLUT](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/exportlut)|Yes|LMW|Create a LUT from a style and export it
|
||||||
[ext_editor](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/ext_editor)|No|LW|Export pictures to collection and edit them with up to nine user-defined external editors
|
[ext_editor](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/ext_editor)|No|LW|Export pictures to collection and edit them with up to nine user-defined external editors
|
||||||
[face_recognition](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/face_recognition)|No|LM|Identify and tag images using facial recognition
|
[face_recognition](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/face_recognition)|No|LM|Identify and tag images using facial recognition
|
||||||
[fujifilm_dynamic_range](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_dynamic_range)|No|LMW|Correct fujifilm exposure based on exposure bias camera setting
|
[fujifilm_dynamic_range](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_dynamic_range)|No|LMW|Correct fujifilm exposure based on exposure bias camera setting
|
||||||
[fujifilm_ratings](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_ratings)|No|LM|Support importing Fujifilm ratings
|
[fujifilm_ratings](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/fujifilm_ratings)|No|LM|Support importing Fujifilm ratings
|
||||||
[geoJSON_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geoJSON_export)|No|L|Create a geo JSON script with thumbnails for use in ...
|
[geoJSON_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geojson_export)|No|L|Create a geo JSON script with thumbnails for use in ...
|
||||||
[geoToolbox](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geoToolbox)|No|LMW|A toolbox of geo functions
|
[geoToolbox](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/geotoolbox)|No|LMW|A toolbox of geo functions
|
||||||
[gimp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gimp)|No|LMW|Open an image in GIMP for editing and return the result
|
[gimp](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gimp)|No|LMW|Open an image in GIMP for editing and return the result
|
||||||
[gpx_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gpx_export)|No|LMW|Export a GPX track file from selected images GPS data
|
[gpx_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/gpx_export)|No|LMW|Export a GPX track file from selected images GPS data
|
||||||
[HDRMerge](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/HDRMerge)|No|LMW|Combine the selected images into an HDR DNG and return the result
|
[HDRMerge](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/hdrmerge)|No|LMW|Combine the selected images into an HDR DNG and return the result
|
||||||
[hugin](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/hugin)|No|LMW|Combine selected images into a panorama and return the result
|
[hugin](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/hugin)|No|LMW|Combine selected images into a panorama and return the result
|
||||||
[image_stack](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_stack)|No|LMW|Combine a stack of images to remove noise or transient objects
|
[image_stack](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_stack)|No|LMW|Combine a stack of images to remove noise or transient objects
|
||||||
[image_time](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_time)|Yes|LMW|Adjust the EXIF image time
|
[image_time](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/image_time)|Yes|LMW|Adjust the EXIF image time
|
||||||
[kml_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/kml_export)|No|L|Export photos with a KML file for usage in Google Earth
|
[kml_export](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/kml_export)|No|L|Export photos with a KML file for usage in Google Earth
|
||||||
[LabelsToTags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/LabelsToTags)|Yes|LMW|Apply tags based on color labels and ratings
|
[LabelsToTags](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/labelstotags)|Yes|LMW|Apply tags based on color labels and ratings
|
||||||
[OpenInExplorer](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/OpenInExplorer)|No|LMW|Open the selected images in the system file manager
|
[OpenInExplorer](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/openinexplorer)|No|LMW|Open the selected images in the system file manager
|
||||||
[passport_guide](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/passport_guide)|Yes|LMW|Add passport cropping guide to darkroom crop tool
|
[passport_guide](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/passport_guide)|Yes|LMW|Add passport cropping guide to darkroom crop tool
|
||||||
[pdf_slideshow](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/pdf_slideshow)|No|LM|Export images to a PDF slideshow
|
[pdf_slideshow](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/pdf_slideshow)|No|LM|Export images to a PDF slideshow
|
||||||
[photils](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/photils)|No|LM|Automatic tag suggestions for your images
|
[photils](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/photils)|No|LM|Automatic tag suggestions for your images
|
||||||
[quicktag](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/quicktag)|Yes|LMW|Create shortcuts for quickly applying tags
|
[quicktag](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/quicktag)|Yes|LMW|Create shortcuts for quickly applying tags
|
||||||
[rate_group](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rate_group)|Yes|LMW|Apply or remove a star rating from grouped images
|
[rate_group](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/contrib/rate_group)|Yes|LMW|Apply or remove a star rating from grouped 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
|
||||||
@@ -77,14 +80,14 @@ Name|Standalone|OS |Purpose
|
|||||||
----|:--------:|:---:|-------
|
----|:--------:|:---:|-------
|
||||||
[api_version](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/api_version)|Yes|LMW|Print the current API version
|
[api_version](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/api_version)|Yes|LMW|Print the current API version
|
||||||
[darkroom_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/darkroom_demo)|Yes|LMW|Demonstrate changing images in darkoom
|
[darkroom_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/darkroom_demo)|Yes|LMW|Demonstrate changing images in darkoom
|
||||||
[gettextExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/gettextExample)|Yes|LM|How to use translation
|
[gettextExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/gettextexample)|Yes|LM|How to use translation
|
||||||
[hello_world](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/hello_world)|Yes|LMW|Prints hello world when darktable starts
|
[hello_world](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/hello_world)|Yes|LMW|Prints hello world when darktable starts
|
||||||
[lighttable_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/lighttable_demo)|Yes|LMW|Demonstrate controlling lighttable mode, zoom, sorting and filtering
|
[lighttable_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/lighttable_demo)|Yes|LMW|Demonstrate controlling lighttable mode, zoom, sorting and filtering
|
||||||
[moduleExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/moduleExample)|Yes|LMW|How to create a lighttable module
|
[moduleExample](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/moduleexample)|Yes|LMW|How to create a lighttable module
|
||||||
[multi_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/multi_os)|No|LMW|How to create a cross platform script that calls an external executable
|
[multi_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/multi_os)|No|LMW|How to create a cross platform script that calls an external executable
|
||||||
[panels_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/panels_demo)|Yes|LMW|Demonstrate hiding and showing darktable panels
|
[panels_demo](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/panels_demo)|Yes|LMW|Demonstrate hiding and showing darktable panels
|
||||||
[preferenceExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/preferenceExamples)|Yes|LMW|How to use preferences in a script
|
[preferenceExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/preferenceexamples)|Yes|LMW|How to use preferences in a script
|
||||||
[printExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/printExamples)|Yes|LMW|How to use various print functions from a script
|
[printExamples](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/printexamples)|Yes|LMW|How to use various print functions from a script
|
||||||
[running_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/running_os)|Yes|LMW|Print out the running operating system
|
[running_os](https://darktable-org.github.io/luadocs/lua.scripts.manual/scripts/examples/running_os)|Yes|LMW|Print out the running operating system
|
||||||
|
|
||||||
### Tools
|
### Tools
|
||||||
@@ -114,6 +117,7 @@ The following third-party projects are listed for information only. Think of thi
|
|||||||
* [arru/darktable-scripts](https://github.com/arru/darktable-scripts)
|
* [arru/darktable-scripts](https://github.com/arru/darktable-scripts)
|
||||||
* [nbremond77/darktable](https://github.com/nbremond77/darktable/tree/master/scripts)
|
* [nbremond77/darktable](https://github.com/nbremond77/darktable/tree/master/scripts)
|
||||||
* [s5k6/dtscripts](https://github.com/s5k6/dtscripts)
|
* [s5k6/dtscripts](https://github.com/s5k6/dtscripts)
|
||||||
|
* [ChristianBirzer/darktable_extra_scripts](https://github.com/ChristianBirzer/darktable_extra_scripts)
|
||||||
|
|
||||||
## Download and Install
|
## Download and Install
|
||||||
|
|
||||||
@@ -171,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
|
||||||
|
|
||||||
@@ -179,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:
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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'
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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 "/"
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
201
contrib/change_group_leader.lua
Normal file
201
contrib/change_group_leader.lua
Normal file
@@ -0,0 +1,201 @@
|
|||||||
|
--[[
|
||||||
|
change group leader
|
||||||
|
|
||||||
|
copyright (c) 2020, 2022 Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
copyright (c) 2021 Angel Angelov
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
]]
|
||||||
|
|
||||||
|
--[[
|
||||||
|
CHANGE GROUP LEADER
|
||||||
|
automatically change the leader of raw+jpg paired image groups
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
|
||||||
|
* add the following line in the file $CONFIGDIR/luarc
|
||||||
|
require "change_group_leader"
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* in lighttable mode, select the image groups you wish to process,
|
||||||
|
select whether you want to set the leader to "jpg" or "raw",
|
||||||
|
and click "Execute"
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
|
||||||
|
local MODULE = "change_group_leader"
|
||||||
|
|
||||||
|
du.check_min_api_version("3.0.0", MODULE)
|
||||||
|
|
||||||
|
-- return data structure for script_manager
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
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.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
|
||||||
|
gettext.bindtextdomain(MODULE, dt.configuration.config_dir.."/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- create a namespace to contain persistent data and widgets
|
||||||
|
chg_grp_ldr = {}
|
||||||
|
|
||||||
|
local cgl = chg_grp_ldr
|
||||||
|
|
||||||
|
cgl.widgets = {}
|
||||||
|
|
||||||
|
cgl.event_registered = false
|
||||||
|
cgl.module_installed = false
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function install_module()
|
||||||
|
if not cgl.module_installed then
|
||||||
|
dt.register_lib(
|
||||||
|
MODULE, -- Module name
|
||||||
|
_("change_group_leader"), -- Visible name
|
||||||
|
true, -- expandable
|
||||||
|
false, -- resetable
|
||||||
|
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 700}}, -- containers
|
||||||
|
cgl.widgets.box,
|
||||||
|
nil,-- view_enter
|
||||||
|
nil -- view_leave
|
||||||
|
)
|
||||||
|
cgl.module_installed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_group_leader(images, mode)
|
||||||
|
for _, img in ipairs(images) do
|
||||||
|
dt.print_log("checking image " .. img.id .. " named " .. img.filename)
|
||||||
|
local found = false
|
||||||
|
if mode == "jpg" then
|
||||||
|
if string.match(string.lower(img.filename), "jpg$") then
|
||||||
|
dt.print_log("jpg matched image " .. img.filename)
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
elseif mode == "raw" then
|
||||||
|
if img.is_raw and img.duplicate_index == 0 then
|
||||||
|
dt.print_log("found raw " .. img.filename)
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
elseif mode == "non-raw" then
|
||||||
|
if img.is_ldr then
|
||||||
|
dt.print_log("found ldr " .. img.filename)
|
||||||
|
found = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
dt.print_error(MODULE .. ": unrecognized mode " .. mode)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if found then
|
||||||
|
dt.print_log("making " .. img.filename .. " group leader")
|
||||||
|
img:make_group_leader()
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function process_image_groups(images)
|
||||||
|
if #images < 1 then
|
||||||
|
dt.print(_("No images selected."))
|
||||||
|
dt.print_log(MODULE .. "no images seletected, returning...")
|
||||||
|
else
|
||||||
|
local mode = cgl.widgets.mode.value
|
||||||
|
for _,img in ipairs(images) do
|
||||||
|
dt.print_log("checking image " .. img.id)
|
||||||
|
local group_images = img:get_group_members()
|
||||||
|
if group_images == 1 then
|
||||||
|
dt.print_log("only one image in group for image " .. image.id)
|
||||||
|
else
|
||||||
|
find_group_leader(group_images, mode)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
dt.gui.libs[MODULE].visible = false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function restart()
|
||||||
|
dt.gui.libs[MODULE].visible = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- W I D G E T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
cgl.widgets.mode = dt.new_widget("combobox"){
|
||||||
|
label = _("select new group leader"),
|
||||||
|
tooltip = _("select type of image to be group leader"),
|
||||||
|
selected = 1,
|
||||||
|
"jpg", "raw", "non-raw",
|
||||||
|
}
|
||||||
|
|
||||||
|
cgl.widgets.execute = dt.new_widget("button"){
|
||||||
|
label = _("Execute"),
|
||||||
|
clicked_callback = function()
|
||||||
|
process_image_groups(dt.gui.action_images)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
cgl.widgets.box = dt.new_widget("box"){
|
||||||
|
orientation = "vertical",
|
||||||
|
cgl.widgets.mode,
|
||||||
|
cgl.widgets.execute,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
if dt.gui.current_view().id == "lighttable" then
|
||||||
|
install_module()
|
||||||
|
else
|
||||||
|
if not cgl.event_registered then
|
||||||
|
dt.register_event(
|
||||||
|
"view-changed",
|
||||||
|
function(event, old_view, new_view)
|
||||||
|
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||||
|
install_module()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
cgl.event_registered = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
script_data.restart = restart
|
||||||
|
script_data.destroy_method = "hide"
|
||||||
|
script_data.show = restart
|
||||||
|
|
||||||
|
return script_data
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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 = {}
|
||||||
|
|||||||
158
contrib/cycle_group_leader.lua
Normal file
158
contrib/cycle_group_leader.lua
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
cycle_group_leader.lua - change image grouip leader
|
||||||
|
|
||||||
|
Copyright (C) 2024 Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
cycle_group_leader - change image grouip leader
|
||||||
|
|
||||||
|
cycle_group_leader changes the group leader to the next
|
||||||
|
image in the group. If the end of the group is reached
|
||||||
|
then the next image is wrapped around to the first image.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
None
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* enable with script_manager
|
||||||
|
* assign a key to the shortcut
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- C O N S T A N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local MODULE = "cycle_group_leader"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A P I C H E C K
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE)
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
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.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
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- I 1 8 N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
|
||||||
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
|
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function toggle_global_toolbox_grouping()
|
||||||
|
dt.gui.libs.global_toolbox.grouping = false
|
||||||
|
dt.gui.libs.global_toolbox.grouping = true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function hinter_msg(msg)
|
||||||
|
dt.print_hinter(msg)
|
||||||
|
dt.control.sleep(1500)
|
||||||
|
dt.print_hinter(" ")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- M A I N P R O G R A M
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function cycle_group_leader(image)
|
||||||
|
local group_images = image:get_group_members()
|
||||||
|
if #group_images < 2 then
|
||||||
|
hinter_msg(_("No images to cycle to in group"))
|
||||||
|
return
|
||||||
|
else
|
||||||
|
local position = nil
|
||||||
|
for i, img in ipairs(group_images) do
|
||||||
|
if image == img then
|
||||||
|
position = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if position == #group_images then
|
||||||
|
position = 1
|
||||||
|
else
|
||||||
|
position = position + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
new_leader = group_images[position]
|
||||||
|
new_leader:make_group_leader()
|
||||||
|
dt.gui.selection({new_leader})
|
||||||
|
|
||||||
|
if dt.gui.libs.global_toolbox.grouping then
|
||||||
|
-- toggle the grouping to make the new leader show
|
||||||
|
toggle_global_toolbox_grouping()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
-- put things to destroy (events, storages, etc) here
|
||||||
|
dt.destroy_event(MODULE, "shortcut")
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- E V E N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dt.register_event(MODULE, "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
-- ignore the film roll, it contains all the images, not just the imported
|
||||||
|
local images = dt.gui.selection()
|
||||||
|
if #images < 1 then
|
||||||
|
dt.print(_("No image selected. Please select an image and try again"))
|
||||||
|
else
|
||||||
|
cycle_group_leader(images[1])
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
_("cycle group leader")
|
||||||
|
)
|
||||||
|
|
||||||
|
return script_data
|
||||||
314
contrib/dbmaint.lua
Normal file
314
contrib/dbmaint.lua
Normal file
@@ -0,0 +1,314 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
dbmaint.lua - perform database maintenance
|
||||||
|
|
||||||
|
Copyright (C) 2024 Bill Ferguson <wpferguson.com>.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
dbmaint - perform database maintenance
|
||||||
|
|
||||||
|
Perform database maintenance to clean up missing images and filmstrips.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
None
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* start dbmaint from script_manager
|
||||||
|
* scan for missing film rolls or missing images
|
||||||
|
* look at the results and choose to delete or not
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
Bill Ferguson <wpferguson.com>
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
|
local log = require "lib/dtutils.log"
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- C O N S T A N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local MODULE <const> = "dbmaint"
|
||||||
|
local DEFAULT_LOG_LEVEL <const> = log.error
|
||||||
|
local PS <const> = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A P I C H E C K
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE) -- choose the minimum version that contains the features you need
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- I 1 8 N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local gettext = dt.gettext.gettext
|
||||||
|
|
||||||
|
dt.gettext.bindtextdomain(MODULE , dt.configuration.config_dir .. "/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
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.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
|
||||||
|
|
||||||
|
script_data.metadata = {
|
||||||
|
name = "dbmaint",
|
||||||
|
purpose = _("perform database maintenance"),
|
||||||
|
author = "Bill Ferguson <wpferguson.com>",
|
||||||
|
help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/dbmaint/"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- L O G L E V E L
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
log.log_level(DEFAULT_LOG_LEVEL)
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- N A M E S P A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local dbmaint = {}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- G L O B A L V A R I A B L E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dbmaint.main_widget = nil
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A L I A S E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local namespace = dbmaint
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function scan_film_rolls()
|
||||||
|
local missing_films = {}
|
||||||
|
|
||||||
|
for _, filmroll in ipairs(dt.films) do
|
||||||
|
if not df.check_if_file_exists(filmroll.path) then
|
||||||
|
table.insert(missing_films, filmroll)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return missing_films
|
||||||
|
end
|
||||||
|
|
||||||
|
local function scan_images(film)
|
||||||
|
local missing_images = {}
|
||||||
|
|
||||||
|
if film then
|
||||||
|
for i = 1, #film do
|
||||||
|
local image = film[i]
|
||||||
|
log.log_msg(log.debug, "checking " .. image.filename)
|
||||||
|
if not df.check_if_file_exists(image.path .. PS .. image.filename) then
|
||||||
|
log.log_msg(log.info, image.filename .. " not found")
|
||||||
|
table.insert(missing_images, image)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return missing_images
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove_missing_film_rolls(list)
|
||||||
|
for _, filmroll in ipairs(list) do
|
||||||
|
filmroll:delete(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- force the lighttable to reload
|
||||||
|
|
||||||
|
local function refresh_lighttable(film)
|
||||||
|
local rules = dt.gui.libs.collect.filter()
|
||||||
|
dt.gui.libs.collect.filter(rules)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove_missing_images(list)
|
||||||
|
local film = list[1].film
|
||||||
|
for _, image in ipairs(list) do
|
||||||
|
image:delete()
|
||||||
|
end
|
||||||
|
refresh_lighttable(film)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function install_module()
|
||||||
|
if not namespace.module_installed then
|
||||||
|
dt.register_lib(
|
||||||
|
MODULE, -- Module name
|
||||||
|
_("DB maintenance"), -- Visible name
|
||||||
|
true, -- expandable
|
||||||
|
true, -- resetable
|
||||||
|
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 0}}, -- containers
|
||||||
|
namespace.main_widget,
|
||||||
|
nil,-- view_enter
|
||||||
|
nil -- view_leave
|
||||||
|
)
|
||||||
|
namespace.module_installed = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- U S E R I N T E R F A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dbmaint.list_widget = dt.new_widget("text_view"){
|
||||||
|
editable = false,
|
||||||
|
reset_callback = function(this)
|
||||||
|
this.text = ""
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
dbmaint.chooser = dt.new_widget("combobox"){
|
||||||
|
label = "scan for",
|
||||||
|
selected = 1,
|
||||||
|
"film rolls", "images",
|
||||||
|
reset_callback = function(this)
|
||||||
|
this.selected = 1
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
dbmaint.scan_button = dt.new_widget("button"){
|
||||||
|
label = "scan",
|
||||||
|
tooltip = "click to scan for missing film rolls/files",
|
||||||
|
clicked_callback = function(this)
|
||||||
|
local found = nil
|
||||||
|
local found_text = ""
|
||||||
|
if dbmaint.chooser.value == "film rolls" then
|
||||||
|
found = scan_film_rolls()
|
||||||
|
if #found > 0 then
|
||||||
|
for _, film in ipairs(found) do
|
||||||
|
local dir_name = du.split(film.path, PS)
|
||||||
|
found_text = found_text .. dir_name[#dir_name] .. "\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
log.log_msg(log.debug, "checking path " .. dt.collection[1].path .. " for missing files")
|
||||||
|
found = scan_images(dt.collection[1].film)
|
||||||
|
if #found > 0 then
|
||||||
|
for _, image in ipairs(found) do
|
||||||
|
found_text = found_text .. image.filename .. "\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #found > 0 then
|
||||||
|
dbmaint.list_widget.text = found_text
|
||||||
|
dbmaint.found = found
|
||||||
|
dbmaint.remove_button.sensitive = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
reset_callback = function(this)
|
||||||
|
dbmaint.found = nil
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
dbmaint.remove_button = dt.new_widget("button"){
|
||||||
|
label = "remove",
|
||||||
|
tooltip = "remove missing film rolls/images",
|
||||||
|
sensitive = false,
|
||||||
|
clicked_callback = function(this)
|
||||||
|
if dbmaint.chooser.value == "film rolls" then
|
||||||
|
remove_missing_film_rolls(dbmaint.found)
|
||||||
|
else
|
||||||
|
remove_missing_images(dbmaint.found)
|
||||||
|
end
|
||||||
|
dbmaint.found = nil
|
||||||
|
dbmaint.list_widget.text = ""
|
||||||
|
this.sensitive = false
|
||||||
|
end,
|
||||||
|
reset_callback = function(this)
|
||||||
|
this.sensitive = false
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
dbmaint.main_widget = dt.new_widget("box"){
|
||||||
|
orientation = "vertical",
|
||||||
|
dt.new_widget("section_label"){label = "missing items"},
|
||||||
|
dbmaint.list_widget,
|
||||||
|
dt.new_widget("label"){label = ""},
|
||||||
|
dbmaint.chooser,
|
||||||
|
dt.new_widget("label"){label = ""},
|
||||||
|
dbmaint.scan_button,
|
||||||
|
dbmaint.remove_button
|
||||||
|
}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
dt.gui.libs[MODULE].visible = false
|
||||||
|
|
||||||
|
if namespace.event_registered then
|
||||||
|
dt.destroy_event(MODULE, "view-changed")
|
||||||
|
end
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function restart()
|
||||||
|
dt.gui.libs[MODULE].visible = true
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
script_data.restart = restart
|
||||||
|
script_data.destroy_method = "hide"
|
||||||
|
script_data.show = restart
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- E V E N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
if dt.gui.current_view().id == "lighttable" then
|
||||||
|
install_module()
|
||||||
|
else
|
||||||
|
if not namespace.event_registered then
|
||||||
|
dt.register_event(MODULE, "view-changed",
|
||||||
|
function(event, old_view, new_view)
|
||||||
|
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||||
|
install_module()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
namespace.event_registered = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return script_data
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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 "/"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Compensate for Fujifilm raw files made using "dynamic range".
|
Compensate for Fujifilm raw files made using "dynamic range".
|
||||||
|
|
||||||
Copyright (C) 2021 Dan Torop <dant@pnym.net>
|
Copyright (C) 2021, 2022 Dan Torop <dant@pnym.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program 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
|
||||||
@@ -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
|
||||||
@@ -116,6 +117,11 @@ local function destroy()
|
|||||||
dt.destroy_event("fujifilm_dr", "post-import-image")
|
dt.destroy_event("fujifilm_dr", "post-import-image")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not df.check_if_bin_exists("exiftool") then
|
||||||
|
dt.print_log("Please install exiftool to use fujifilm_dynamic_range")
|
||||||
|
error "[fujifilm_dynamic_range] exiftool not found"
|
||||||
|
end
|
||||||
|
|
||||||
dt.register_event("fujifilm_dr", "post-import-image",
|
dt.register_event("fujifilm_dr", "post-import-image",
|
||||||
detect_dynamic_range)
|
detect_dynamic_range)
|
||||||
|
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
196
contrib/hif_group_leader.lua
Normal file
196
contrib/hif_group_leader.lua
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
hif_group_leader.lua - Make hif image group leader
|
||||||
|
|
||||||
|
Copyright (C) 2024 Bill Ferguson <wpferguson@gmail.com>.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
hif_group_leader - Make hif image group leader
|
||||||
|
|
||||||
|
After a film roll is imported, check for RAW-JPG image groups
|
||||||
|
and make the JPG image the group leader. This is on by default
|
||||||
|
but can be disabled in preferences.
|
||||||
|
|
||||||
|
Shortcuts are included to filter existing collections or
|
||||||
|
selections of images and make the hif the group leader.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
None
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
Start script from script_manager
|
||||||
|
Assign keys to the shortcuts
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- C O N S T A N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local MODULE = "hif_group_leader"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A P I C H E C K
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE)
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
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.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
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- I 1 8 N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
|
||||||
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
|
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- P R E F E R E N C E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dt.preferences.register(MODULE, "on_import", "bool", _("make hif group leader on import"), _("automatically make the hif file the group leader when raw + hif are imported"), true)
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- N A M E S P A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local jgloi = {}
|
||||||
|
jgloi.images = {}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function toggle_global_toolbox_grouping()
|
||||||
|
dt.gui.libs.global_toolbox.grouping = false
|
||||||
|
dt.gui.libs.global_toolbox.grouping = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- M A I N P R O G R A M
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function make_hif_group_leader(images)
|
||||||
|
-- if the image is part of a group, make it the leader
|
||||||
|
for _, image in ipairs(images) do
|
||||||
|
if #image:get_group_members() > 1 then
|
||||||
|
image:make_group_leader()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dt.gui.libs.global_toolbox.grouping then
|
||||||
|
-- toggle the grouping to make the new leader show
|
||||||
|
toggle_global_toolbox_grouping()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make_existing_hif_group_leader(images)
|
||||||
|
for _, image in ipairs(images) do
|
||||||
|
if string.lower(df.get_filetype(image.filename)) == "hif" then
|
||||||
|
if #image:get_group_members() > 1 then
|
||||||
|
image:make_group_leader()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dt.gui.libs.global_toolbox.grouping then
|
||||||
|
-- toggle the grouping to make the new leader show
|
||||||
|
toggle_global_toolbox_grouping()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
if dt.preferences.read(MODULE, "on_import", "bool") then
|
||||||
|
dt.destroy_event(MODULE, "post-import-film")
|
||||||
|
dt.destroy_event(MODULE, "post-import-image")
|
||||||
|
end
|
||||||
|
dt.destroy_event(MODULE .. "_collect", "shortcut")
|
||||||
|
dt.destroy_event(MODULE .. "_select", "shortcut")
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- E V E N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
if dt.preferences.read(MODULE, "on_import", "bool") then
|
||||||
|
dt.register_event(MODULE, "post-import-film",
|
||||||
|
function(event, film_roll)
|
||||||
|
-- ignore the film roll, it contains all the images, not just the imported
|
||||||
|
local images = jgloi.images
|
||||||
|
if #images > 0 then
|
||||||
|
jgloi.images = {}
|
||||||
|
make_hif_group_leader(images)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(MODULE, "post-import-image",
|
||||||
|
function(event, image)
|
||||||
|
if string.lower(df.get_filetype(image.filename)) == "hif" then
|
||||||
|
table.insert(jgloi.images, image)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
dt.register_event(MODULE .. "_collect", "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
-- ignore the film roll, it contains all the images, not just the imported
|
||||||
|
local images = dt.collection
|
||||||
|
make_existing_hif_group_leader(images)
|
||||||
|
end,
|
||||||
|
_("Make hif group leader for collection")
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(MODULE .. "_select", "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
local images = dt.gui.selection()
|
||||||
|
make_existing_hif_group_leader(images)
|
||||||
|
end,
|
||||||
|
_("Make hif group leader for selection")
|
||||||
|
)
|
||||||
|
|
||||||
|
return script_data
|
||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
196
contrib/jpg_group_leader.lua
Normal file
196
contrib/jpg_group_leader.lua
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
--[[
|
||||||
|
|
||||||
|
jpg_group_leader.lua - Make jpg image group leader
|
||||||
|
|
||||||
|
Copyright (C) 2024 Bill Ferguson <wpferguson@gmail.com>.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
]]
|
||||||
|
--[[
|
||||||
|
jpg_group_leader - Make jpg image group leader
|
||||||
|
|
||||||
|
After a film roll is imported, check for RAW-JPG image groups
|
||||||
|
and make the JPG image the group leader. This is on by default
|
||||||
|
but can be disabled in preferences.
|
||||||
|
|
||||||
|
Shortcuts are included to filter existing collections or
|
||||||
|
selections of images and make the jpg the group leader.
|
||||||
|
|
||||||
|
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
|
||||||
|
None
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
Start script from script_manager
|
||||||
|
Assign keys to the shortcuts
|
||||||
|
|
||||||
|
BUGS, COMMENTS, SUGGESTIONS
|
||||||
|
Bill Ferguson <wpferguson@gmail.com>
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local df = require "lib/dtutils.file"
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- C O N S T A N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local MODULE = "jpg_group_leader"
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- A P I C H E C K
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
du.check_min_api_version("7.0.0", MODULE)
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- S C R I P T M A N A G E R I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local script_data = {}
|
||||||
|
|
||||||
|
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.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
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- I 1 8 N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local gettext = dt.gettext
|
||||||
|
|
||||||
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
|
gettext.bindtextdomain(MODULE, dt.configuration.config_dir .. "/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext(MODULE, msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- P R E F E R E N C E S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
dt.preferences.register(MODULE, "on_import", "bool", _("make jpg group leader on import"), _("automatically make the jpg file the group leader when raw + jpg are imported"), true)
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- N A M E S P A C E
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local jgloi = {}
|
||||||
|
jgloi.images = {}
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- F U N C T I O N S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function toggle_global_toolbox_grouping()
|
||||||
|
dt.gui.libs.global_toolbox.grouping = false
|
||||||
|
dt.gui.libs.global_toolbox.grouping = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- M A I N P R O G R A M
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function make_jpg_group_leader(images)
|
||||||
|
-- if the image is part of a group, make it the leader
|
||||||
|
for _, image in ipairs(images) do
|
||||||
|
if #image:get_group_members() > 1 then
|
||||||
|
image:make_group_leader()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dt.gui.libs.global_toolbox.grouping then
|
||||||
|
-- toggle the grouping to make the new leader show
|
||||||
|
toggle_global_toolbox_grouping()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make_existing_jpg_group_leader(images)
|
||||||
|
for _, image in ipairs(images) do
|
||||||
|
if string.lower(df.get_filetype(image.filename)) == "jpg" then
|
||||||
|
if #image:get_group_members() > 1 then
|
||||||
|
image:make_group_leader()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if dt.gui.libs.global_toolbox.grouping then
|
||||||
|
-- toggle the grouping to make the new leader show
|
||||||
|
toggle_global_toolbox_grouping()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- D A R K T A B L E I N T E G R A T I O N
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
local function destroy()
|
||||||
|
if dt.preferences.read(MODULE, "on_import", "bool") then
|
||||||
|
dt.destroy_event(MODULE, "post-import-film")
|
||||||
|
dt.destroy_event(MODULE, "post-import-image")
|
||||||
|
end
|
||||||
|
dt.destroy_event(MODULE .. "_collect", "shortcut")
|
||||||
|
dt.destroy_event(MODULE .. "_select", "shortcut")
|
||||||
|
end
|
||||||
|
|
||||||
|
script_data.destroy = destroy
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- E V E N T S
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
if dt.preferences.read(MODULE, "on_import", "bool") then
|
||||||
|
dt.register_event(MODULE, "post-import-film",
|
||||||
|
function(event, film_roll)
|
||||||
|
-- ignore the film roll, it contains all the images, not just the imported
|
||||||
|
local images = jgloi.images
|
||||||
|
if #images > 0 then
|
||||||
|
jgloi.images = {}
|
||||||
|
make_jpg_group_leader(images)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(MODULE, "post-import-image",
|
||||||
|
function(event, image)
|
||||||
|
if string.lower(df.get_filetype(image.filename)) == "jpg" then
|
||||||
|
table.insert(jgloi.images, image)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
dt.register_event(MODULE .. "_collect", "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
-- ignore the film roll, it contains all the images, not just the imported
|
||||||
|
local images = dt.collection
|
||||||
|
make_existing_jpg_group_leader(images)
|
||||||
|
end,
|
||||||
|
_("Make jpg group leader for collection")
|
||||||
|
)
|
||||||
|
|
||||||
|
dt.register_event(MODULE .. "_select", "shortcut",
|
||||||
|
function(event, shortcut)
|
||||||
|
local images = dt.gui.selection()
|
||||||
|
make_existing_jpg_group_leader(images)
|
||||||
|
end,
|
||||||
|
_("Make jpg group leader for selection")
|
||||||
|
)
|
||||||
|
|
||||||
|
return script_data
|
||||||
@@ -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/")
|
||||||
@@ -334,7 +335,7 @@ local defaultDir = ''
|
|||||||
if dt.configuration.running_os == "windows" then
|
if dt.configuration.running_os == "windows" then
|
||||||
defaultDir = os.getenv("USERPROFILE")
|
defaultDir = os.getenv("USERPROFILE")
|
||||||
elseif dt.configuration.running_os == "macos" then
|
elseif dt.configuration.running_os == "macos" then
|
||||||
defaultDir = os.getenv("home")
|
defaultDir = os.getenv("HOME")
|
||||||
else
|
else
|
||||||
local handle = io.popen("xdg-user-dir DESKTOP")
|
local handle = io.popen("xdg-user-dir DESKTOP")
|
||||||
defaultDir = handle:read()
|
defaultDir = handle:read()
|
||||||
|
|||||||
105
contrib/passport_guide_germany.lua
Normal file
105
contrib/passport_guide_germany.lua
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
--[[
|
||||||
|
German passport photo cropping guide for darktable.
|
||||||
|
Derived from the passport cropping guide by Kåre Hampf.
|
||||||
|
|
||||||
|
copyright (c) 2017 Kåre Hampf
|
||||||
|
copyright (c) 2024 Christian Sültrop
|
||||||
|
|
||||||
|
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/>.
|
||||||
|
]]
|
||||||
|
|
||||||
|
--[[
|
||||||
|
PASSPORT CROPPING GUIDE
|
||||||
|
Guides for cropping passport and ID card ("Personalausweis") photos based on the "Passbild-Schablone"
|
||||||
|
from the German Federal Ministry of the Interior and Community.
|
||||||
|
(https://www.bmi.bund.de/SharedDocs/downloads/DE/veroeffentlichungen/themen/moderne-verwaltung/ausweise/passbild-schablone-erwachsene.pdf?__blob=publicationFile&v=3)
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
|
||||||
|
* add the following line in the file $CONFIGDIR/luarc
|
||||||
|
require "passport_guide_germany"
|
||||||
|
* (optional) add the line:
|
||||||
|
"plugins/darkroom/clipping/extra_aspect_ratios/passport 35x45mm=45:35"
|
||||||
|
to $CONFIGDIR/darktablerc
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
* when using the cropping tool, select "Passport Photo Germany" as guide and if you added the line in yout rc
|
||||||
|
select "passport 35x45mm" as aspect
|
||||||
|
]]
|
||||||
|
|
||||||
|
local dt = require "darktable"
|
||||||
|
local du = require "lib/dtutils"
|
||||||
|
local gettext = dt.gettext
|
||||||
|
|
||||||
|
du.check_min_api_version("2.0.0", "passport_guide_germany")
|
||||||
|
|
||||||
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
|
gettext.bindtextdomain("passport_guide_germany",dt.configuration.config_dir.."/lua/locale/")
|
||||||
|
|
||||||
|
local function _(msgid)
|
||||||
|
return gettext.dgettext("passport_guide_germany", msgid)
|
||||||
|
end
|
||||||
|
|
||||||
|
dt.guides.register_guide("Passport Photo Germany",
|
||||||
|
-- draw
|
||||||
|
function(cairo, x, y, width, height, zoom_scale)
|
||||||
|
local _width, _height
|
||||||
|
|
||||||
|
-- get the max 35x45 rectangle
|
||||||
|
local aspect_ratio = 45 / 35
|
||||||
|
if width * aspect_ratio > height then
|
||||||
|
_width = height / aspect_ratio
|
||||||
|
_height = height
|
||||||
|
else
|
||||||
|
_width = width
|
||||||
|
_height = width * aspect_ratio
|
||||||
|
end
|
||||||
|
|
||||||
|
cairo:save()
|
||||||
|
|
||||||
|
cairo:translate(x + (width - _width) / 2, y + (height - _height) / 2)
|
||||||
|
cairo:scale(_width / 35, _height / 45)
|
||||||
|
|
||||||
|
-- the outer rectangle
|
||||||
|
cairo:rectangle( 0, 0, 35, 45)
|
||||||
|
|
||||||
|
-- Nose position: The nose tip must be between these lines
|
||||||
|
cairo:draw_line(15.5, 45, 15.5, 13)
|
||||||
|
cairo:draw_line(35-15.5, 45, 35-15.5, 13)
|
||||||
|
|
||||||
|
-- Face height
|
||||||
|
-- optimum face height: The upper end of the head should be between these lines
|
||||||
|
cairo:draw_line(0, 4, 35, 4)
|
||||||
|
cairo:draw_line(0, 8, 35, 8)
|
||||||
|
|
||||||
|
-- tolerated face height: The upper end of the head must not be below this line
|
||||||
|
cairo:draw_line(6, 13, 30, 13)
|
||||||
|
|
||||||
|
-- Eye area: The eyes must be between these lines
|
||||||
|
cairo:draw_line(0, 13, 35, 13)
|
||||||
|
cairo:draw_line(0, 23, 35, 23)
|
||||||
|
|
||||||
|
-- Cheek line: The cheek must lie on this line
|
||||||
|
cairo:draw_line(9, 45-5, 27, 45-5)
|
||||||
|
|
||||||
|
cairo:restore()
|
||||||
|
end,
|
||||||
|
-- gui
|
||||||
|
function()
|
||||||
|
return dt.new_widget("label"){label = _("Passport Photo Germany"), halign = "start"}
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on; hl Lua;
|
||||||
|
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||||
@@ -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",
|
||||||
|
|||||||
@@ -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 "/"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ local debug = require "darktable.debug"
|
|||||||
|
|
||||||
-- check API version
|
-- check API version
|
||||||
du.check_min_api_version("7.0.0", "rename-tags")
|
du.check_min_api_version("7.0.0", "rename-tags")
|
||||||
|
du.deprecated("contrib/rename-tags.lua","darktable release 4.0")
|
||||||
|
|
||||||
-- return data structure for script_manager
|
-- return data structure for script_manager
|
||||||
|
|
||||||
@@ -42,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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|||||||
77
contrib/select_non_existing.lua
Normal file
77
contrib/select_non_existing.lua
Normal 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
|
||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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/")
|
||||||
|
|||||||
@@ -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 "/"
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
@@ -285,7 +286,7 @@ local defaultVideoDir = ''
|
|||||||
if dt.configuration.running_os == "windows" then
|
if dt.configuration.running_os == "windows" then
|
||||||
defaultVideoDir = os.getenv("USERPROFILE")..PS .."videos"
|
defaultVideoDir = os.getenv("USERPROFILE")..PS .."videos"
|
||||||
elseif dt.configuration.running_os == "macos" then
|
elseif dt.configuration.running_os == "macos" then
|
||||||
defaultVideoDir = os.getenv("home")..PS.."Videos"
|
defaultVideoDir = os.getenv("HOME")..PS.."Videos"
|
||||||
else
|
else
|
||||||
local handle = io.popen("xdg-user-dir VIDEOS")
|
local handle = io.popen("xdg-user-dir VIDEOS")
|
||||||
defaultVideoDir = handle:read()
|
defaultVideoDir = handle:read()
|
||||||
|
|||||||
105
examples/gui_action.lua
Normal file
105
examples/gui_action.lua
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
local dt = require "darktable"
|
||||||
|
|
||||||
|
local NaN = 0/0
|
||||||
|
|
||||||
|
local wg = {}
|
||||||
|
|
||||||
|
wg.action = dt.new_widget("entry"){
|
||||||
|
text = "lib/filter/view",
|
||||||
|
placeholder = "action path",
|
||||||
|
tooltip = "enter the full path of an action, for example 'lib/filter/view'"
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.instance = dt.new_widget("combobox"){
|
||||||
|
label = "instance",
|
||||||
|
tooltip = "the instance of an image processing module to execute action on",
|
||||||
|
"0", "+1", "-1", "+2", "-2", "+3", "-3", "+4", "-4", "+5", "-5", "+6", "-6", "+7", "-7", "+8", "-8", "+9", "-9"
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.element = dt.new_widget("entry"){
|
||||||
|
text = "",
|
||||||
|
placeholder = "action element",
|
||||||
|
tooltip = "enter the element of an action, for example 'selection', or leave empty for default"
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.effect = dt.new_widget("entry"){
|
||||||
|
text = "next",
|
||||||
|
placeholder = "action effect",
|
||||||
|
tooltip = "enter the effect of an action, for example 'next', or leave empty for default"
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.speed = dt.new_widget("entry"){
|
||||||
|
text = "1",
|
||||||
|
placeholder = "action speed",
|
||||||
|
tooltip = "enter the speed to use in action execution, or leave empty to only read state"
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.check = dt.new_widget("check_button"){
|
||||||
|
label = 'perform action',
|
||||||
|
tooltip = 'perform action or only read return',
|
||||||
|
clicked_callback = function()
|
||||||
|
wg.speed.sensitive = wg.check.value
|
||||||
|
end,
|
||||||
|
value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.return_value = dt.new_widget("entry"){
|
||||||
|
text = "",
|
||||||
|
sensitive = false
|
||||||
|
}
|
||||||
|
|
||||||
|
dt.register_lib(
|
||||||
|
"execute_action", -- Module name
|
||||||
|
"execute gui actions", -- name
|
||||||
|
true, -- expandable
|
||||||
|
false, -- resetable
|
||||||
|
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 100},
|
||||||
|
[dt.gui.views.darkroom] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 100}},
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "vertical",
|
||||||
|
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
dt.new_widget("label"){label = "action path", halign = "start"},
|
||||||
|
wg.action
|
||||||
|
},
|
||||||
|
wg.instance,
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
dt.new_widget("label"){label = "element", halign = "start"},
|
||||||
|
wg.element
|
||||||
|
},
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
dt.new_widget("label"){label = "effect", halign = "start"},
|
||||||
|
wg.effect
|
||||||
|
},
|
||||||
|
wg.check,
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
dt.new_widget("label"){label = "speed", halign = "start"},
|
||||||
|
wg.speed
|
||||||
|
},
|
||||||
|
dt.new_widget("button")
|
||||||
|
{
|
||||||
|
label = "execute action",
|
||||||
|
tooltip = "execute the action specified in the fields above",
|
||||||
|
clicked_callback = function(_)
|
||||||
|
local sp = NaN
|
||||||
|
if wg.check.value then sp = wg.speed.text end
|
||||||
|
wg.return_value.text = dt.gui.action(wg.action.text, wg.instance.value, wg.element.text, wg.effect.text, sp)
|
||||||
|
end
|
||||||
|
},
|
||||||
|
dt.new_widget("box")
|
||||||
|
{
|
||||||
|
orientation = "horizontal",
|
||||||
|
dt.new_widget("label"){label = "return value:", halign = "start"},
|
||||||
|
wg.return_value
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
163
examples/x-touch.lua
Normal file
163
examples/x-touch.lua
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
--[[
|
||||||
|
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.2.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 sigmoid rgb primaries is focused,
|
||||||
|
-- check sliders
|
||||||
|
elseif dt.gui.action("iop/sigmoid", "focus") ~= 0 and k <8 then
|
||||||
|
local e = { "red attenuation", "red rotation", "green attenuation", "green rotation", "blue attenuation", "blue rotation", "recover purity" }
|
||||||
|
which = "iop/sigmoid/primaries/"..e[k]
|
||||||
|
|
||||||
|
-- if the rgb primaries is focused,
|
||||||
|
-- check sliders
|
||||||
|
elseif dt.gui.action("iop/primaries", "focus") ~= 0 and k >=1 then
|
||||||
|
local e = { "red hue", "red purity", "green hue", "green purity", "blue hue", "blue purity", "tint hue", "tint purity" }
|
||||||
|
which = "iop/primaries/" ..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
|
||||||
@@ -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
|
||||||
@@ -330,4 +368,29 @@ function dtutils.find_image_by_id(imgid)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dtutils.libdoc.functions["deprecated"] = {
|
||||||
|
Name = [[deprecated]],
|
||||||
|
Synopsis = [[print deprecation warning]],
|
||||||
|
Usage = [[local du = require "lib/dtutils"
|
||||||
|
|
||||||
|
du.deprecated(script_name, removal_string)
|
||||||
|
script_name - name of the script being deprecated
|
||||||
|
removal_strubg - a string explaining when the script will be removed]],
|
||||||
|
Description = [[deprecated prints an error message saying the script is deprecated and when it will be removed]],
|
||||||
|
Return_Value = [[]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[local du = require "lib/dtutils"
|
||||||
|
du.deprecated("contrib/rename-tags.lua", "darktable release 4.0")]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils.deprecated(script_name, removal_string)
|
||||||
|
dt.print_toast("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
|
||||||
|
dt.print_error("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return dtutils
|
return dtutils
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ end
|
|||||||
|
|
||||||
local function _search_for_bin_nix(bin)
|
local function _search_for_bin_nix(bin)
|
||||||
local result = false
|
local result = false
|
||||||
local p = io.popen("which " .. bin)
|
local p = io.popen("command -v " .. bin)
|
||||||
local output = p:read("*a")
|
local output = p:read("*a")
|
||||||
p:close()
|
p:close()
|
||||||
if string.len(output) > 0 then
|
if string.len(output) > 0 then
|
||||||
@@ -394,125 +394,32 @@ function dtutils_file.check_if_bin_exists(bin)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["split_filepath"] = {
|
-- the following path, filename, etc functions have
|
||||||
Name = [[split_filepath]],
|
-- moved to the string library since they are string
|
||||||
Synopsis = [[split a filepath into parts]],
|
-- manipulation functions, and to prevent circular
|
||||||
Usage = [[local df = require "lib/dtutils.file"
|
-- library inclusiion.
|
||||||
|
|
||||||
local result = df.split_filepath(filepath)
|
-- these functions are left here for compatibility
|
||||||
filepath - string - path and filename]],
|
-- with older scripts
|
||||||
Description = [[split_filepath splits a filepath into the path, filename, basename and filetype and puts
|
|
||||||
that in a table]],
|
|
||||||
Return_Value = [[result - table - a table containing the path, filename, basename, and filetype]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_file.split_filepath(str)
|
function dtutils_file.split_filepath(str)
|
||||||
-- strip out single quotes from quoted pathnames
|
return ds.split_filepath(str)
|
||||||
str = string.gsub(str, "'", "")
|
|
||||||
str = string.gsub(str, '"', '')
|
|
||||||
local result = {}
|
|
||||||
-- Thank you Tobias Jakobs for the awesome regular expression, which I tweaked a little
|
|
||||||
result["path"], result["filename"], result["basename"], result["filetype"] = string.match(str, "(.-)(([^\\/]-)%.?([^%.\\/]*))$")
|
|
||||||
if result["basename"] == "" and result["filetype"]:len() > 1 then
|
|
||||||
result["basename"] = result["filetype"]
|
|
||||||
result["filetype"] = ""
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["get_path"] = {
|
|
||||||
Name = [[get_path]],
|
|
||||||
Synopsis = [[get the path from a file path]],
|
|
||||||
Usage = [[local df = require "lib/dtutils.file"
|
|
||||||
|
|
||||||
local result = df.get_path(filepath)
|
|
||||||
filepath - string - path and filename]],
|
|
||||||
Description = [[get_path strips the filename and filetype from a path and returns the path]],
|
|
||||||
Return_Value = [[result - string - the path]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_file.get_path(str)
|
function dtutils_file.get_path(str)
|
||||||
local parts = dtutils_file.split_filepath(str)
|
return ds.get_path(str)
|
||||||
return parts["path"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["get_filename"] = {
|
|
||||||
Name = [[get_filename]],
|
|
||||||
Synopsis = [[get the filename and extension from a file path]],
|
|
||||||
Usage = [[local df = require "lib/dtutils.file"
|
|
||||||
|
|
||||||
local result = df.get_filename(filepath)
|
|
||||||
filepath - string - path and filename]],
|
|
||||||
Description = [[get_filename strips the path from a filepath and returns the filename]],
|
|
||||||
Return_Value = [[result - string - the file name and type]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_file.get_filename(str)
|
function dtutils_file.get_filename(str)
|
||||||
local parts = dtutils_file.split_filepath(str)
|
return ds.get_filename(str)
|
||||||
return parts["filename"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["get_basename"] = {
|
|
||||||
Name = [[get_basename]],
|
|
||||||
Synopsis = [[get the filename without the path or extension]],
|
|
||||||
Usage = [[local df = require "lib/dtutils.file"
|
|
||||||
|
|
||||||
local result = df.get_basename(filepath)
|
|
||||||
filepath - string - path and filename]],
|
|
||||||
Description = [[get_basename returns the name of the file without the path or filetype
|
|
||||||
]],
|
|
||||||
Return_Value = [[result - string - the basename of the file]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_file.get_basename(str)
|
function dtutils_file.get_basename(str)
|
||||||
local parts = dtutils_file.split_filepath(str)
|
return ds.get_basename(str)
|
||||||
return parts["basename"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["get_filetype"] = {
|
|
||||||
Name = [[get_filetype]],
|
|
||||||
Synopsis = [[get the filetype from a filename]],
|
|
||||||
Usage = [[local df = require "lib/dtutils.file"
|
|
||||||
|
|
||||||
local result = df.get_filetype(filepath)
|
|
||||||
filepath - string - path and filename]],
|
|
||||||
Description = [[get_filetype returns the filetype from the supplied filepath]],
|
|
||||||
Return_Value = [[result - string - the filetype]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_file.get_filetype(str)
|
function dtutils_file.get_filetype(str)
|
||||||
local parts = dtutils_file.split_filepath(str)
|
return ds.get_filetype(str)
|
||||||
return parts["filetype"]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -294,6 +294,127 @@ function dtutils_string.sanitize_lua(str)
|
|||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
dtutils_string.libdoc.functions["split_filepath"] = {
|
||||||
|
Name = [[split_filepath]],
|
||||||
|
Synopsis = [[split a filepath into parts]],
|
||||||
|
Usage = [[local ds = require "lib/dtutils.string"
|
||||||
|
|
||||||
|
local result = ds.split_filepath(filepath)
|
||||||
|
filepath - string - path and filename]],
|
||||||
|
Description = [[split_filepath splits a filepath into the path, filename, basename and filetype and puts
|
||||||
|
that in a table]],
|
||||||
|
Return_Value = [[result - table - a table containing the path, filename, basename, and filetype]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils_string.split_filepath(str)
|
||||||
|
-- strip out single quotes from quoted pathnames
|
||||||
|
str = string.gsub(str, "'", "")
|
||||||
|
str = string.gsub(str, '"', '')
|
||||||
|
local result = {}
|
||||||
|
-- Thank you Tobias Jakobs for the awesome regular expression, which I tweaked a little
|
||||||
|
result["path"], result["filename"], result["basename"], result["filetype"] = string.match(str, "(.-)(([^\\/]-)%.?([^%.\\/]*))$")
|
||||||
|
if result["basename"] == "" and result["filetype"]:len() > 1 then
|
||||||
|
result["basename"] = result["filetype"]
|
||||||
|
result["filetype"] = ""
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
dtutils_string.libdoc.functions["get_path"] = {
|
||||||
|
Name = [[get_path]],
|
||||||
|
Synopsis = [[get the path from a file path]],
|
||||||
|
Usage = [[local ds = require "lib/dtutils.string"
|
||||||
|
|
||||||
|
local result = ds.get_path(filepath)
|
||||||
|
filepath - string - path and filename]],
|
||||||
|
Description = [[get_path strips the filename and filetype from a path and returns the path]],
|
||||||
|
Return_Value = [[result - string - the path]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils_string.get_path(str)
|
||||||
|
local parts = dtutils_string.split_filepath(str)
|
||||||
|
return parts["path"]
|
||||||
|
end
|
||||||
|
|
||||||
|
dtutils_string.libdoc.functions["get_filename"] = {
|
||||||
|
Name = [[get_filename]],
|
||||||
|
Synopsis = [[get the filename and extension from a file path]],
|
||||||
|
Usage = [[local ds = require "lib/dtutils.string"
|
||||||
|
|
||||||
|
local result = ds.get_filename(filepath)
|
||||||
|
filepath - string - path and filename]],
|
||||||
|
Description = [[get_filename strips the path from a filepath and returns the filename]],
|
||||||
|
Return_Value = [[result - string - the file name and type]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils_string.get_filename(str)
|
||||||
|
local parts = dtutils_string.split_filepath(str)
|
||||||
|
return parts["filename"]
|
||||||
|
end
|
||||||
|
|
||||||
|
dtutils_string.libdoc.functions["get_basename"] = {
|
||||||
|
Name = [[get_basename]],
|
||||||
|
Synopsis = [[get the filename without the path or extension]],
|
||||||
|
Usage = [[local ds = require "lib/dtutils.string"
|
||||||
|
|
||||||
|
local result = ds.get_basename(filepath)
|
||||||
|
filepath - string - path and filename]],
|
||||||
|
Description = [[get_basename returns the name of the file without the path or filetype
|
||||||
|
]],
|
||||||
|
Return_Value = [[result - string - the basename of the file]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils_string.get_basename(str)
|
||||||
|
local parts = dtutils_string.split_filepath(str)
|
||||||
|
return parts["basename"]
|
||||||
|
end
|
||||||
|
|
||||||
|
dtutils_string.libdoc.functions["get_filetype"] = {
|
||||||
|
Name = [[get_filetype]],
|
||||||
|
Synopsis = [[get the filetype from a filename]],
|
||||||
|
Usage = [[local ds = require "lib/dtutils.string"
|
||||||
|
|
||||||
|
local result = ds.get_filetype(filepath)
|
||||||
|
filepath - string - path and filename]],
|
||||||
|
Description = [[get_filetype returns the filetype from the supplied filepath]],
|
||||||
|
Return_Value = [[result - string - the filetype]],
|
||||||
|
Limitations = [[]],
|
||||||
|
Example = [[]],
|
||||||
|
See_Also = [[]],
|
||||||
|
Reference = [[]],
|
||||||
|
License = [[]],
|
||||||
|
Copyright = [[]],
|
||||||
|
}
|
||||||
|
|
||||||
|
function dtutils_string.get_filetype(str)
|
||||||
|
local parts = dtutils_string.split_filepath(str)
|
||||||
|
return parts["filetype"]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return dtutils_string
|
return dtutils_string
|
||||||
|
|||||||
12
locale/de_DE/LC_MESSAGES/select_non_existing.po
Normal file
12
locale/de_DE/LC_MESSAGES/select_non_existing.po
Normal 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"
|
||||||
85
locale/fr_FR/LC_MESSAGES/OpenInExplorer.po
Normal file
85
locale/fr_FR/LC_MESSAGES/OpenInExplorer.po
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: 2022-06-27 17:22+0200\n"
|
||||||
|
"PO-Revision-Date: 2022-06-27 17:36+0200\n"
|
||||||
|
"Last-Translator: Manuel PINTOR <manu@lepassepartout.fr>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"Language: fr_FR\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 2.3\n"
|
||||||
|
"X-Poedit-Basepath: ../../../contrib\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
"X-Poedit-SearchPath-0: OpenInExplorer.lua\n"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:79
|
||||||
|
msgid ""
|
||||||
|
"OpenInExplorer plug-in only supports Linux, macOS, and Windows at this time"
|
||||||
|
msgstr ""
|
||||||
|
"Le script OpenInExplorer ne fonctionne que sur Linux, macOS et Windows pour "
|
||||||
|
"le moment"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:95
|
||||||
|
msgid ""
|
||||||
|
"No links directory selected.\n"
|
||||||
|
"Please check the dt preferences (lua options)"
|
||||||
|
msgstr ""
|
||||||
|
"Aucun répertoire de liens sélectionné.\n"
|
||||||
|
"Voir dans les préférences dt > options lua"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:99
|
||||||
|
#, lua-format
|
||||||
|
msgid ""
|
||||||
|
"Links directory '%s' not found.\n"
|
||||||
|
"Please check the dt preferences (lua options)"
|
||||||
|
msgstr ""
|
||||||
|
"Répertoire de liens '%s' inexistant.\n"
|
||||||
|
"Voir dans les préférences dt > options lua"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:156
|
||||||
|
msgid "Failed to create links. Missing rights?"
|
||||||
|
msgstr "Erreur de création de liens. Droits insuffisants ?"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:172
|
||||||
|
msgid "Please select an image"
|
||||||
|
msgstr "Sélectionner une image SVP"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:178
|
||||||
|
msgid "Please select fewer images (max. 15)"
|
||||||
|
msgstr "Sélectionner moins d'images SVP (max. 15)"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:203
|
||||||
|
msgid "show in file explorer"
|
||||||
|
msgstr "afficher dans le gestionnaire de fichiers"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:205
|
||||||
|
msgid "Open the file manager at the selected image's location"
|
||||||
|
msgstr "Ouvre le gestionnaire de fichiers à l'endroit de l'image sélectionnée"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:212
|
||||||
|
msgid "OpenInExplorer: linked files directory"
|
||||||
|
msgstr "OpenInExplorer : répertoire des fichiers liés"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:213
|
||||||
|
msgid ""
|
||||||
|
"Directory to store the links to the file names. Requires restart to take "
|
||||||
|
"effect"
|
||||||
|
msgstr ""
|
||||||
|
"Répertoire dans lequel enregistrer les liens sur les fichiers. Nécessite un "
|
||||||
|
"redémarrage de dt"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:216
|
||||||
|
msgid "Select directory"
|
||||||
|
msgstr "Sélectionner un répertoire"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:222
|
||||||
|
msgid "OpenInExplorer: use links"
|
||||||
|
msgstr "OpenInExplorer : utiliser des liens"
|
||||||
|
|
||||||
|
#: OpenInExplorer.lua:223
|
||||||
|
msgid "Use links instead of multiple windows. Requires restart to take effect"
|
||||||
|
msgstr ""
|
||||||
|
"Utiliser des liens plutôt que de multiples fenêtres. Nécessite un "
|
||||||
|
"redémarrage de dt"
|
||||||
62
locale/it_IT/LC_MESSAGES/executable_manager.po
Normal file
62
locale/it_IT/LC_MESSAGES/executable_manager.po
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
#
|
||||||
|
# Maurizio Paglia <mpaglia0@gmail.com>, 2022.
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2022-07-11 22:19+0200\n"
|
||||||
|
"PO-Revision-Date: 2022-07-11 22:21+0200\n"
|
||||||
|
"Last-Translator: Maurizio Paglia <mpaglia0@gmail.com>\n"
|
||||||
|
"Language-Team: Italian <>\n"
|
||||||
|
"Language: it\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"X-Generator: Lokalize 21.12.3\n"
|
||||||
|
|
||||||
|
#: executable_manager.lua:144
|
||||||
|
msgid "No executable paths found, exiting..."
|
||||||
|
msgstr "Nessun percorso con eseguibili, esco..."
|
||||||
|
|
||||||
|
#: executable_manager.lua:160
|
||||||
|
msgid "select an executable"
|
||||||
|
msgstr "seleziona un eseguibile"
|
||||||
|
|
||||||
|
#: executable_manager.lua:160
|
||||||
|
msgid "search path for executable"
|
||||||
|
msgstr "cerca il percorso dell'eseguibile"
|
||||||
|
|
||||||
|
#: executable_manager.lua:169
|
||||||
|
msgid "select "
|
||||||
|
msgstr "seleziona"
|
||||||
|
|
||||||
|
#: executable_manager.lua:169
|
||||||
|
msgid " executable"
|
||||||
|
msgstr " eseguibile"
|
||||||
|
|
||||||
|
#: executable_manager.lua:190
|
||||||
|
msgid "select executable to modify"
|
||||||
|
msgstr "Seleziona l'eseguibile da modificare"
|
||||||
|
|
||||||
|
#: executable_manager.lua:205
|
||||||
|
msgid "current"
|
||||||
|
msgstr "Attuale"
|
||||||
|
|
||||||
|
#: executable_manager.lua:207
|
||||||
|
msgid "select"
|
||||||
|
msgstr "Seleziona"
|
||||||
|
|
||||||
|
#: executable_manager.lua:209
|
||||||
|
msgid "reset"
|
||||||
|
msgstr "Cancella"
|
||||||
|
|
||||||
|
#: executable_manager.lua:212
|
||||||
|
msgid "Clear path for "
|
||||||
|
msgstr "Cancella il percorso di "
|
||||||
|
|
||||||
|
#: executable_manager.lua:211
|
||||||
|
msgid "clear"
|
||||||
|
msgstr "Pulisci"
|
||||||
190
locale/it_IT/LC_MESSAGES/script_manager.po
Normal file
190
locale/it_IT/LC_MESSAGES/script_manager.po
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
# French messages for script_manager.lua
|
||||||
|
# Christophe Agathon <christophe.agathon@gmail.com>, 2020.
|
||||||
|
# Maurizio Paglia <mpaglia0@gmail.com>, 2021, 2022.
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"POT-Creation-Date: 2020-12-28 10:22+0100\n"
|
||||||
|
"PO-Revision-Date: 2022-07-11 22:03+0200\n"
|
||||||
|
"Last-Translator: Maurizio Paglia <mpaglia0@gmail.com>\n"
|
||||||
|
"Language-Team: Italian <>\n"
|
||||||
|
"Language: fr_FR\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Lokalize 21.12.3\n"
|
||||||
|
"X-Poedit-Basepath: ../../../tools\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
"X-Poedit-KeywordsList: _\n"
|
||||||
|
"X-Poedit-SearchPath-0: script_manager.lua\n"
|
||||||
|
|
||||||
|
#: script_manager.lua:190
|
||||||
|
msgid "Cant read from "
|
||||||
|
msgstr "Non posso leggere da "
|
||||||
|
|
||||||
|
#: script_manager.lua:204
|
||||||
|
msgid "Loaded "
|
||||||
|
msgstr "Script caricato "
|
||||||
|
|
||||||
|
#: script_manager.lua:207
|
||||||
|
msgid " failed to load"
|
||||||
|
msgstr "Non riesco a caricare lo script"
|
||||||
|
|
||||||
|
#: script_manager.lua:223
|
||||||
|
msgid " will not start when darktable is restarted"
|
||||||
|
msgstr " non verrà avviato al riavvio di darktable"
|
||||||
|
|
||||||
|
#: script_manager.lua:281 script_manager.lua:345
|
||||||
|
msgid "find command is "
|
||||||
|
msgstr "Il comando find è "
|
||||||
|
|
||||||
|
#: script_manager.lua:321
|
||||||
|
msgid "lua scripts successfully updated"
|
||||||
|
msgstr "Gli script lua sono stati correttamente aggiornati"
|
||||||
|
|
||||||
|
#: script_manager.lua:381
|
||||||
|
msgid "category "
|
||||||
|
msgstr "Categoria"
|
||||||
|
|
||||||
|
#: script_manager.lua:381
|
||||||
|
msgid " is already in use. Please specify a different category name."
|
||||||
|
msgstr " è già utilizzato. Prego specificare un nome differente."
|
||||||
|
|
||||||
|
#: script_manager.lua:410
|
||||||
|
msgid "scripts successfully installed into category "
|
||||||
|
msgstr "Gli script sono stati installati correttamente nella categoria "
|
||||||
|
|
||||||
|
#: script_manager.lua:426
|
||||||
|
msgid "No scripts found to install"
|
||||||
|
msgstr "Non trovo script da installare"
|
||||||
|
|
||||||
|
#: script_manager.lua:430
|
||||||
|
msgid "failed to download scripts"
|
||||||
|
msgstr "Non riesco a scaricare gli script"
|
||||||
|
|
||||||
|
# Peut-être que « activé » serait mieux, mais ce n'est pas la traduction de « started »
|
||||||
|
#: script_manager.lua:458
|
||||||
|
msgid " started"
|
||||||
|
msgstr " avviato"
|
||||||
|
|
||||||
|
# Peut-être que « désactivé » serait mieux, mais ce n'est pas la traduction de « stopped »
|
||||||
|
#: script_manager.lua:460
|
||||||
|
msgid " stopped"
|
||||||
|
msgstr " bloccato"
|
||||||
|
|
||||||
|
#: script_manager.lua:545
|
||||||
|
msgid "Page "
|
||||||
|
msgstr "Pag."
|
||||||
|
|
||||||
|
#: script_manager.lua:545
|
||||||
|
msgid " of "
|
||||||
|
msgstr " di "
|
||||||
|
|
||||||
|
#: script_manager.lua:674
|
||||||
|
msgid "scripts to update"
|
||||||
|
msgstr "Script da aggiornare"
|
||||||
|
|
||||||
|
#: script_manager.lua:675
|
||||||
|
msgid "select the scripts installation to update"
|
||||||
|
msgstr "Selezionare l'installazione di script da aggiornare"
|
||||||
|
|
||||||
|
#: script_manager.lua:684 script_manager.lua:742
|
||||||
|
msgid "update scripts"
|
||||||
|
msgstr "Aggiornare gli script"
|
||||||
|
|
||||||
|
#: script_manager.lua:685
|
||||||
|
msgid "update the lua scripts from the repository"
|
||||||
|
msgstr "Aggiornare gli script lua del repo"
|
||||||
|
|
||||||
|
#: script_manager.lua:696
|
||||||
|
msgid ""
|
||||||
|
"enter the URL of the git repository containing the scripts you wish to add"
|
||||||
|
msgstr "Immettere l'URL del repo git che contiene gli script da aggiungere"
|
||||||
|
|
||||||
|
#: script_manager.lua:701
|
||||||
|
msgid "name of new category"
|
||||||
|
msgstr "Nome della nuova categoria"
|
||||||
|
|
||||||
|
#: script_manager.lua:702
|
||||||
|
msgid "enter a category name for the additional scripts"
|
||||||
|
msgstr "Immettere il nome della categoria per altri script"
|
||||||
|
|
||||||
|
#: script_manager.lua:707
|
||||||
|
msgid "URL to download additional scripts from"
|
||||||
|
msgstr "URL dal quale scaricare ulteriori script"
|
||||||
|
|
||||||
|
#: script_manager.lua:709
|
||||||
|
msgid "new category to place scripts in"
|
||||||
|
msgstr "Nuova categoria che dovrà contenere gli script"
|
||||||
|
|
||||||
|
#: script_manager.lua:712
|
||||||
|
msgid "install additional scripts"
|
||||||
|
msgstr "Installare gli script aggiuntivi"
|
||||||
|
|
||||||
|
#: script_manager.lua:720
|
||||||
|
msgid "Enable \"Disable Scripts\" button"
|
||||||
|
msgstr "Abilita il pulsante \"Disabilita Script\""
|
||||||
|
|
||||||
|
#: script_manager.lua:730
|
||||||
|
msgid "Disable Scripts"
|
||||||
|
msgstr "Disabilita Script"
|
||||||
|
|
||||||
|
#: script_manager.lua:736
|
||||||
|
msgid "lua scripts will not run the next time darktable is started"
|
||||||
|
msgstr "Gli script lua non verranno avviati al prossimo riavvio di darktable"
|
||||||
|
|
||||||
|
#: script_manager.lua:745
|
||||||
|
msgid "add more scripts"
|
||||||
|
msgstr "Aggiungi altri script"
|
||||||
|
|
||||||
|
#: script_manager.lua:747
|
||||||
|
msgid "disable scripts"
|
||||||
|
msgstr "Disabilita script"
|
||||||
|
|
||||||
|
#: script_manager.lua:755
|
||||||
|
msgid "category"
|
||||||
|
msgstr "categoria"
|
||||||
|
|
||||||
|
#: script_manager.lua:756
|
||||||
|
msgid "select the script category"
|
||||||
|
msgstr "Seleziona la categoria"
|
||||||
|
|
||||||
|
#: script_manager.lua:780
|
||||||
|
msgid "Page:"
|
||||||
|
msgstr "Pag.:"
|
||||||
|
|
||||||
|
#: script_manager.lua:808
|
||||||
|
msgid "Scripts"
|
||||||
|
msgstr "Scripts"
|
||||||
|
|
||||||
|
#: script_manager.lua:817
|
||||||
|
msgid "scripts per page"
|
||||||
|
msgstr "Script per pagina"
|
||||||
|
|
||||||
|
#: script_manager.lua:818
|
||||||
|
msgid "select number of start/stop buttons to display"
|
||||||
|
msgstr "Selezionare il numero di pulsanti da visualizzare"
|
||||||
|
|
||||||
|
#: script_manager.lua:829
|
||||||
|
msgid "change number of buttons"
|
||||||
|
msgstr "Modifica la quantità di pulsanti"
|
||||||
|
|
||||||
|
#: script_manager.lua:837
|
||||||
|
msgid "Configuration"
|
||||||
|
msgstr "Configurazione"
|
||||||
|
|
||||||
|
#: script_manager.lua:858
|
||||||
|
msgid "action"
|
||||||
|
msgstr "Azione"
|
||||||
|
|
||||||
|
#: script_manager.lua:864
|
||||||
|
msgid "install/update scripts"
|
||||||
|
msgstr "Installa/aggiorna script"
|
||||||
|
|
||||||
|
#: script_manager.lua:864
|
||||||
|
msgid "configure"
|
||||||
|
msgstr "Configura"
|
||||||
|
|
||||||
|
#: script_manager.lua:864
|
||||||
|
msgid "start/stop scripts"
|
||||||
|
msgstr "Avvia/blocca script"
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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 = {}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -208,7 +209,7 @@ for i,exec in ipairs(exec_table) do
|
|||||||
executable_path_widgets[exec],
|
executable_path_widgets[exec],
|
||||||
dt.new_widget("section_label"){label = _("reset")},
|
dt.new_widget("section_label"){label = _("reset")},
|
||||||
dt.new_widget("button"){
|
dt.new_widget("button"){
|
||||||
label = "clear",
|
label = _("clear"),
|
||||||
tooltip = _("Clear path for ") .. exec,
|
tooltip = _("Clear path for ") .. exec,
|
||||||
clicked_callback = function()
|
clicked_callback = function()
|
||||||
df.set_executable_path_preference(exec, "")
|
df.set_executable_path_preference(exec, "")
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -60,7 +60,7 @@ 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
|
||||||
gettext.bindtextdomain("script_manager",dt.configuration.config_dir.."/lua/locale/")
|
dt.gettext.bindtextdomain("script_manager",dt.configuration.config_dir.."/lua/locale/")
|
||||||
|
|
||||||
local function _(msgid)
|
local function _(msgid)
|
||||||
return gettext.dgettext("script_manager", msgid)
|
return gettext.dgettext("script_manager", msgid)
|
||||||
@@ -70,7 +70,6 @@ end
|
|||||||
|
|
||||||
du.check_min_api_version("5.0.0", "script_manager")
|
du.check_min_api_version("5.0.0", "script_manager")
|
||||||
|
|
||||||
|
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
-- C O N S T A N T S
|
-- C O N S T A N T S
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -94,6 +93,16 @@ local LUA_SCRIPT_REPO = "https://github.com/darktable-org/lua-scripts.git"
|
|||||||
|
|
||||||
local LUA_API_VER = "API-" .. dt.configuration.api_version_string
|
local LUA_API_VER = "API-" .. dt.configuration.api_version_string
|
||||||
|
|
||||||
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
-- 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)
|
||||||
|
|
||||||
|
local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool")
|
||||||
|
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
-- L O G L E V E L
|
-- L O G L E V E L
|
||||||
@@ -121,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
|
||||||
@@ -150,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
|
||||||
@@ -181,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")
|
||||||
@@ -204,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
|
||||||
@@ -226,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
|
||||||
@@ -246,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
|
||||||
@@ -258,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
|
||||||
@@ -281,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
|
||||||
|
|
||||||
@@ -293,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
|
||||||
@@ -314,19 +372,24 @@ 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)
|
||||||
if script.running == false then
|
if script.running == false then
|
||||||
|
script_manager_running_script = script.name
|
||||||
status, err = du.prequire(script.path)
|
status, err = du.prequire(script.path)
|
||||||
log.msg(log.debug, "prequire returned " .. tostring(status) .. " and for err " .. tostring(err))
|
log.msg(log.debug, "prequire returned " .. tostring(status) .. " and for err " .. tostring(err))
|
||||||
|
script_manager_running_script = nil
|
||||||
if status then
|
if status then
|
||||||
pref_write(script.script_name, "bool", true)
|
pref_write(script.script_name, "bool", true)
|
||||||
log.msg(log.screen, _("Loaded ") .. script.script_name)
|
log.msg(log.screen, _("Loaded ") .. script.script_name)
|
||||||
@@ -334,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 and dt.gui.current_view().id == "lighttable" then
|
||||||
script.data.show()
|
script.data.show()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -351,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()
|
||||||
@@ -382,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 = {
|
||||||
@@ -398,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
|
||||||
@@ -424,21 +497,53 @@ local function process_script_data(script_file)
|
|||||||
|
|
||||||
-- add the script data
|
-- add the script data
|
||||||
local category,path,name,filename,filetype = string.match(script_file, pattern)
|
local category,path,name,filename,filetype = string.match(script_file, pattern)
|
||||||
log.msg(log.debug, "category is " .. category)
|
|
||||||
log.msg(log.debug, "name is " .. name)
|
|
||||||
|
|
||||||
add_script_category(category)
|
if category and name and path then
|
||||||
|
log.msg(log.debug, "category is " .. category)
|
||||||
|
log.msg(log.debug, "name is " .. name)
|
||||||
|
|
||||||
if name then
|
add_script_category(category)
|
||||||
add_script_name(name, path, category)
|
add_script_name(name, path, category)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
restore_log_level(old_log_level)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function ensure_lib_in_search_path(line)
|
||||||
|
local old_log_level = set_log_level(sm.log_level)
|
||||||
|
set_log_level(log.debug)
|
||||||
|
|
||||||
|
log.msg(log.debug, "line is " .. line)
|
||||||
|
|
||||||
|
if string.match(line, ds.sanitize_lua(dt.configuration.config_dir .. PS .. "lua" .. PS .. "lib")) then
|
||||||
|
log.msg(log.debug, line .. " is already in search path, returning...")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pattern = dt.configuration.running_os == "windows" and "(.+)\\lib\\.+lua" or "(.+)/lib/.+lua"
|
||||||
|
local path = string.match(line, pattern)
|
||||||
|
|
||||||
|
log.msg(log.debug, "extracted path is " .. path)
|
||||||
|
log.msg(log.debug, "package.path is " .. package.path)
|
||||||
|
|
||||||
|
if not string.match(package.path, ds.sanitize_lua(path)) then
|
||||||
|
|
||||||
|
log.msg(log.debug, "path isn't in package.path, adding...")
|
||||||
|
|
||||||
|
package.path = package.path .. ";" .. path .. "/?.lua"
|
||||||
|
|
||||||
|
log.msg(log.debug, "new package.path is " .. package.path)
|
||||||
|
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
|
||||||
@@ -453,14 +558,18 @@ local function scan_scripts(script_dir)
|
|||||||
process_script_data(script_file)
|
process_script_data(script_file)
|
||||||
script_count = script_count + 1
|
script_count = script_count + 1
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
ensure_lib_in_search_path(line) -- but let's make sure libraries can be found
|
||||||
end
|
end
|
||||||
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
|
||||||
@@ -483,10 +592,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
|
||||||
@@ -496,9 +611,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
|
||||||
@@ -533,15 +650,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
|
||||||
|
|
||||||
@@ -551,6 +671,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
|
||||||
|
|
||||||
@@ -592,28 +713,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
|
||||||
@@ -678,9 +805,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]
|
||||||
@@ -732,9 +861,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
|
||||||
@@ -744,9 +875,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)
|
||||||
@@ -777,9 +910,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")
|
||||||
@@ -821,16 +956,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
|
||||||
@@ -853,67 +990,75 @@ 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
|
||||||
|
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
-- M A I N P R O G R A M
|
-- M A I N P R O G R A M
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
local repo_data = get_repo_status(LUA_DIR)
|
|
||||||
local current_branch = get_current_repo_branch(LUA_DIR)
|
|
||||||
local clean = is_repo_clean(repo_data)
|
|
||||||
local repo = LUA_DIR
|
|
||||||
|
|
||||||
if current_branch then
|
-- ensure shortcuts module knows widgets belong to script_manager
|
||||||
if sm.executables.git and clean and
|
|
||||||
(current_branch == "master" or string.match(current_branch, "^API%-")) then -- only make changes to clean branches
|
script_manager_running_script = "script_manager"
|
||||||
local branches = get_repo_branches(LUA_DIR)
|
|
||||||
if current_branch ~= LUA_API_VER and current_branch ~= "master" then
|
if check_for_updates then
|
||||||
-- probably upgraded from an earlier api version so get back to master
|
local repo_data = get_repo_status(LUA_DIR)
|
||||||
-- to use the latest version of script_manager to get the proper API
|
local current_branch = get_current_repo_branch(LUA_DIR)
|
||||||
checkout_repo_branch(repo, "master")
|
local clean = is_repo_clean(repo_data)
|
||||||
log.msg(log.screen, "lua API version reset, please restart darktable")
|
local repo = LUA_DIR
|
||||||
elseif LUA_API_VER == current_branch then
|
|
||||||
-- do nothing, we are fine
|
if current_branch then
|
||||||
log.msg(log.debug, "took equal branch, doing nothing")
|
if sm.executables.git and clean and
|
||||||
elseif string.match(LUA_API_VER, "dev") then
|
(current_branch == "master" or string.match(current_branch, "^API%-")) then -- only make changes to clean branches
|
||||||
-- we are on a dev API version, so checkout the dev
|
local branches = get_repo_branches(LUA_DIR)
|
||||||
-- api version or checkout/stay on master
|
if current_branch ~= LUA_API_VER and current_branch ~= "master" then
|
||||||
log.msg(log.debug, "took the dev branch")
|
-- probably upgraded from an earlier api version so get back to master
|
||||||
local match = false
|
-- to use the latest version of script_manager to get the proper API
|
||||||
for _, branch in ipairs(branches) do
|
checkout_repo_branch(repo, "master")
|
||||||
log.msg(log.debug, "checking branch " .. branch .. " against API " .. LUA_API_VER)
|
log.msg(log.screen, "lua API version reset, please restart darktable")
|
||||||
if LUA_API_VER == branch then
|
elseif LUA_API_VER == current_branch then
|
||||||
match = true
|
-- do nothing, we are fine
|
||||||
log.msg(log.info, "checking out repo development branch " .. branch)
|
log.msg(log.debug, "took equal branch, doing nothing")
|
||||||
checkout_repo_branch(repo, branch)
|
elseif string.match(LUA_API_VER, "dev") then
|
||||||
|
-- we are on a dev API version, so checkout the dev
|
||||||
|
-- api version or checkout/stay on master
|
||||||
|
log.msg(log.debug, "took the dev branch")
|
||||||
|
local match = false
|
||||||
|
for _, branch in ipairs(branches) do
|
||||||
|
log.msg(log.debug, "checking branch " .. branch .. " against API " .. LUA_API_VER)
|
||||||
|
if LUA_API_VER == branch then
|
||||||
|
match = true
|
||||||
|
log.msg(log.info, "checking out repo development branch " .. branch)
|
||||||
|
checkout_repo_branch(repo, branch)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
if not match then
|
||||||
if not match then
|
if current_branch == "master" then
|
||||||
if current_branch == "master" then
|
log.msg(log.info, "staying on master, no dev branch yet")
|
||||||
log.msg(log.info, "staying on master, no dev branch yet")
|
else
|
||||||
else
|
log.msg(log.info, "no dev branch available, checking out master")
|
||||||
log.msg(log.info, "no dev branch available, checking out master")
|
checkout_repo_branch(repo, "master")
|
||||||
checkout_repo_branch(repo, "master")
|
end
|
||||||
end
|
end
|
||||||
end
|
elseif #branches > 0 and LUA_API_VER > branches[#branches] then
|
||||||
elseif #branches > 0 and LUA_API_VER > branches[#branches] then
|
log.msg(log.info, "no newer branches, staying on master")
|
||||||
log.msg(log.info, "no newer branches, staying on master")
|
-- stay on master
|
||||||
-- stay on master
|
else
|
||||||
else
|
-- checkout the appropriate branch for API version if it exists
|
||||||
-- checkout the appropriate branch for API version if it exists
|
log.msg(log.info, "checking out the appropriate API branch")
|
||||||
log.msg(log.info, "checking out the appropriate API branch")
|
local match = false
|
||||||
local match = false
|
for _, branch in ipairs(branches) do
|
||||||
for _, branch in ipairs(branches) do
|
log.msg(log.debug, "checking branch " .. branch .. " against API " .. LUA_API_VER)
|
||||||
log.msg(log.debug, "checking branch " .. branch .. " against API " .. LUA_API_VER)
|
if LUA_API_VER == branch then
|
||||||
if LUA_API_VER == branch then
|
match = true
|
||||||
match = true
|
log.msg(log.info, "checking out repo branch " .. branch)
|
||||||
log.msg(log.info, "checking out repo branch " .. branch)
|
checkout_repo_branch(repo, branch)
|
||||||
checkout_repo_branch(repo, branch)
|
log.msg(log.screen, "you must restart darktable to use the correct version of the lua")
|
||||||
log.msg(log.screen, "you must restart darktable to use the correct version of the lua")
|
end
|
||||||
|
end
|
||||||
|
if not match then
|
||||||
|
log.msg(log.warn, "no matching branch found for " .. LUA_API_VER)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if not match then
|
|
||||||
log.msg(log.warn, "no matching branch found for " .. LUA_API_VER)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -923,7 +1068,6 @@ scan_scripts(LUA_DIR)
|
|||||||
log.msg(log.debug, "finished processing scripts")
|
log.msg(log.debug, "finished processing scripts")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
-- U S E R I N T E R F A C E
|
-- U S E R I N T E R F A C E
|
||||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@@ -1135,6 +1279,7 @@ sm.widgets.main_box = dt.new_widget("box"){
|
|||||||
sm.widgets.main_stack
|
sm.widgets.main_stack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user