Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def init_browser(server_port):
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="http://localhost:{0}?user=admin&pwd=admin".format(str(server_port)),window_title="OmniDB")
cef.MessageLoop()
cef.Shutdown()
cherrypy.engine.exit()
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")
else:
icon = ""
windowHandle = cefwindow.CreateWindow(title="pywin32 example",
className="cefpython3_example", width=1024, height=768,
icon=icon, windowProc=wndproc)
windowInfo = cefpython.WindowInfo()
windowInfo.SetAsChild(windowHandle)
browser = cefpython.CreateBrowserSync(windowInfo, browserSettings,
navigateUrl=GetApplicationPath("example.html"))
cefpython.MessageLoop()
cefpython.Shutdown()
parent_handle = 0
# This call has effect only on Mac and Linux.
# All rect coordinates are applied including X and Y parameters.
window_info.SetAsChild(parent_handle, [0, 0, 900, 640])
browser = cef.CreateBrowserSync(url="https://www.google.com/",
window_info=window_info,
window_title="Window size")
if platform.system() == "Windows":
window_handle = browser.GetOuterWindowHandle()
insert_after_handle = 0
# X and Y parameters are ignored by setting the SWP_NOMOVE flag
SWP_NOMOVE = 0x0002
# noinspection PyUnresolvedReferences
ctypes.windll.user32.SetWindowPos(window_handle, insert_after_handle,
0, 0, 900, 640, SWP_NOMOVE)
cef.MessageLoop()
del browser
cef.Shutdown()
def main():
cef.Initialize()
browser = cef.CreateBrowserSync(url="https://www.google.com/",
window_title="OnBeforeClose")
browser.SetClientHandler(LifespanHandler())
cef.MessageLoop()
del browser
cef.Shutdown()
def main():
cef.Initialize()
browser = cef.CreateBrowserSync(
url="data:text/html,<h1>Mouse clicks snippet</h1>"
"This text will be selected after one second.<br>"
"This text will be selected after two seconds.",
window_title="Mouse clicks")
browser.SetClientHandler(LifespanHandler())
cef.MessageLoop()
del browser
cef.Shutdown()
def run_cef_gui(url_target, title):
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url=url_target,
window_title=title)
cef.MessageLoop()
cef.Shutdown()
def init_browser(server_port):
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="http://localhost:{0}?user=admin&pwd=admin&token={1}".format(str(server_port),OmniDB.custom_settings.APP_TOKEN),window_title="OmniDB")
cef.MessageLoop()
cef.Shutdown()
def main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="https://www.google.com/",
window_title="Hello World!")
cef.MessageLoop()
cef.Shutdown()
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
# To change user agent use either "product_version"
# or "user_agent" options. Explained in Tutorial in
# "Change user agent string" section.
settings = {
# "product_version": "MyProduct/10.00",
# "user_agent": "MyAgent/20.00 MyProduct/10.00",
}
cef.Initialize(settings=settings)
set_global_handler()
browser = cef.CreateBrowserSync(url=html_to_data_uri(HTML_code),
window_title="Tutorial")
set_client_handlers(browser)
set_javascript_bindings(browser)
cef.MessageLoop()
cef.Shutdown()