# Path: py/axonchisel/metrics/io/erout/plugins/ero_geckoboard/base.py
# class EROut_geckoboard(EROutBase):
#     """
#     Superclass EROut (Extensible Report Outputter) Plugin for geckoboard.
#     Adds JSON-serializable output to extinfo['jout'] dict.
# 
#     Subclasses should define plugin_output() and immediately set
#     self._qfdomain to the str name of the key in QFormat under which
#     its format can be found.
#     """
# 
#     #
#     # Abstract Method Implementations
#     #
# 
#     # abstract
#     def plugin_create(self):
#         """
#         Invoked once to allow plugin to setup what it needs.
#         """
#         self._prep_output()
# 
#     # abstract
#     def plugin_destroy(self):
#         """
#         Invoked once to allow plugin to clean up after itself.
#         """
#         pass
# 
# 
#     #
#     # Protected Methods for Subclasses
#     #
# 
#     def _prep_output(self):
#         """Prepare jout output."""
#         self.jout = self.plugin_extinfo('jout')
#         if self.jout.get('item') is None:
#             self.jout['item'] = []
# 
#     def _qformat_get(self, key, default):
#         """Proxy for QFormat.get that allows for missing Query."""
#         if not self.query:
#             return default
#         return self.query.qformat.get(self._qfdomain, key, default)
# 
#     @staticmethod
#     def _round_sigdigs(val, ndigits):
#         """Round float value to specified number of significant digits."""
#         fmt = "%%.%de" % (ndigits - 1)
#         return float(fmt % val)
# 
#     @staticmethod
#     def _is_round(val):
#         """Return bool indicating if float val is a round integer."""
#         return (int(val) == val)


from .base import EROut_geckoboard
import logging
# ----------------------------------------------------------------------------



log =  logging.getLogger(__name__)


# ----------------------------------------------------------------------------


# Type numbers used by Geckoboard Text widget:
_GB_TEXT_TYPE_NORMAL  = 0   # no flag
_GB_TEXT_TYPE_INFO    = 2   # small gray "i" flag
_GB_TEXT_TYPE_ALERT   = 1   # serious orange "!" flag
_GB_TEXT_TYPE_BY_COLOR = {    # map color to GB text type
    'GREEN': _GB_TEXT_TYPE_NORMAL,
    'AMBER': _GB_TEXT_TYPE_INFO,
    'RED'  : _GB_TEXT_TYPE_ALERT,
}

_QFORMAT_RAG_KEY_BY_COLOR = {  # map color to QFormat format key name
    'GREEN': 'green',
    'AMBER': 'amber',
    'RED':   'red',
}


# ----------------------------------------------------------------------------



# Path: py/axonchisel/metrics/io/erout/plugins/ero_geckoboard/base.py
# class EROut_geckoboard(EROutBase):
#     """
#     Superclass EROut (Extensible Report Outputter) Plugin for geckoboard.
#     Adds JSON-serializable output to extinfo['jout'] dict.
# 
#     Subclasses should define plugin_output() and immediately set
#     self._qfdomain to the str name of the key in QFormat under which
#     its format can be found.
#     """
# 
#     #
#     # Abstract Method Implementations
#     #
# 
#     # abstract
#     def plugin_create(self):
#         """
#         Invoked once to allow plugin to setup what it needs.
#         """
#         self._prep_output()
# 
#     # abstract
#     def plugin_destroy(self):
#         """
#         Invoked once to allow plugin to clean up after itself.
#         """
#         pass
# 
# 
#     #
#     # Protected Methods for Subclasses
#     #
# 
#     def _prep_output(self):
#         """Prepare jout output."""
#         self.jout = self.plugin_extinfo('jout')
#         if self.jout.get('item') is None:
#             self.jout['item'] = []
# 
#     def _qformat_get(self, key, default):
#         """Proxy for QFormat.get that allows for missing Query."""
#         if not self.query:
#             return default
#         return self.query.qformat.get(self._qfdomain, key, default)
# 
#     @staticmethod
#     def _round_sigdigs(val, ndigits):
#         """Round float value to specified number of significant digits."""
#         fmt = "%%.%de" % (ndigits - 1)
#         return float(fmt % val)
# 
#     @staticmethod
#     def _is_round(val):
#         """Return bool indicating if float val is a round integer."""
#         return (int(val) == val)


# Path: py/axonchisel/metrics/io/erout/plugins/ero_geckoboard/text.py
from .base import EROut_geckoboard
import logging

# ----------------------------------------------------------------------------



log =  logging.getLogger(__name__)


# ----------------------------------------------------------------------------


# Type numbers used by Geckoboard Text widget:
_GB_TEXT_TYPE_NORMAL  = 0   # no flag
_GB_TEXT_TYPE_INFO    = 2   # small gray "i" flag
_GB_TEXT_TYPE_ALERT   = 1   # serious orange "!" flag
_GB_TEXT_TYPE_BY_COLOR = {    # map color to GB text type
    'GREEN': _GB_TEXT_TYPE_NORMAL,
    'AMBER': _GB_TEXT_TYPE_INFO,
    'RED'  : _GB_TEXT_TYPE_ALERT,
}

_QFORMAT_RAG_KEY_BY_COLOR = {  # map color to QFormat format key name
    'GREEN': 'green',
    'AMBER': 'amber',
    'RED':   'red',
}


# ----------------------------------------------------------------------------



class EROut_geckoboard_text(EROut_geckoboard):