初次创建仓库提交代码
1. 已经构建好了架子了。 2. 添加了示例的插件
This commit is contained in:
61
thirdparty/py_trees/syntax_highlighting.py
vendored
Normal file
61
thirdparty/py_trees/syntax_highlighting.py
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# License: BSD
|
||||
# https://raw.githubusercontent.com/splintered-reality/py_trees/devel/LICENSE
|
||||
#
|
||||
##############################################################################
|
||||
# Documentation
|
||||
##############################################################################
|
||||
|
||||
"""
|
||||
.. module:: syntax_highlighting
|
||||
:synopsis: Syntax highlighting for various py_trees objects
|
||||
|
||||
Oh my spaghettified magnificence,
|
||||
Bless my noggin with a tickle from your noodly appendages!
|
||||
"""
|
||||
|
||||
##############################################################################
|
||||
# Imports
|
||||
##############################################################################
|
||||
|
||||
from . import common
|
||||
from . import console
|
||||
|
||||
##############################################################################
|
||||
# Syntax Highlighting
|
||||
##############################################################################
|
||||
|
||||
|
||||
_status_colour_strings = {common.Status.SUCCESS: console.green + str(common.Status.SUCCESS) + console.reset,
|
||||
common.Status.RUNNING: console.blue + str(common.Status.RUNNING) + console.reset,
|
||||
common.Status.FAILURE: console.red + str(common.Status.FAILURE) + console.reset,
|
||||
common.Status.INVALID: console.yellow + str(common.Status.INVALID) + console.reset
|
||||
}
|
||||
|
||||
_status_colour_codes = {common.Status.SUCCESS: console.green,
|
||||
common.Status.RUNNING: console.cyan,
|
||||
common.Status.FAILURE: console.red,
|
||||
common.Status.INVALID: console.yellow
|
||||
}
|
||||
|
||||
|
||||
def status(status):
|
||||
"""
|
||||
Syntax colouring for :py:class:`~py_trees.common.Status`
|
||||
|
||||
:param :py:class:`~py_trees.common.Status` Status: behaviour status
|
||||
:returns: syntax highlighted string representation of the status
|
||||
"""
|
||||
return _status_colour_strings[status]
|
||||
|
||||
|
||||
def status_colour_code(status):
|
||||
"""
|
||||
Colour code associated with the :py:class:`~py_trees.common.Status` for
|
||||
syntax highlighting
|
||||
|
||||
:param :py:class:`~py_trees.common.Status` Status: behaviour status
|
||||
:returns: console colour code associated with the status
|
||||
"""
|
||||
return _status_colour_codes[status]
|
||||
Reference in New Issue
Block a user