1
1
--[[
2
2
This file is part of darktable,
3
3
copyright (c) 2015 Jérémy Rosen & Pascal Obry
4
+ edited 2016 Tejovanth N
4
5
5
6
darktable is free software: you can redistribute it and/or modify
6
7
it under the terms of the GNU General Public License as published by
28
29
29
30
This plugin will add a new exporter that will allow you to generate the pdf file
30
31
32
+ Plugin allows you to choose how many thumbnails you need per row
33
+
31
34
32
35
]]
33
36
local dt = require " darktable"
@@ -40,20 +43,29 @@ dt.preferences.register
40
43
" xdg-open" )
41
44
42
45
local title_widget = dt .new_widget (" entry" ) {
43
- placeholder = " Title"
46
+ placeholder = " Title"
47
+ }
48
+ local no_of_thumbs_widget = dt .new_widget (" slider" )
49
+ {
50
+ label = " Thumbs per Line" ,
51
+ soft_min = 1 , -- The soft minimum value for the slider, the slider can't go beyond this point
52
+ soft_max = 10 , -- The soft maximum value for the slider, the slider can't go beyond this point
53
+ hard_min = 1 , -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
54
+ hard_max = 10 , -- The hard maximum value for the slider, the user can't manually enter a value beyond this point
55
+ value = 4 -- The current value of the slider
44
56
}
45
57
local widget = dt .new_widget (" box" ) {
46
- orientation = horizontal ,
47
- dt .new_widget (" label" ){label = " Title:" },
48
- title_widget
58
+ orientation = horizontal ,
59
+ dt .new_widget (" label" ){label = " Title:" },
60
+ title_widget ,
61
+ dt .new_widget (" label" ){label = " Thumbnails per row:" },
62
+ no_of_thumbs_widget
49
63
}
50
64
51
65
local ending = [[
52
66
\end{document}
53
67
]]
54
68
55
- local thumbs_per_line = 4 ;
56
- local width = 1 / thumbs_per_line - 0.01
57
69
58
70
local filename = dt .configuration .tmp_dir .. " /pdfout.tex"
59
71
@@ -93,23 +105,27 @@ dt.register_storage("export_pdf","Export thumbnails to pdf",
93
105
local my_title = title_widget .text
94
106
if my_title == " " then
95
107
my_title = " Title"
96
- end
97
- local preamble = [[
98
- \documentclass[a4paper,10pt]{article}
99
- \usepackage{graphicx}
100
- \pagestyle{empty}
101
- \parindent0pt
102
- \usepackage{geometry}
103
- \geometry{a4paper,left=5mm,right=5mm, top=5mm, bottom=5mm}
104
- \begin{document}
105
- {\Large\bfseries ]] .. my_title .. [[ } \\
106
- \bigskip\bigskip
107
- ]]
108
-
109
- local errmsg
110
- local latexfile
111
- latexfile ,errmsg = io.open (filename ," w" )
112
- if not latexfile then
108
+ end
109
+ local thumbs_per_line = no_of_thumbs_widget .value
110
+ thumbs_per_line = tonumber (thumbs_per_line )
111
+ width = (1 / thumbs_per_line ) - 0.01
112
+
113
+ local preamble = [[
114
+ \documentclass[a4paper,10pt]{article}
115
+ \usepackage{graphicx}
116
+ \pagestyle{empty}
117
+ \parindent0pt
118
+ \usepackage{geometry}
119
+ \geometry{a4paper,left=5mm,right=5mm, top=5mm, bottom=5mm}
120
+ \begin{document}
121
+ {\Large\bfseries ]] .. my_title .. [[ } \\
122
+ \bigskip\bigskip
123
+ ]]
124
+
125
+ local errmsg
126
+ local latexfile
127
+ latexfile ,errmsg = io.open (filename ," w" )
128
+ if not latexfile then
113
129
error (errmsg )
114
130
end
115
131
my_write (latexfile ,preamble )
0 commit comments