How to use the cefpython3.cefpython.GetModuleDirectory function in cefpython3

To help you get started, we’ve selected a few cefpython3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github james-owen-ryan / talktown-testbed / browser.py View on Github external
g_applicationSettings = {
            # Disk cache
            # "cache_path": "webcache/",

            # CEF Python debug messages in console and in log_file
            "debug": True,
            # Set it to LOGSEVERITY_VERBOSE for more details
            "log_severity": cefpython.LOGSEVERITY_INFO,
            # Set to "" to disable logging to a file
            "log_file": GetApplicationPath("debug.log"),
            # This should be enabled only when debugging
            "release_dcheck_enabled": True,

            # These directories must be set on Linux
            "locales_dir_path": cefpython.GetModuleDirectory()+"/locales",
            "resources_dir_path": cefpython.GetModuleDirectory(),
            # The "subprocess" executable that launches the Renderer
            # and GPU processes among others. You may rename that
            # executable if you like.
            "browser_subprocess_path": "%s/%s" % (
                cefpython.GetModuleDirectory(), "subprocess"),

        }

        # You can comment out the code below if you do not want High
        # DPI support. If you disable it text will look fuzzy on
        # high DPI displays.
        #
        # Enabling High DPI support in app can be done by
        # embedding a DPI awareness xml manifest in executable
        # (see Issue 112 comment #2), or by calling SetProcessDpiAware
        # function. Embedding xml manifest is the most reliable method.
github james-owen-ryan / talktown-testbed / browser.py View on Github external
"debug": True,
            # Set it to LOGSEVERITY_VERBOSE for more details
            "log_severity": cefpython.LOGSEVERITY_INFO,
            # Set to "" to disable logging to a file
            "log_file": GetApplicationPath("debug.log"),
            # This should be enabled only when debugging
            "release_dcheck_enabled": True,

            # These directories must be set on Linux
            "locales_dir_path": cefpython.GetModuleDirectory()+"/locales",
            "resources_dir_path": cefpython.GetModuleDirectory(),
            # The "subprocess" executable that launches the Renderer
            # and GPU processes among others. You may rename that
            # executable if you like.
            "browser_subprocess_path": "%s/%s" % (
                cefpython.GetModuleDirectory(), "subprocess"),

        }

        # You can comment out the code below if you do not want High
        # DPI support. If you disable it text will look fuzzy on
        # high DPI displays.
        #
        # Enabling High DPI support in app can be done by
        # embedding a DPI awareness xml manifest in executable
        # (see Issue 112 comment #2), or by calling SetProcessDpiAware
        # function. Embedding xml manifest is the most reliable method.
        # The downside of calling SetProcessDpiAware is that scrollbar
        # in CEF browser is smaller than it should be. This is because
        # DPI awareness was set too late, after the CEF dll was loaded.
        # To fix that embed DPI awareness xml manifest in the .exe file.
        #
github cztomczak / cefpython / src / linux / binaries_64bit / deprecated / pygtk_.py View on Github external
print('[pygtk_.py] GTK version: %s' % version)

    # Intercept python exceptions. Exit app immediately when exception
    # happens on any of the threads.
    sys.excepthook = ExceptHook

    # Application settings
    settings = {
        "debug": True, # cefpython debug messages in console and in log_file
        "log_severity": cefpython.LOGSEVERITY_INFO, # LOGSEVERITY_VERBOSE
        "log_file": GetApplicationPath("debug.log"), # Set to "" to disable
        # This directories must be set on Linux
        "locales_dir_path": cefpython.GetModuleDirectory()+"/locales",
        "resources_dir_path": cefpython.GetModuleDirectory(),
        "browser_subprocess_path": "%s/%s" % (
            cefpython.GetModuleDirectory(), "subprocess"),
    }

    cefpython.Initialize(settings)
    cefpython.WindowUtils.InstallX11ErrorHandlers()

    gobject.threads_init() # Timer for the message loop
    PyGTKExample()
    gtk.main()

    cefpython.Shutdown()
