From 3bd76b4fb5e119435095796f105c8fa32d651b45 Mon Sep 17 00:00:00 2001 From: supertobi Date: Thu, 12 Jan 2017 13:16:59 +0100 Subject: [PATCH] added a progress bar added a progress bar to elect_without_gps() and select_with_gps() --- contrib/geoToolbox.lua | 43 ++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/contrib/geoToolbox.lua b/contrib/geoToolbox.lua index 3ac8a35..c01ae87 100644 --- a/contrib/geoToolbox.lua +++ b/contrib/geoToolbox.lua @@ -60,23 +60,46 @@ local label_copy_gps_ele = dt.new_widget("check_button") -- local function select_with_gps() - local selection = {} - for _,image in ipairs(dt.database) do + local selection = {} + job = dt.gui.create_job(_("GPS selection"), true, stop_selection) + + for key,image in ipairs(dt.database) do + if job.valid then + job.percent = (key-1)/#dt.database + if (image.longitude and image.latitude) then - table.insert(selection,image) + table.insert(selection,image) end - end - dt.gui.selection(selection) + else + break + end + end + + dt.gui.selection(selection) + job.valid = false end local function select_without_gps() - local selection = {} - for _,image in ipairs(dt.database) do + local selection = {} + job = dt.gui.create_job(_("GPS selection"), true, stop_selection) + + for key,image in ipairs(dt.database) do + if job.valid then + job.percent = (key-1)/#dt.database + if (not image.longitude and not image.latitude) then - table.insert(selection,image) + table.insert(selection,image) end - end - dt.gui.selection(selection) + else + break + end + end + dt.gui.selection(selection) + job.valid = false +end + +local function stop_selection(job) + job.valid = false end -- This is used for older images in the DB