diff --git a/contrib/ultrahdr.lua b/contrib/ultrahdr.lua index ef7a61f..94df217 100644 --- a/contrib/ultrahdr.lua +++ b/contrib/ultrahdr.lua @@ -120,6 +120,7 @@ local COLORSPACE_TO_GUI_ACTION = { [DT_COLORSPACE_DISPLAY_P3] = 11 } +local UI_SLEEP_MS = 50 -- How many ms to sleep after UI action. local function set_log_level(level) local old_log_level = log.log_level() @@ -221,9 +222,10 @@ local function set_profile(colorspace) local new = COLORSPACE_TO_GUI_ACTION[colorspace] or colorspace log.msg(log.debug, string.format("Changing export profile from %d to %d", old, new)) dt.gui.action("lib/export/profile", 0, "selection", "next", new - old) + dt.control.sleep(UI_SLEEP_MS) return old else - -- Old method, timing-dependent + -- Old method return set_combobox("lib/export/profile", 0, "plugins/lighttable/export/icctype", colorspace) end end @@ -238,12 +240,12 @@ local function set_combobox(path, instance, config_name, new_config_value) end dt.gui.action(path, 0, "selection", "first", 1.0) - dt.control.sleep(50) + dt.control.sleep(UI_SLEEP_MS) local limit, i = 30, 0 -- in case there is no matching config value in the first n entries of a combobox. while i < limit do i = i + 1 dt.gui.action(path, 0, "selection", "next", 1.0) - dt.control.sleep(50) + dt.control.sleep(UI_SLEEP_MS) if dt.preferences.read("darktable", config_name, "integer") == new_config_value then log.msg(log.debug, string.format(_("Changed %s from %d to %d"), config_name, pref, new_config_value)) return pref