Skip to content

Commit

Permalink
Merge pull request darktable-org#410 from darktable-org/script_manage…
Browse files Browse the repository at this point in the history
…r_running_script

script_manager darktable shortcut integration
  • Loading branch information
wpferguson authored Mar 25, 2023
2 parents 800cbee + 75a19e7 commit 9b61e47
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tools/script_manager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ dt.preferences.register(MODULE, "check_update", "bool",

local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool")

-- - - - - - - - - - - - - - - - - - - - - - - -
-- P R E F E R E N C E S
-- - - - - - - - - - - - - - - - - - - - - - - -

dt.preferences.register(MODULE, "check_update", "bool",
"check for updated scripts on start up",
"automatically update scripts to correct version",
true)

local check_for_updates = dt.preferences.read(MODULE, "check_update", "bool")

-- - - - - - - - - - - - - - - - - - - - - - - -
-- L O G L E V E L
-- - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -334,8 +345,10 @@ local function activate(script)
local err = nil -- error message returned if module doesn't start
log.msg(log.info, "activating " .. script.name)
if script.running == false then
script_manager_running_script = script.name
status, err = du.prequire(script.path)
log.msg(log.debug, "prequire returned " .. tostring(status) .. " and for err " .. tostring(err))
script_manager_running_script = nil
if status then
pref_write(script.script_name, "bool", true)
log.msg(log.screen, _("Loaded ") .. script.script_name)
Expand Down Expand Up @@ -868,6 +881,10 @@ end
-- M A I N P R O G R A M
-- - - - - - - - - - - - - - - - - - - - - - - -

-- ensure shortcuts module knows widgets belong to script_manager

script_manager_running_script = "script_manager"

if check_for_updates then
local repo_data = get_repo_status(LUA_DIR)
local current_branch = get_current_repo_branch(LUA_DIR)
Expand Down Expand Up @@ -935,7 +952,6 @@ scan_scripts(LUA_DIR)
log.msg(log.debug, "finished processing scripts")



-- - - - - - - - - - - - - - - - - - - - - - - -
-- U S E R I N T E R F A C E
-- - - - - - - - - - - - - - - - - - - - - - - -
Expand Down Expand Up @@ -1147,7 +1163,7 @@ sm.widgets.main_box = dt.new_widget("box"){
sm.widgets.main_stack
}


script_manager_running_script = nil
-- - - - - - - - - - - - - - - - - - - - - - - -
-- D A R K T A B L E I N T E G R A T I O N
-- - - - - - - - - - - - - - - - - - - - - - - -
Expand Down

0 comments on commit 9b61e47

Please sign in to comment.