# Path: formatters/log.py
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


import os, sys
import types
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from formatters.log import Paint

# End of class HelpFactory



class HelpPresenter:


    @staticmethod
    def get(key, category):
        helpEntry = HelpFactory.createHelp(category)
        item = helpEntry.get(key)
        if item == None and category == None:
            helpXMLs = os.listdir(os.path.dirname(Help.XML))
            for helpXML in helpXMLs:
                if helpXML.startswith("help_") and helpXML.endswith(".xml"):
                    category = helpXML[5:-4]
                    helpEntry = HelpFactory.createHelp(category)
                    item = helpEntry.get(key)

        return item  


    @staticmethod
    def showall():
        helpEntry = HelpFactory.createHelp()
        for code in sorted(helpEntry.CODE_TO_NAME.keys()):
            if code == 255: continue;
            item = helpEntry.get(code)
            if item.detail != None:

# Path: formatters/log.py
# class Paint:
# 
#     @staticmethod
#     def bold(s):
#         return "%s[01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def red(s):
#         return "%s[33;31m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def green(s):
#         return "%s[31;32m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def blue(s):
#         return "%s[34;01m%s%s[0m" % (chr(27), s.rstrip(), chr(27))
# 
#     @staticmethod
#     def yellow(s):
#         return "%s[31;33m%s%s[0m" % (chr(27), s.rstrip(), chr(27))


# Path: workflow/help.py
import os, sys
import types
    import xml.etree.cElementTree as ET
    import xml.etree.ElementTree as ET
from formatters.log import Paint


# End of class HelpFactory



class HelpPresenter:


    @staticmethod
    def get(key, category):
        helpEntry = HelpFactory.createHelp(category)
        item = helpEntry.get(key)
        if item == None and category == None:
            helpXMLs = os.listdir(os.path.dirname(Help.XML))
            for helpXML in helpXMLs:
                if helpXML.startswith("help_") and helpXML.endswith(".xml"):
                    category = helpXML[5:-4]
                    helpEntry = HelpFactory.createHelp(category)
                    item = helpEntry.get(key)

        return item  


    @staticmethod
    def showall():
        helpEntry = HelpFactory.createHelp()
        for code in sorted(helpEntry.CODE_TO_NAME.keys()):
            if code == 255: continue;
            item = helpEntry.get(code)
            if item.detail != None:

                print "%s(%d)\n%s" % (Paint.bold(item.name), item.code, item.detail.replace("\t", "").strip())