Skip to content

Commit c95547c

Browse files
authored
Merge pull request #584 from balping/patch-1
Add manual coordinate input option to geoToolbox
2 parents b4d3b29 + 25afb41 commit c95547c

File tree

1 file changed

+48
-23
lines changed

1 file changed

+48
-23
lines changed

contrib/geoToolbox.lua

Lines changed: 48 additions & 23 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,33 @@ 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+
tooltip = _("latitude (editable)"),
74+
placeholder = _("latitude")
75+
}
76+
local checkbox_copy_gps_lon = dt.new_widget("check_button")
7277
{
73-
label = _("longitude: "),
7478
value = true
7579
}
76-
local label_copy_gps_ele = dt.new_widget("check_button")
80+
local entry_gps_lon = dt.new_widget("entry")
81+
{
82+
tooltip = _("longitude (editable)"),
83+
placeholder = _("longitude")
84+
}
85+
local checkbox_copy_gps_ele = dt.new_widget("check_button")
7786
{
78-
label = _("elevation: "),
7987
value = true
8088
}
89+
local entry_gps_ele = dt.new_widget("entry")
90+
{
91+
tooltip = _("elevation (editable)"),
92+
placeholder = _("elevation")
93+
}
8194
-- </GUI>
8295

8396
local function select_with_gps()
@@ -294,20 +307,20 @@ local function copy_gps()
294307
copy_gps_have_data = false
295308
else
296309
copy_gps_have_data = true
297-
if (image.latitude and label_copy_gps_lat.value) then
310+
if (image.latitude and checkbox_copy_gps_lat.value) then
298311
copy_gps_latitude = image.latitude
299312
end
300-
if (image.longitude and label_copy_gps_lon.value) then
313+
if (image.longitude and checkbox_copy_gps_lon.value) then
301314
copy_gps_longitude = image.longitude
302315
end
303-
if (image.elevation and label_copy_gps_ele.value) then
316+
if (image.elevation and checkbox_copy_gps_ele.value) then
304317
copy_gps_elevation = image.elevation
305318
end
306319
end
307320

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
321+
entry_gps_lat.text = copy_gps_latitude
322+
entry_gps_lon.text = copy_gps_longitude
323+
entry_gps_ele.text = copy_gps_elevation
311324

312325
return
313326
end
@@ -317,14 +330,14 @@ local function paste_gps(image)
317330
local sel_images = dt.gui.action_images
318331

319332
for jj,image in ipairs(sel_images) do
320-
if (label_copy_gps_lat.value) then
321-
image.latitude = copy_gps_latitude
333+
if (checkbox_copy_gps_lat.value) then
334+
image.latitude = entry_gps_lat.text
322335
end
323-
if (label_copy_gps_lon.value) then
324-
image.longitude = copy_gps_longitude
336+
if (checkbox_copy_gps_lon.value) then
337+
image.longitude = entry_gps_lon.text
325338
end
326-
if (label_copy_gps_ele.value) then
327-
image.elevation = copy_gps_elevation
339+
if (checkbox_copy_gps_ele.value) then
340+
image.elevation = entry_gps_ele.text
328341
end
329342
end
330343
end
@@ -663,13 +676,25 @@ gT.widget = dt.new_widget("box")
663676
tooltip = _("copy GPS data"),
664677
clicked_callback = copy_gps
665678
},
666-
label_copy_gps_lat,
667-
label_copy_gps_lon,
668-
label_copy_gps_ele,
679+
dt.new_widget("box"){
680+
orientation = "horizontal",
681+
checkbox_copy_gps_lat,
682+
entry_gps_lat
683+
},
684+
dt.new_widget("box"){
685+
orientation = "horizontal",
686+
checkbox_copy_gps_lon,
687+
entry_gps_lon
688+
},
689+
dt.new_widget("box"){
690+
orientation = "horizontal",
691+
checkbox_copy_gps_ele,
692+
entry_gps_ele
693+
},
669694
dt.new_widget("button")
670695
{
671-
label = _("paste GPS data"),
672-
tooltip = _("paste GPS data"),
696+
label = _("apply GPS data to image"),
697+
tooltip = _("apply GPS data to image"),
673698
clicked_callback = paste_gps
674699
},
675700
separator2,--------------------------------------------------------

0 commit comments

Comments
 (0)