Skip to content

Commit 0ab4b0c

Browse files
committed
Added 50ms sleep to the colorspace change.
The old profile still seems to be used occasionally without the sleep.
1 parent 6d16a87 commit 0ab4b0c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contrib/ultrahdr.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ local COLORSPACE_TO_GUI_ACTION = {
120120
[DT_COLORSPACE_DISPLAY_P3] = 11
121121
}
122122

123+
local UI_SLEEP_MS = 50 -- How many ms to sleep after UI action.
123124

124125
local function set_log_level(level)
125126
local old_log_level = log.log_level()
@@ -221,9 +222,10 @@ local function set_profile(colorspace)
221222
local new = COLORSPACE_TO_GUI_ACTION[colorspace] or colorspace
222223
log.msg(log.debug, string.format("Changing export profile from %d to %d", old, new))
223224
dt.gui.action("lib/export/profile", 0, "selection", "next", new - old)
225+
dt.control.sleep(UI_SLEEP_MS)
224226
return old
225227
else
226-
-- Old method, timing-dependent
228+
-- Old method
227229
return set_combobox("lib/export/profile", 0, "plugins/lighttable/export/icctype", colorspace)
228230
end
229231
end
@@ -238,12 +240,12 @@ local function set_combobox(path, instance, config_name, new_config_value)
238240
end
239241

240242
dt.gui.action(path, 0, "selection", "first", 1.0)
241-
dt.control.sleep(50)
243+
dt.control.sleep(UI_SLEEP_MS)
242244
local limit, i = 30, 0 -- in case there is no matching config value in the first n entries of a combobox.
243245
while i < limit do
244246
i = i + 1
245247
dt.gui.action(path, 0, "selection", "next", 1.0)
246-
dt.control.sleep(50)
248+
dt.control.sleep(UI_SLEEP_MS)
247249
if dt.preferences.read("darktable", config_name, "integer") == new_config_value then
248250
log.msg(log.debug, string.format(_("Changed %s from %d to %d"), config_name, pref, new_config_value))
249251
return pref

0 commit comments

Comments
 (0)