def call(operation, use_mm_panel=True, **kwargs):
    debug('Calling mm_interface')
    debug('OPERATION: ' + operation)
    debug(kwargs)

    settings = sublime.load_settings('mavensmate.sublime-settings')

    if settings.get("mm_developer_mode", False) and not os.path.isfile(
            settings.get("mm_python_location")):
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: mm_developer_mode is set to true, but we could not find your system python install. Please set the location at mm_python_location'
        printer.write('\n' + message + '\n')
        return
    else:
        if settings.get('mm_path',
                        'default') != 'default' and not os.path.isfile(
                            settings.get('mm_path')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not find the mm executable. If you wish to use the default location, ensure your mm_path setting is set to "default", then run MavensMate > Install/Update MavensMate API (mm). If you wish to run mm from a different location, ensure mm_path is pointed to that location on your local drive.'
            printer.write('\n' + message + '\n')
            return

        if sys.platform == 'linux' or sys.platform == 'darwin':
            if settings.get('mm_path',
                            'default') == 'default' and not os.path.isfile(
                                os.path.join(sublime.packages_path(), "User",
                                             "MavensMate", "mm", "mm")):
                active_window_id = sublime.active_window().id()
                printer = PanelPrinter.get(active_window_id)
                printer.show()
                message = '[OPERATION FAILED]: Could not find the mm executable. Please run MavensMate > Install/Update MavensMate API (mm) to install mm to your MavensMate for Sublime Text plugin directory.'
                printer.write('\n' + message + '\n')
                return
        else:
            if settings.get('mm_path',
                            'default') == 'default' and not os.path.isfile(
                                os.path.join(sublime.packages_path(), "User",
                                             "MavensMate", "mm", "mm.exe")):
                active_window_id = sublime.active_window().id()
                printer = PanelPrinter.get(active_window_id)
                printer.show()
                message = '[OPERATION FAILED]: Could not find the mm executable. Please run MavensMate > Install/Update MavensMate API (mm) to install mm to your MavensMate for Sublime Text plugin directory.'
                printer.write('\n' + message + '\n')
                return

    if 'linux' in sys.platform:
        if not os.path.isfile(settings.get('mm_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text "subl" executable. Please set mm_subl_location to location of "subl" on the disk.'
            printer.write('\n' + message + '\n')
            return

    if 'win32' in sys.platform:
        if not os.path.isfile(settings.get('mm_windows_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text. Please set mm_windows_subl_location to location of sublime_text.exe on the disk.'
            printer.write('\n' + message + '\n')
            return

    if not util.valid_workspace():
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Please ensure mm_workspace is set to existing location(s) on your local drive'
        printer.write('\n' + message + '\n')
        return

    window, view = util.get_window_and_view_based_on_context(
        kwargs.get('context', None))

    #if it's a legacy project, need to intercept the call and open the upgrade ui
    #TODO: this should probably be handled in mm
    if operation != 'new_project' and operation != 'new_project_from_existing_directory' and util.is_project_legacy(
            window) == True:
        operation = 'upgrade_project'

    community.sync_activity(operation)

    threads = []
    thread = MavensMateTerminalCall(operation,
                                    project_name=util.get_project_name(window),
                                    active_file=util.get_active_file(),
                                    params=kwargs.get('params', None),
                                    context=kwargs.get('context', None),
                                    message=kwargs.get('message', None),
                                    use_mm_panel=use_mm_panel,
                                    process_id=util.get_random_string(10),
                                    mm_path=settings.get('mm_path'),
                                    callback=kwargs.get('callback', None))
    if operation == 'index_apex':
        thread.daemon = True
    threads.append(thread)
    thread.start()
def call(operation, use_mm_panel=True, **kwargs):
    debug('Calling mm_interface')
    debug('OPERATION: '+operation)
    debug(kwargs)

    settings = sublime.load_settings('mavensmate.sublime-settings')
    
    if settings.get("mm_debug_mode") and not os.path.isfile(settings.get("mm_python_location")):
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Could not find your system python install. Please set the location at mm_python_location'
        printer.write('\n'+message+'\n')
        return

    if 'darwin' in sys.platform:
        if not os.path.isfile(settings.get('mm_location')) and settings.get('mm_debug_mode') == False:
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not find MavensMate.app. Download MavensMate.app from mavensmate.com and place in /Applications. Also, please ensure mm_app_location and mm_location are set properly in Sublime Text (MavensMate --> Settings --> User)'
            printer.write('\n'+message+'\n')
            return

    if 'linux' in sys.platform:
        if not os.path.isfile(settings.get('mm_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text "subl" executable. Please set mm_subl_location to location of "subl" on the disk.'
            printer.write('\n'+message+'\n')
            return

    if 'win32' in sys.platform:
        if not os.path.isfile(settings.get('mm_windows_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text. Please set mm_windows_subl_location to location of sublime_text.exe on the disk.'
            printer.write('\n'+message+'\n')
            return

    if not util.valid_workspace():
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Please ensure mm_workspace is set to existing location(s) on your local drive'
        printer.write('\n'+message+'\n')
        return

    window, view = util.get_window_and_view_based_on_context(kwargs.get('context', None))

    #if it's a legacy project, need to intercept the call and open the upgrade ui
    #TODO: this should probably be handled in mm
    if operation != 'new_project' and operation != 'new_project_from_existing_directory' and util.is_project_legacy(window) == True:
        operation = 'upgrade_project'
    


    threads = []
    thread = MavensMateTerminalCall(
        operation, 
        project_name=util.get_project_name(window), 
        active_file=util.get_active_file(), 
        params=kwargs.get('params', None),
        context=kwargs.get('context', None),
        message=kwargs.get('message', None),
        use_mm_panel=use_mm_panel,
        process_id=util.get_random_string(10),
        mm_location=settings.get('mm_location'),
        callback=kwargs.get('callback', None)
    )
    if operation == 'index_apex':
        thread.daemon = True
    threads.append(thread)        
    thread.start()
def call(operation, use_mm_panel=True, **kwargs):
    debug('Calling mm_interface')
    debug('OPERATION: '+operation)
    debug(kwargs)

    settings = sublime.load_settings('mavensmate.sublime-settings')
    
    if settings.get("mm_developer_mode", False) and not os.path.isfile(settings.get("mm_python_location")):
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: mm_developer_mode is set to true, but we could not find your system python install. Please set the location at mm_python_location'
        printer.write('\n'+message+'\n')
        return
    else:
        if settings.get('mm_path', 'default') != 'default' and not os.path.isfile(settings.get('mm_path')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not find the mm executable. If you wish to use the default location, ensure your mm_path setting is set to "default", then run MavensMate > Install/Update MavensMate API (mm). If you wish to run mm from a different location, ensure mm_path is pointed to that location on your local drive.'
            printer.write('\n'+message+'\n')
            return

        if sys.platform == 'linux' or sys.platform == 'darwin':
            if settings.get('mm_path', 'default') == 'default' and not os.path.isfile(os.path.join(sublime.packages_path(),"User","MavensMate","mm","mm")):
                active_window_id = sublime.active_window().id()
                printer = PanelPrinter.get(active_window_id)
                printer.show()
                message = '[OPERATION FAILED]: Could not find the mm executable. Please run MavensMate > Install/Update MavensMate API (mm) to install mm to your MavensMate for Sublime Text plugin directory.'
                printer.write('\n'+message+'\n')
                return
        else:
            if settings.get('mm_path', 'default') == 'default' and not os.path.isfile(os.path.join(sublime.packages_path(),"User","MavensMate","mm","mm.exe")):
                active_window_id = sublime.active_window().id()
                printer = PanelPrinter.get(active_window_id)
                printer.show()
                message = '[OPERATION FAILED]: Could not find the mm executable. Please run MavensMate > Install/Update MavensMate API (mm) to install mm to your MavensMate for Sublime Text plugin directory.'
                printer.write('\n'+message+'\n')
                return 

    if 'linux' in sys.platform:
        if not os.path.isfile(settings.get('mm_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text "subl" executable. Please set mm_subl_location to location of "subl" on the disk.'
            printer.write('\n'+message+'\n')
            return

    if 'win32' in sys.platform:
        if not os.path.isfile(settings.get('mm_windows_subl_location')):
            active_window_id = sublime.active_window().id()
            printer = PanelPrinter.get(active_window_id)
            printer.show()
            message = '[OPERATION FAILED]: Could not locate Sublime Text. Please set mm_windows_subl_location to location of sublime_text.exe on the disk.'
            printer.write('\n'+message+'\n')
            return

    if not util.valid_workspace():
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Please ensure mm_workspace is set to existing location(s) on your local drive'
        printer.write('\n'+message+'\n')
        return

    window, view = util.get_window_and_view_based_on_context(kwargs.get('context', None))

    #if it's a legacy project, need to intercept the call and open the upgrade ui
    #TODO: this should probably be handled in mm
    if operation != 'new_project' and operation != 'new_project_from_existing_directory' and util.is_project_legacy(window) == True:
        operation = 'upgrade_project'
    
    community.sync_activity(operation)

    threads = []
    thread = MavensMateTerminalCall(
        operation, 
        project_name=util.get_project_name(window), 
        active_file=util.get_active_file(), 
        params=kwargs.get('params', None),
        context=kwargs.get('context', None),
        message=kwargs.get('message', None),
        use_mm_panel=use_mm_panel,
        process_id=util.get_random_string(10),
        mm_path=settings.get('mm_path'),
        callback=kwargs.get('callback', None)
    )
    if operation == 'index_apex':
        thread.daemon = True
    threads.append(thread)        
    thread.start()
def call(operation, use_mm_panel=True, **kwargs):
    settings = sublime.load_settings('mavensmate.sublime-settings')
    #if the mm tool is missing, we can't do anything
    if not os.path.exists(settings.get('mm_location')) and settings.get('mm_development_mode') == False:
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Could not find MavensMate.app. Download MavensMate.app from http://www.joe-ferraro.com/mavensmate/MavensMate.app and place in /Applications. Also, please ensure mm_app_location and mm_location are set properly in Sublime Text (MavensMate --> Settings --> User)'
        printer.write('\n'+message+'\n')
        return

    #if it's a legacy project, need to intercept the call and open the upgrade ui
    #TODO: this should probably be handled in mm
    if operation != 'new_project' and operation != 'new_project_from_existing_directory' and util.is_project_legacy() == True:
        operation = 'upgrade_project'
    
    threads = []
    thread = MavensMateTerminalCall(
        operation, 
        project_name=util.get_project_name(kwargs.get('context', None)), 
        active_file=util.get_active_file(), 
        params=kwargs.get('params', None),
        context=kwargs.get('context', None),
        message=kwargs.get('message', None),
        use_mm_panel=use_mm_panel,
        process_id=util.get_random_string(10),
        mm_location=settings.get('mm_location'),
        callback=kwargs.get('callback', None)
    )
    if operation == 'index_apex':
        thread.daemon = True
    threads.append(thread)        
    thread.start()
def call(operation, use_mm_panel=True, **kwargs):
    settings = sublime.load_settings('mavensmate.sublime-settings')
    #if the mm tool is missing, we can't do anything
    if not os.path.exists(settings.get('mm_location')) and settings.get(
            'mm_development_mode') == False:
        active_window_id = sublime.active_window().id()
        printer = PanelPrinter.get(active_window_id)
        printer.show()
        message = '[OPERATION FAILED]: Could not find MavensMate.app. Download MavensMate.app from http://www.joe-ferraro.com/mavensmate/MavensMate.app and place in /Applications. Also, please ensure mm_app_location and mm_location are set properly in Sublime Text (MavensMate --> Settings --> User)'
        printer.write('\n' + message + '\n')
        return

    #if it's a legacy project, need to intercept the call and open the upgrade ui
    #TODO: this should probably be handled in mm
    if operation != 'new_project' and operation != 'new_project_from_existing_directory' and util.is_project_legacy(
    ) == True:
        operation = 'upgrade_project'

    threads = []
    thread = MavensMateTerminalCall(operation,
                                    project_name=util.get_project_name(
                                        kwargs.get('context', None)),
                                    active_file=util.get_active_file(),
                                    params=kwargs.get('params', None),
                                    context=kwargs.get('context', None),
                                    message=kwargs.get('message', None),
                                    use_mm_panel=use_mm_panel,
                                    process_id=util.get_random_string(10),
                                    mm_location=settings.get('mm_location'),
                                    callback=kwargs.get('callback', None))
    if operation == 'index_apex':
        thread.daemon = True
    threads.append(thread)
    thread.start()