Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
objreg.register('readline-bridge', readline_bridge, command_only=True)
try:
log.init.debug("Initializing SQL...")
sql.init(os.path.join(standarddir.data(), 'history.sqlite'))
log.init.debug("Initializing web history...")
history.init(q_app)
except sql.KnownError as e:
error.handle_fatal_exc(e, args, 'Error initializing SQL',
pre_text='Error initializing SQL')
sys.exit(usertypes.Exit.err_init)
log.init.debug("Initializing command history...")
cmdhistory.init()
log.init.debug("Initializing sessions...")
sessions.init(q_app)
quitter.shutting_down.connect(sessions.shutdown)
log.init.debug("Initializing websettings...")
websettings.init(args)
quitter.shutting_down.connect(websettings.shutdown)
if not args.no_err_windows:
crash_handler.display_faulthandler()
log.init.debug("Initializing quickmarks...")
quickmark_manager = urlmarks.QuickmarkManager(q_app)
objreg.register('quickmark-manager', quickmark_manager)
log.init.debug("Initializing bookmarks...")
bookmark_manager = urlmarks.BookmarkManager(q_app)
def init(args):
"""Initialize all standard dirs."""
if args is not None:
# args can be None during tests
log.init.debug("Base directory: {}".format(args.basedir))
_init_dirs(args)
_init_cachedir_tag()
if args is not None and getattr(args, 'basedir', None) is None:
if utils.is_mac: # pragma: no cover
_move_macos()
elif utils.is_windows: # pragma: no cover
_move_windows()
objreg.register('bookmark-manager', bookmark_manager)
log.init.debug("Initializing cookies...")
cookies.init(q_app)
log.init.debug("Initializing cache...")
cache.init(q_app)
log.init.debug("Initializing downloads...")
download_manager = qtnetworkdownloads.DownloadManager(parent=q_app)
objreg.register('qtnetwork-download-manager', download_manager)
log.init.debug("Initializing Greasemonkey...")
greasemonkey.init()
log.init.debug("Misc initialization...")
macros.init()
# Init backend-specific stuff
browsertab.init()
def _init_modules(*, args, crash_handler, quitter):
"""Initialize all 'modules' which need to be initialized.
Args:
args: The argparse namespace.
crash_handler: The CrashHandler instance.
quitter: The Quitter instance.
"""
log.init.debug("Initializing save manager...")
save_manager = savemanager.SaveManager(q_app)
objreg.register('save-manager', save_manager)
quitter.shutting_down.connect(save_manager.shutdown)
configinit.late_init(save_manager)
log.init.debug("Checking backend requirements...")
backendproblem.init(quitter=quitter, args=args, save_manager=save_manager)
log.init.debug("Initializing prompts...")
prompt.init()
log.init.debug("Initializing network...")
networkmanager.init()
log.init.debug("Initializing proxy...")
proxy.init()
log.init.debug("Initializing bookmarks...")
bookmark_manager = urlmarks.BookmarkManager(q_app)
objreg.register('bookmark-manager', bookmark_manager)
log.init.debug("Initializing cookies...")
cookies.init(q_app)
log.init.debug("Initializing cache...")
cache.init(q_app)
log.init.debug("Initializing downloads...")
download_manager = qtnetworkdownloads.DownloadManager(parent=q_app)
objreg.register('qtnetwork-download-manager', download_manager)
log.init.debug("Initializing Greasemonkey...")
greasemonkey.init()
log.init.debug("Misc initialization...")
macros.init()
# Init backend-specific stuff
browsertab.init()
log.init.debug("Initializing websettings...")
websettings.init(args)
quitter.shutting_down.connect(websettings.shutdown)
if not args.no_err_windows:
crash_handler.display_faulthandler()
log.init.debug("Initializing quickmarks...")
quickmark_manager = urlmarks.QuickmarkManager(q_app)
objreg.register('quickmark-manager', quickmark_manager)
log.init.debug("Initializing bookmarks...")
bookmark_manager = urlmarks.BookmarkManager(q_app)
objreg.register('bookmark-manager', bookmark_manager)
log.init.debug("Initializing cookies...")
cookies.init(q_app)
log.init.debug("Initializing cache...")
cache.init(q_app)
log.init.debug("Initializing downloads...")
download_manager = qtnetworkdownloads.DownloadManager(parent=q_app)
objreg.register('qtnetwork-download-manager', download_manager)
log.init.debug("Initializing Greasemonkey...")
greasemonkey.init()
log.init.debug("Misc initialization...")
macros.init()
# Init backend-specific stuff
browsertab.init()
try:
if ctx.isOpenGLES():
# Can't use versionFunctions there
return None
vp = QOpenGLVersionProfile()
vp.setVersion(2, 0)
try:
vf = ctx.versionFunctions(vp)
except ImportError as e:
log.init.debug("Importing version functions failed: {}".format(e))
return None
if vf is None:
log.init.debug("Getting version functions failed!")
return None
return vf.glGetString(vf.GL_VENDOR)
finally:
ctx.doneCurrent()
if old_context and old_surface:
old_context.makeCurrent(old_surface)
Args:
url: A URL to open.
target: same as new_instance_open_target (used as a default).
no_raise: suppress target window raising.
via_ipc: Whether the arguments were transmitted over IPC.
Return:
ID of a window that was used to open URL
"""
target = target or config.val.new_instance_open_target
background = target in {'tab-bg', 'tab-bg-silent'}
win_id = mainwindow.get_window(via_ipc, force_target=target,
no_raise=no_raise)
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=win_id)
log.init.debug("About to open URL: {}".format(url.toDisplayString()))
tabbed_browser.tabopen(url, background=background, related=False)
return win_id
def init_log(args):
"""Initialize logging.
Args:
args: The argparse namespace.
"""
from qutebrowser.utils import log
log.init_log(args)
log.init.debug("Log initialized.")
def _init_geometry(self, geometry):
"""Initialize the window geometry or load it from disk."""
if geometry is not None:
self._load_geometry(geometry)
elif self.win_id == 0:
self._load_state_geometry()
else:
self._set_default_geometry()
log.init.debug("Initial main window geometry: {}".format(
self.geometry()))