def run(self):
     if THEME_EDITOR is None or not exists(THEME_EDITOR):
         if sublime.ok_cancel_dialog(MSGS["download"]):
             update_binary(init_plugin)
     else:
         if not check_version(THEME_EDITOR, sublime.load_settings(PLUGIN_SETTINGS), init_plugin):
             sublime.message_dialog(MSGS["no_updates"])
 def run(self):
     if THEME_EDITOR is None or not exists(THEME_EDITOR):
         if sublime.ok_cancel_dialog(MSGS["download"]):
             update_binary(init_plugin)
     else:
         if not check_version(THEME_EDITOR,
                              sublime.load_settings(PLUGIN_SETTINGS),
                              init_plugin):
             sublime.message_dialog(MSGS["no_updates"])
 def check_binary(self):
     safe = True
     if THEME_EDITOR is None or not exists(THEME_EDITOR):
         if sublime.ok_cancel_dialog(MSGS["download"]):
             update_binary(init_plugin)
             safe = False
     if safe:
         if sublime.platform() in ["linux", "osx"]:
             nix_check_permissions(THEME_EDITOR)
     return safe
 def check_binary(self):
     safe = True
     if THEME_EDITOR is None or not exists(THEME_EDITOR):
         if sublime.ok_cancel_dialog(MSGS["download"]):
             update_binary(init_plugin)
             safe = False
     if safe:
         if sublime.platform() in ["linux", "osx"]:
             nix_check_permissions(THEME_EDITOR)
     return safe
def init_plugin():
    global THEME_EDITOR
    platform = sublime.platform()
    p_settings = sublime.load_settings(PLUGIN_SETTINGS)
    p_settings.clear_on_change('reload')

    # Pick the correct binary for the editor
    THEME_EDITOR = get_binary_location()

    if THEME_EDITOR is None or not exists(THEME_EDITOR):
        THEME_EDITOR = None
    elif platform in ["linux", "osx"]:
        nix_check_permissions(THEME_EDITOR)

    if THEME_EDITOR is not None:
        check_version(THEME_EDITOR, p_settings, init_plugin)
    else:
        if sublime.ok_cancel_dialog(MSGS["download"]):
            update_binary(init_plugin)

    p_settings.add_on_change('reload', init_plugin)
def init_plugin():
    global THEME_EDITOR
    platform = sublime.platform()
    p_settings = sublime.load_settings(PLUGIN_SETTINGS)
    p_settings.clear_on_change("reload")

    # Pick the correct binary for the editor
    THEME_EDITOR = get_binary_location()

    if THEME_EDITOR is None or not exists(THEME_EDITOR):
        THEME_EDITOR = None
    elif platform in ["linux", "osx"]:
        nix_check_permissions(THEME_EDITOR)

    if THEME_EDITOR is not None:
        check_version(THEME_EDITOR, p_settings, init_plugin)
    else:
        if sublime.ok_cancel_dialog(MSGS["download"]):
            update_binary(init_plugin)

    p_settings.add_on_change("reload", init_plugin)