github cztomczak / cefpython / src / linux / binaries_64bit / deprecated / pyqt.py View on Github external
if __name__ == '__main__':
    print("[pyqt.py] PyQt version: %s" % QtCore.PYQT_VERSION_STR)
    print("[pyqt.py] QtCore version: %s" % QtCore.qVersion())

    # Intercept python exceptions. Exit app immediately when exception
    # happens on any of the threads.
    sys.excepthook = ExceptHook

    # Application settings
    settings = {
        "debug": True, # cefpython debug messages in console and in log_file
        "log_severity": cefpython.LOGSEVERITY_INFO, # LOGSEVERITY_VERBOSE
        "log_file": GetApplicationPath("debug.log"), # Set to "" to disable.
        # This directories must be set on Linux
        "locales_dir_path": cefpython.GetModuleDirectory()+"/locales",
        "resources_dir_path": cefpython.GetModuleDirectory(),
        "browser_subprocess_path": "%s/%s" % (
            cefpython.GetModuleDirectory(), "subprocess"),
    }

    # Command line switches set programmatically
    switches = {
        # "proxy-server": "socks5://127.0.0.1:8888",
        # "enable-media-stream": "",
        # "--invalid-switch": "" -> Invalid switch name
    }

    cefpython.Initialize(settings, switches)

    app = CefApplication(sys.argv)
    mainWindow = MainWindow()
