#!/usr/bin/env python
# -*- coding: UTF-8 -*-

"""
Minimal example of the CEFBrowser widget use. Here you don't have any controls
(back / forth / reload) or whatsoever. Just a kivy app displaying the
chromium-webview.
In this example we demonstrate how the cache path of CEF can be set.
"""


import os

from kivy.app import App
from kivy.garden.cefpython import CEFBrowser
from kivy.logger import Logger


if __name__ == '__main__':
    class SimpleBrowserApp(App):
        def build(self):
            # Set runtime data paths
            CEFBrowser.set_data_path(os.path.realpath("./cef_data"))
            # CEFBrowser.set_caches_path(os.path.realpath("./cef_caches"))
            # CEFBrowser.set_cookies_path(os.path.realpath("./cef_cookies"))
            # CEFBrowser.set_logs_path(os.path.realpath("./cef_logs"))
            Logger.info("Example: The CEF pathes have been set to")
            Logger.info("- Cache %s", CEFBrowser._caches_path)
            Logger.info("- Cookies %s", CEFBrowser._cookies_path)
            Logger.info("- Logs %s", CEFBrowser._logs_path)

            # Create CEFBrowser instance. Go to test-site.
            cb = CEFBrowser(url="http://jegger.ch/datapool/app/test.html")
            return cb

    SimpleBrowserApp().run()

[((27, 12, 27, 67), 'kivy.logger.Logger.info', 'Logger.info', ({(27, 24, 27, 66): '"""Example: The CEF pathes have been set to"""'}, {}), "('Example: The CEF pathes have been set to')", False, 'from kivy.logger import Logger\n'), ((28, 12, 28, 62), 'kivy.logger.Logger.info', 'Logger.info', ({(28, 24, 28, 36): '"""- Cache %s"""', (28, 38, 28, 61): 'CEFBrowser._caches_path'}, {}), "('- Cache %s', CEFBrowser._caches_path)", False, 'from kivy.logger import Logger\n'), ((29, 12, 29, 65), 'kivy.logger.Logger.info', 'Logger.info', ({(29, 24, 29, 38): '"""- Cookies %s"""', (29, 40, 29, 64): 'CEFBrowser._cookies_path'}, {}), "('- Cookies %s', CEFBrowser._cookies_path)", False, 'from kivy.logger import Logger\n'), ((30, 12, 30, 59), 'kivy.logger.Logger.info', 'Logger.info', ({(30, 24, 30, 35): '"""- Logs %s"""', (30, 37, 30, 58): 'CEFBrowser._logs_path'}, {}), "('- Logs %s', CEFBrowser._logs_path)", False, 'from kivy.logger import Logger\n'), ((33, 17, 33, 74), 'kivy.garden.cefpython.CEFBrowser', 'CEFBrowser', (), '', False, 'from kivy.garden.cefpython import CEFBrowser\n'), ((23, 37, 23, 67), 'os.path.realpath', 'os.path.realpath', ({(23, 54, 23, 66): '"""./cef_data"""'}, {}), "('./cef_data')", False, 'import os\n')]