# Path: robot_designer_plugin/core/config.py
# PLUGIN_PREFIX = "robotdesigner"
# OPERATOR_PREFIX = PLUGIN_PREFIX + '.'
# MENU_PREFIX = "ROBOTDESIGNER_MT_"
# BACKTRACE_FILTER_FUNC = ('func_wrapper', 'op_logger', '__call__')
# BACKTRACE_FILTER_HIDE_CODE = ('run', 'runNestedOperator')
# BACKTRACE_MESSAGE_STACK_CODE = "\t\t{0:25}\t\t({1}:{2})\n\t\t\t{3}\n"
# BACKTRACE_MESSAGE_STACK = "\t\t{0:25}\t\t({1}:{2})\n"
# BACKTRACE_MESSAGE_CALLSTACK = "\n\tNesting Level %d:\n\n\tCallstack:\n"
# BACKTRACE_MESSAGE = "\n\tBacktrace:\n"
# EXCEPTION_MESSAGE = "\tException:\t%s\n\tMessages:\n\t\t%s\n%s\n%s"
# 
# Path: robot_designer_plugin/core/logfile.py
# def LogFunction(func):
#     """
#     Logging / exception handling decorator for functions (use for draw function for instance).
# 
#     :param func: The function to decorate
#     :return: A :term:`decorator`
#     """
# 
#     def func_logger(self, context):
# 
#         # Execute the Operator
#         try:
#             return func(self, context)
# 
#         except Exception as e:
#             gui_logger.error("Draw function in {} module threw an exception:\n {} {} {} {} {}".format(
#                              func.__module__, EXCEPTION_MESSAGE, type(e).__name__, e, log_callstack(), log_callstack(back_trace=True)))
#             InfoBox.global_messages.append(e)
# 
#     return func_logger


import bpy.utils.previews
import os
from .config import resource_path
from .logfile import LogFunction
#
# ######

"""
Sphinx-autodoc tag
"""




def reload_resources():
    # todo Append Resources from file in script path
    pass


class InconLoader(object):
    icons_dict = None

    @LogFunction
    @classmethod
    def register(cls):
        cls.icons_dict = bpy.utils.previews.new()

    @classmethod
    def loadIcon(cls, filename):
        '''

        :param filename: Relative to :data:`.config/resource_path`
        :return: None
        '''

# Path: robot_designer_plugin/core/config.py
# PLUGIN_PREFIX = "robotdesigner"
# OPERATOR_PREFIX = PLUGIN_PREFIX + '.'
# MENU_PREFIX = "ROBOTDESIGNER_MT_"
# BACKTRACE_FILTER_FUNC = ('func_wrapper', 'op_logger', '__call__')
# BACKTRACE_FILTER_HIDE_CODE = ('run', 'runNestedOperator')
# BACKTRACE_MESSAGE_STACK_CODE = "\t\t{0:25}\t\t({1}:{2})\n\t\t\t{3}\n"
# BACKTRACE_MESSAGE_STACK = "\t\t{0:25}\t\t({1}:{2})\n"
# BACKTRACE_MESSAGE_CALLSTACK = "\n\tNesting Level %d:\n\n\tCallstack:\n"
# BACKTRACE_MESSAGE = "\n\tBacktrace:\n"
# EXCEPTION_MESSAGE = "\tException:\t%s\n\tMessages:\n\t\t%s\n%s\n%s"
# 
# Path: robot_designer_plugin/core/logfile.py
# def LogFunction(func):
#     """
#     Logging / exception handling decorator for functions (use for draw function for instance).
# 
#     :param func: The function to decorate
#     :return: A :term:`decorator`
#     """
# 
#     def func_logger(self, context):
# 
#         # Execute the Operator
#         try:
#             return func(self, context)
# 
#         except Exception as e:
#             gui_logger.error("Draw function in {} module threw an exception:\n {} {} {} {} {}".format(
#                              func.__module__, EXCEPTION_MESSAGE, type(e).__name__, e, log_callstack(), log_callstack(back_trace=True)))
#             InfoBox.global_messages.append(e)
# 
#     return func_logger


# Path: robot_designer_plugin/core/resources.py
import bpy.utils.previews
import os
from .config import resource_path
from .logfile import LogFunction

#
# ######

"""
Sphinx-autodoc tag
"""




def reload_resources():
    # todo Append Resources from file in script path
    pass


class InconLoader(object):
    icons_dict = None

    @LogFunction
    @classmethod
    def register(cls):
        cls.icons_dict = bpy.utils.previews.new()

    @classmethod
    def loadIcon(cls, filename):
        '''

        :param filename: Relative to :data:`.config/resource_path`
        :return: None
        '''

        cls.icons_dict.load("custom_icon", os.path.join(resource_path, filename), 'IMAGE')