github carlosperate / ardublockly / start_cef.py View on Github external
# https://code.google.com/p/cefpython/wiki/BrowserSettings
    global g_browserSettings
    g_browserSettings = {
        "plugins_disabled": True,
        "file_access_from_file_urls_allowed": True,
        "universal_access_from_file_urls_allowed": True,
        "java_disabled": True,
        "local_storage_disabled": False
    }

    # Application settings
    # https://code.google.com/p/cefpython/wiki/ApplicationSettings
    global g_applicationSettings
    g_applicationSettings = {
        "browser_subprocess_path": "%s%s%s" % (
            cefpython.GetModuleDirectory(), os.sep, "subprocess"),
        "cache_path": "webcache" + os.sep,
        "context_menu": {"enabled": True,
                         "navigation": True,        # Back, Forward, Reload
                         "print": False,
                         "view_source": False,
                         "external_browser": True,  # Open in external browser
                         "devtools": True},         # Developer Tools
        "downloads_enabled": True,
        "ignore_certificate_errors": True,
        "locales_dir_path": cefpython.GetModuleDirectory() + os.sep + "locales",
        "debug": True,
        "log_file": GetApplicationPath("cef_debug.log"),
        "log_severity": cefpython.LOGSEVERITY_INFO,
        "release_dcheck_enabled": False,
        "remote_debugging_port": 0,
        "resources_dir_path": cefpython.GetModuleDirectory(),
github kiburualex / django2exe / py-dist / run.py View on Github external
print("[pyqt.py] QtCore version: %s" % QtCore.qVersion())

    # Intercept python exceptions. Exit app immediately when exception
    # happens on any of the threads.
    sys.excepthook = ExceptHook

    # Application settings
    settings = {
        # "cache_path": "webcache/", # Disk cache
        "debug": True, # cefpython debug messages in console and in log_file
        "log_severity": cefpython.LOGSEVERITY_INFO, # LOGSEVERITY_VERBOSE
        "log_file": GetApplicationPath("debug.log"), # Set to "" to disable.
        "release_dcheck_enabled": True, # Enable only when debugging.
        # This directories must be set on Linux
        "locales_dir_path": cefpython.GetModuleDirectory()+"/locales",
        "resources_dir_path": cefpython.GetModuleDirectory(),
        "browser_subprocess_path": "%s/%s" % (
            cefpython.GetModuleDirectory(), "subprocess"),
        "context_menu":{
            "enabled" : info.dev_tools_menu_enabled
        },
    }

    # Command line switches set programmatically
    switches = {
        # "proxy-server": "socks5://127.0.0.1:8888",
        # "enable-media-stream": "",
        # "--invalid-switch": "" -> Invalid switch name
    }

    cefpython.Initialize(settings, switches)
github cztomczak / cefpython / cefpython / wx / chromectrl.py View on Github external
"""
    switches = {}
    global g_settings
    if not settings:
        settings = {}

    if not "log_severity" in settings:
        settings["log_severity"] = cefpython.LOGSEVERITY_INFO
    if not "log_file" in settings:
        settings["log_file"] = ""

    if platform.system() == "Linux":
        # On Linux we need to set locales and resources directories.
        if not "locales_dir_path" in settings:
            settings["locales_dir_path"] = \
                cefpython.GetModuleDirectory() + "/locales"
        if not "resources_dir_path" in settings:
            settings["resources_dir_path"] = cefpython.GetModuleDirectory()
    elif platform.system() == "Darwin":
        # On Mac we need to set the resoures dir and the locale_pak switch
        if not "resources_dir_path" in settings:
            settings["resources_dir_path"] = (cefpython.GetModuleDirectory()
                + "/Resources")
        locale_pak = (cefpython.GetModuleDirectory()
            + "/Resources/en.lproj/locale.pak")
        if "locale_pak" in settings:
            locale_pak = settings["locale_pak"]
            del settings["locale_pak"]
        switches["locale_pak"] = locale_pak

    if not "browser_subprocess_path" in settings:
        settings["browser_subprocess_path"] = \
github rentouch / cefkivy / cefkivy / browser.py View on Github external
resources = self.resources_dir
        else:
            resources = md

        def cef_loop(*largs):
            cefpython.MessageLoopWork()
        Clock.schedule_interval(cef_loop, 0)

        settings = {
                    #"debug": True,
                    "log_severity": cefpython.LOGSEVERITY_INFO,
                    #"log_file": "debug.log",
                    "persist_session_cookies": True,
                    "release_dcheck_enabled": True,  # Enable only when debugging.
                    "locales_dir_path": os.path.join(md, "locales"),
                    "browser_subprocess_path": "%s/%s" % (cefpython.GetModuleDirectory(), "subprocess")
                }
        cefpython.Initialize(settings, switches)

        windowInfo = cefpython.WindowInfo()
        windowInfo.SetAsOffscreen(0)
        cefpython.SetGlobalClientCallback("OnCertificateError", self.OnCertificateError)
        self.browser = cefpython.CreateBrowserSync(windowInfo, {}, navigateUrl=self.url)

        # Set cookie manager
        cookie_manager = cefpython.CookieManager.GetGlobalManager()
        cookie_path = os.path.join(resources, "cookies")
        cookie_manager.SetStoragePath(cookie_path, True)

        self.browser.SendFocusEvent(True)
        ch = ClientHandler(self)
        self.browser.SetClientHandler(ch)
github cztomczak / cefpython / src / windows / deprecated_32bit / pywin32.py View on Github external
def CefAdvanced():
    sys.excepthook = ExceptHook

    appSettings = dict()
    # appSettings["cache_path"] = "webcache/" # Disk cache
    if DEBUG:
        # cefpython debug messages in console and in log_file
        appSettings["debug"] = True
        cefwindow.g_debug = True
    appSettings["log_file"] = GetApplicationPath("debug.log")
    appSettings["log_severity"] = cefpython.LOGSEVERITY_INFO
    appSettings["browser_subprocess_path"] = "%s/%s" % (
            cefpython.GetModuleDirectory(), "subprocess")
    cefpython.Initialize(appSettings)

    wndproc = {
        win32con.WM_CLOSE: CloseWindow,
        win32con.WM_DESTROY: QuitApplication,
        win32con.WM_SIZE: cefpython.WindowUtils.OnSize,
        win32con.WM_SETFOCUS: cefpython.WindowUtils.OnSetFocus,
        win32con.WM_ERASEBKGND: cefpython.WindowUtils.OnEraseBackground
    }

    browserSettings = dict()
    browserSettings["universal_access_from_file_urls_allowed"] = True
    browserSettings["file_access_from_file_urls_allowed"] = True

    if os.path.exists("icon.ico"):
        icon = os.path.abspath("icon.ico")
github DeForce / LalkaChat / modules / interface / chromium.py View on Github external
"""Initializes CEF, We should do it before initializing wx
       If no settings passed a default is used
    """
    switches = {}
    global g_settings
    if not settings:
        settings = {}

    if "log_severity" not in settings:
        settings["log_severity"] = cefpython.LOGSEVERITY_ERROR
    if "log_file" not in settings:
        settings["log_file"] = ""

    if "browser_subprocess_path" not in settings:
        settings["browser_subprocess_path"] = \
            "%s/%s" % (cefpython.GetModuleDirectory(), "subprocess")

    if debug:
        settings["debug"] = True  # cefpython messages in console and log_file
        settings["log_severity"] = cefpython.LOGSEVERITY_VERBOSE
        settings["log_file"] = "debug.log"  # Set to "" to disable.

    g_settings = settings
    cefpython.Initialize(settings, switches)