@@ -30,6 +30,7 @@ WARNING
30
30
This script is only tested with Linux
31
31
32
32
USAGE
33
+ * require script "official/yield" from your main Lua file in the first line
33
34
* require this script from your main Lua file
34
35
* when choosing file format, pick JPEG or PNG as Google Earth doesn't support other formats
35
36
@@ -202,7 +203,7 @@ local function create_kml_file(storage, image_table, extra_data)
202
203
-- Creates dir if not exsists
203
204
imageFoldername = " files/"
204
205
local mkdirCommand = " mkdir -p " .. exportDirectory .. " /" .. imageFoldername
205
- coroutine.yield ( " RUN_COMMAND " , mkdirCommand )
206
+ dt . control . execute ( mkdirCommand )
206
207
end
207
208
208
209
@@ -222,8 +223,7 @@ local function create_kml_file(storage, image_table, extra_data)
222
223
-- profiles that might be present in the input and aren't needed in the thumbnail.
223
224
224
225
local convertToThumbCommand = " convert -size 96x96 " .. exported_image .. " -resize 92x92 -mattecolor \" #FFFFFF\" -frame 2x2 +profile \" *\" " .. exportDirectory .. " /" .. imageFoldername .. " thumb_" .. filename .. " .jpg"
225
- -- USE coroutine.yield. It does not block the UI
226
- coroutine.yield (" RUN_COMMAND" , convertToThumbCommand )
226
+ dt .control .execute (convertToThumbCommand )
227
227
else
228
228
-- Remove exported image if it has no GPS data
229
229
os.remove (exported_image )
@@ -341,7 +341,6 @@ local function create_kml_file(storage, image_table, extra_data)
341
341
-- Compress the files to create a KMZ file
342
342
if ( dt .preferences .read (" kml_export" ," CreateKMZ" ," bool" ) == true ) then
343
343
exportDirectory = dt .preferences .read (" kml_export" ," ExportDirectory" ," string" )
344
- -- USE coroutine.yield. It does not block the UI
345
344
346
345
local createKMZCommand = " zip --test --move --junk-paths "
347
346
createKMZCommand = createKMZCommand .. " \" " .. exportDirectory .. " /" .. exportKMZFilename .. " \" " -- KMZ filename
@@ -358,7 +357,7 @@ local function create_kml_file(storage, image_table, extra_data)
358
357
end
359
358
end
360
359
361
- coroutine.yield ( " RUN_COMMAND " , createKMZCommand )
360
+ dt . control . execute ( createKMZCommand )
362
361
end
363
362
364
363
-- Open the file with the standard programm
@@ -370,7 +369,7 @@ local function create_kml_file(storage, image_table, extra_data)
370
369
else
371
370
kmlFileOpenCommand = " xdg-open " .. exportDirectory .. " /\" " .. exportKMLFilename .. " \" "
372
371
end
373
- coroutine.yield ( " RUN_COMMAND " , kmlFileOpenCommand )
372
+ dt . control . execute ( kmlFileOpenCommand )
374
373
end
375
374
376
375
0 commit comments