Skip to content

Commit

Permalink
Fix missing refresh of apps due to trying to execute both commands in…
Browse files Browse the repository at this point in the history
… one statement
  • Loading branch information
thatsIch committed Feb 17, 2017
1 parent a173c4c commit 041f3b6
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions refreshcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,13 @@


def calculate_refresh_commands(rm_exe, config, fil, activate, is_inc):
refresh_config = [
rm_exe, "!Refresh", config
]

if activate:
if is_inc:
cmds = [rm_exe, "!ActivateConfig", config, "&&"]
cmds.extend(refresh_config)

return cmds
else:
cmds = [rm_exe, "!ActivateConfig", config, fil, "&&"]
cmds.extend(refresh_config)

return cmds
cmds = [rm_exe, "!ActivateConfig", config]
if not is_inc:
cmds.append(fil)
return cmds
else:
return refresh_config
return None


class RainmeterRefreshConfigCommand(sublime_plugin.ApplicationCommand):
Expand Down Expand Up @@ -77,7 +67,12 @@ def run(self, cmd): # pylint: disable=R0201; sublime text API, no need for clas
is_inc = fil.endswith(".inc")

refresh_commands = calculate_refresh_commands(rainmeter_exe, config, fil, activate, is_inc)
sublime.active_window().run_command("exec", {"cmd": refresh_commands})
if refresh_commands:
sublime.active_window().run_command("exec", {"cmd": refresh_commands})
refresh_config = [
rainmeter_exe, "!Refresh", config
]
sublime.active_window().run_command("exec", {"cmd": refresh_config})

def description(self): # pylint: disable=R0201; sublime text API, no need for class reference
"""
Expand Down

0 comments on commit 041f3b6

Please sign in to comment.