示例#1
0
		out.append('/'.join(s[0] for s in p['path']))

	return out

###############################
# Handle Websockets events
###############################

@eutils.main_thread
def _on_diff_editor_sources(data):
	logger.debug('Received diff sources response: %s' % ws.format_message(data))
	if not data['success']:
		logger.error('[ws] %s' % data.get('result', ''))
		_on_diff_complete(data.get('file'), None, None)
	else:
		r = data.get('result', {})
		_on_diff_complete(data.get('file'), r.get('patches'), r.get('source'))

@eutils.main_thread
def _on_patch_editor_sources(data):
	logger.debug('Received patched source: %s' % ws.format_message(data))
	if not data['success']:
		logger.error('[ws] %s' % data.get('result', ''))
		_on_patch_complete(data.get('file'), None)
	else:
		r = data.get('result', {})
		_on_patch_complete(data.get('file'), r)

ws.on('diff', _on_diff_editor_sources)
ws.on('patch', _on_patch_editor_sources)
示例#2
0
###############################
# Handle Websockets events
###############################


@eutils.main_thread
def _on_diff_editor_sources(data):
    logger.debug('Received diff sources response: %s' %
                 ws.format_message(data))
    if not data['success']:
        logger.error('[ws] %s' % data.get('result', ''))
        _on_diff_complete(data.get('file'), None, None)
    else:
        r = data.get('result', {})
        _on_diff_complete(data.get('file'), r.get('patches'), r.get('source'))


@eutils.main_thread
def _on_patch_editor_sources(data):
    logger.debug('Received patched source: %s' % ws.format_message(data))
    if not data['success']:
        logger.error('[ws] %s' % data.get('result', ''))
        _on_patch_complete(data.get('file'), None)
    else:
        r = data.get('result', {})
        _on_patch_complete(data.get('file'), r)


ws.on('diff', _on_diff_editor_sources)
ws.on('patch', _on_patch_editor_sources)
示例#3
0
		if len(display_items) == 1:
			on_done(0)
		elif display_items:
			self.view.window().show_quick_panel(display_items, on_done)
		else:
			sublime.error_message('No patches found. You have to open patch files in Sublime Text or copy patch file contents into clipboard and run this action again.')

def unload_handler():
	ws.stop()

def start_plugin():
	ws.start(int(eutils.get_setting('port')))
	logger.setLevel(logging.DEBUG if eutils.get_setting('debug', False) else logging.INFO)

	# collect all view's file paths
	for view in eutils.all_views():
		_view_file_names[view.id()] = eutils.file_name(view)


def plugin_loaded():
	sublime.set_timeout(start_plugin, 100)

# Init plugin
ws.on('update', handle_patch_request)
ws.on('requestUnsavedFiles', send_unsaved_files)
ws.on('ws_open', identify_editor)
lsutils.diff.on('diff_complete', send_patches)
lsutils.diff.on('patch_complete', apply_patched_source)

if sublime_ver < 3:
	plugin_loaded()
                'No patches found. You have to open patch files in Sublime Text or copy patch file contents into clipboard and run this action again.'
            )


def unload_handler():
    ws.stop()


def start_plugin():
    ws.start(int(eutils.get_setting('port')))
    logger.setLevel(
        logging.DEBUG if eutils.get_setting('debug', False) else logging.INFO)

    # collect all view's file paths
    for view in eutils.all_views():
        _view_file_names[view.id()] = eutils.file_name(view)


def plugin_loaded():
    sublime.set_timeout(start_plugin, 100)


# Init plugin
ws.on('update', handle_patch_request)
ws.on('requestUnsavedFiles', send_unsaved_files)
ws.on('ws_open', identify_editor)
lsutils.diff.on('diff_complete', send_patches)
lsutils.diff.on('patch_complete', apply_patched_source)

if sublime_ver < 3:
    plugin_loaded()
示例#5
0
                "No patches found. You have to open patch files in Sublime Text or copy patch file contents into clipboard and run this action again."
            )


def unload_handler():
    ws.stop()


def start_plugin():
    ws.start(int(eutils.get_setting("port")))
    logger.setLevel(logging.DEBUG if eutils.get_setting("debug", False) else logging.INFO)

    # collect all view's file paths
    for view in eutils.all_views():
        _view_file_names[view.id()] = eutils.file_name(view)


def plugin_loaded():
    sublime.set_timeout(start_plugin, 100)


# Init plugin
ws.on("update", handle_patch_request)
ws.on("requestUnsavedFiles", send_unsaved_files)
ws.on("ws_open", identify_editor)
lsutils.diff.on("diff_complete", send_patches)
lsutils.diff.on("patch_complete", apply_patched_source)

if sublime_ver < 3:
    plugin_loaded()
示例#6
0
		if len(display_items) == 1:
			on_done(0)
		elif display_items:
			self.view.window().show_quick_panel(display_items, on_done)
		else:
			sublime.error_message('No patches found. You have to open patch files in Sublime Text or copy patch file contents into clipboard and run this action again.')

def unload_handler():
	ws.stop()

def start_plugin():
	ws.start(int(eutils.get_setting('port')))
	logger.setLevel(logging.DEBUG if eutils.get_setting('debug', False) else logging.INFO)

	# collect all view's file paths
	for view in eutils.all_views():
		_view_file_names[view.id()] = eutils.file_name(view)


def plugin_loaded():
	sublime.set_timeout(start_plugin, 100)

# Init plugin
ws.on('update', handle_patch_request)
ws.on('ws_open', identify_editor)
lsutils.diff.on('diff_complete', send_patches)
lsutils.diff.on('patch_complete', apply_patched_source)

if sublime_ver < 3:
	plugin_loaded()