Skip to content

Commit 3001a0d

Browse files
authored
Add manual coordinate input option to geoToolbox
1 parent 62e9329 commit 3001a0d

File tree

1 file changed

+43
-21
lines changed

1 file changed

+43
-21
lines changed

contrib/geoToolbox.lua

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--[[
22
This file is part of darktable,
33
copyright (c) 2016 Tobias Jakobs
4+
copyright (c) 2025 Balázs Dura-Kovács
45
56
darktable is free software: you can redistribute it and/or modify
67
it under the terms of the GNU General Public License as published by
@@ -63,21 +64,30 @@ gT.event_registered = false
6364
local labelDistance = dt.new_widget("label")
6465
labelDistance.label = _("distance:")
6566

66-
local label_copy_gps_lat = dt.new_widget("check_button")
67+
local checkbox_copy_gps_lat = dt.new_widget("check_button")
6768
{
68-
label = _("latitude: "),
6969
value = true
7070
}
71-
local label_copy_gps_lon = dt.new_widget("check_button")
71+
local entry_gps_lat = dt.new_widget("entry")
72+
{
73+
placeholder = _("latitude")
74+
}
75+
local checkbox_copy_gps_lon = dt.new_widget("check_button")
7276
{
73-
label = _("longitude: "),
7477
value = true
7578
}
76-
local label_copy_gps_ele = dt.new_widget("check_button")
79+
local entry_gps_lon = dt.new_widget("entry")
80+
{
81+
placeholder = _("longitude")
82+
}
83+
local checkbox_copy_gps_ele = dt.new_widget("check_button")
7784
{
78-
label = _("elevation: "),
7985
value = true
8086
}
87+
local entry_gps_ele = dt.new_widget("entry")
88+
{
89+
placeholder = _("elevation")
90+
}
8191
-- </GUI>
8292

8393
local function select_with_gps()
@@ -294,20 +304,20 @@ local function copy_gps()
294304
copy_gps_have_data = false
295305
else
296306
copy_gps_have_data = true
297-
if (image.latitude and label_copy_gps_lat.value) then
307+
if (image.latitude and checkbox_copy_gps_lat.value) then
298308
copy_gps_latitude = image.latitude
299309
end
300-
if (image.longitude and label_copy_gps_lon.value) then
310+
if (image.longitude and checkbox_copy_gps_lon.value) then
301311
copy_gps_longitude = image.longitude
302312
end
303-
if (image.elevation and label_copy_gps_ele.value) then
313+
if (image.elevation and checkbox_copy_gps_ele.value) then
304314
copy_gps_elevation = image.elevation
305315
end
306316
end
307317

308-
label_copy_gps_lat.label = _("latitude: ") .. copy_gps_latitude
309-
label_copy_gps_lon.label = _("longitude: ") .. copy_gps_longitude
310-
label_copy_gps_ele.label = _("elevation: ") .. copy_gps_elevation
318+
entry_gps_lat.text = copy_gps_latitude
319+
entry_gps_lon.text = copy_gps_longitude
320+
entry_gps_ele.text = copy_gps_elevation
311321

312322
return
313323
end
@@ -317,14 +327,14 @@ local function paste_gps(image)
317327
local sel_images = dt.gui.action_images
318328

319329
for jj,image in ipairs(sel_images) do
320-
if (label_copy_gps_lat.value) then
321-
image.latitude = copy_gps_latitude
330+
if (checkbox_copy_gps_lat.value) then
331+
image.latitude = entry_gps_lat.text
322332
end
323-
if (label_copy_gps_lon.value) then
324-
image.longitude = copy_gps_longitude
333+
if (checkbox_copy_gps_lon.value) then
334+
image.longitude = entry_gps_lon.text
325335
end
326-
if (label_copy_gps_ele.value) then
327-
image.elevation = copy_gps_elevation
336+
if (checkbox_copy_gps_ele.value) then
337+
image.elevation = entry_gps_ele.text
328338
end
329339
end
330340
end
@@ -663,9 +673,21 @@ gT.widget = dt.new_widget("box")
663673
tooltip = _("copy GPS data"),
664674
clicked_callback = copy_gps
665675
},
666-
label_copy_gps_lat,
667-
label_copy_gps_lon,
668-
label_copy_gps_ele,
676+
dt.new_widget("box"){
677+
orientation = "horizontal",
678+
checkbox_copy_gps_lat,
679+
entry_gps_lat
680+
},
681+
dt.new_widget("box"){
682+
orientation = "horizontal",
683+
checkbox_copy_gps_lon,
684+
entry_gps_lon
685+
},
686+
dt.new_widget("box"){
687+
orientation = "horizontal",
688+
checkbox_copy_gps_ele,
689+
entry_gps_ele
690+
},
669691
dt.new_widget("button")
670692
{
671693
label = _("paste GPS data"),

0 commit comments

Comments
 (0)