# Path: resources/lib/simple_logging.py
# class SimpleLogging:
#     name = ""
#     enable_logging = False
# 
#     def __init__(self, name):
#         settings = xbmcaddon.Addon()
#         prefix = settings.getAddonInfo('name')
#         self.name = prefix + '.' + name
#         self.enable_logging = settings.getSetting('log_debug') == "true"
# 
#         # params = {"setting": "debug.showloginfo"}
#         # setting_result = json_rpc('Settings.getSettingValue').execute(params)
#         # current_value = setting_result.get("result", None)
#         # if current_value is not None:
#         #     self.enable_logging = current_value.get("value", False)
#         # xbmc.log("LOGGING_ENABLED %s : %s" % (self.name, str(self.enable_logging)), level=xbmc.LOGDEBUG)
# 
#     def __str__(self):
#         return "LoggingEnabled: " + str(self.enable_logging)
# 
#     def info(self, fmt, *args, **kwargs):
#         log_line = self.name + "|INFO|" + self.log_line(fmt, *args)
#         xbmc.log(log_line, level=xbmc.LOGNOTICE)
# 
#     def error(self, fmt, *args, **kwargs):
#         log_line = self.name + "|ERROR|" + self.log_line(fmt, *args)
#         xbmc.log(log_line, level=xbmc.LOGERROR)
# 
#     def debug(self, fmt, *args, **kwargs):
#         if self.enable_logging:
#             log_line = self.name + "|DEBUG|" + self.log_line(fmt, *args)
#             xbmc.log(log_line, level=xbmc.LOGNOTICE)
# 
#     @staticmethod
#     def log_line(fmt, *args):
#         new_args = []
#         # convert any unicode to utf-8 strings
#         for arg in args:
#             if isinstance(arg, unicode):
#                 new_args.append(arg.encode("utf-8"))
#             else:
#                 new_args.append(arg)
#         log_line = fmt.format(*new_args)
#         return log_line


import xbmc
import xbmcgui
from .simple_logging import SimpleLogging
# Gnu General Public License - see LICENSE.TXT



log = SimpleLogging(__name__)


class SafeDeleteDialog(xbmcgui.WindowXMLDialog):

    confirm = False
    message = "Demo Message"
    heading = "Demo Heading"
    action_exitkeys_id = None

    def __init__(self, *args, **kwargs):
        log.debug("SafeDeleteDialog: __init__")
        xbmcgui.WindowXML.__init__(self, *args, **kwargs)

    def onInit(self):
        log.debug("SafeDeleteDialog: onInit")
        self.action_exitkeys_id = [10, 13]

        message_control = self.getControl(3)
        message_control.setText(self.message)

        message_control = self.getControl(4)

# Path: resources/lib/simple_logging.py
# class SimpleLogging:
#     name = ""
#     enable_logging = False
# 
#     def __init__(self, name):
#         settings = xbmcaddon.Addon()
#         prefix = settings.getAddonInfo('name')
#         self.name = prefix + '.' + name
#         self.enable_logging = settings.getSetting('log_debug') == "true"
# 
#         # params = {"setting": "debug.showloginfo"}
#         # setting_result = json_rpc('Settings.getSettingValue').execute(params)
#         # current_value = setting_result.get("result", None)
#         # if current_value is not None:
#         #     self.enable_logging = current_value.get("value", False)
#         # xbmc.log("LOGGING_ENABLED %s : %s" % (self.name, str(self.enable_logging)), level=xbmc.LOGDEBUG)
# 
#     def __str__(self):
#         return "LoggingEnabled: " + str(self.enable_logging)
# 
#     def info(self, fmt, *args, **kwargs):
#         log_line = self.name + "|INFO|" + self.log_line(fmt, *args)
#         xbmc.log(log_line, level=xbmc.LOGNOTICE)
# 
#     def error(self, fmt, *args, **kwargs):
#         log_line = self.name + "|ERROR|" + self.log_line(fmt, *args)
#         xbmc.log(log_line, level=xbmc.LOGERROR)
# 
#     def debug(self, fmt, *args, **kwargs):
#         if self.enable_logging:
#             log_line = self.name + "|DEBUG|" + self.log_line(fmt, *args)
#             xbmc.log(log_line, level=xbmc.LOGNOTICE)
# 
#     @staticmethod
#     def log_line(fmt, *args):
#         new_args = []
#         # convert any unicode to utf-8 strings
#         for arg in args:
#             if isinstance(arg, unicode):
#                 new_args.append(arg.encode("utf-8"))
#             else:
#                 new_args.append(arg)
#         log_line = fmt.format(*new_args)
#         return log_line


# Path: resources/lib/safe_delete_dialog.py
import xbmc
import xbmcgui
from .simple_logging import SimpleLogging

# Gnu General Public License - see LICENSE.TXT



log = SimpleLogging(__name__)


class SafeDeleteDialog(xbmcgui.WindowXMLDialog):

    confirm = False
    message = "Demo Message"
    heading = "Demo Heading"
    action_exitkeys_id = None

    def __init__(self, *args, **kwargs):
        log.debug("SafeDeleteDialog: __init__")
        xbmcgui.WindowXML.__init__(self, *args, **kwargs)

    def onInit(self):
        log.debug("SafeDeleteDialog: onInit")
        self.action_exitkeys_id = [10, 13]

        message_control = self.getControl(3)
        message_control.setText(self.message)

        message_control = self.getControl(4)

        message_control.setLabel(self.heading)