Merge branch 'restart'
This commit is contained in:
commit
3ce9945bc9
6
doc/BUGS
6
doc/BUGS
@ -34,12 +34,6 @@ Bugs
|
|||||||
|
|
||||||
- restart sometimes abort()s on QApplication __init__ (V155)
|
- restart sometimes abort()s on QApplication __init__ (V155)
|
||||||
|
|
||||||
- restart is broken entirely since init refactoring (around af19e6d~1) - this
|
|
||||||
also breaks "restore tabs" in crash dialog.
|
|
||||||
|
|
||||||
- qutebrowser :restart loops endlessly
|
|
||||||
We should refuse to do :restart when executing init commands
|
|
||||||
|
|
||||||
- Super key shows up as ៀ\udc53 in logs
|
- Super key shows up as ៀ\udc53 in logs
|
||||||
|
|
||||||
- Funky font rendering with tewi:
|
- Funky font rendering with tewi:
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
import faulthandler
|
import faulthandler
|
||||||
import configparser
|
import configparser
|
||||||
from bdb import BdbQuit
|
from bdb import BdbQuit
|
||||||
@ -84,7 +85,6 @@ class Application(QApplication):
|
|||||||
_timers: List of used QTimers so they don't get GCed.
|
_timers: List of used QTimers so they don't get GCed.
|
||||||
_shutting_down: True if we're currently shutting down.
|
_shutting_down: True if we're currently shutting down.
|
||||||
_quit_status: The current quitting status.
|
_quit_status: The current quitting status.
|
||||||
_opened_urls: List of opened URLs, string as passed to the application.
|
|
||||||
_crashdlg: The crash dialog currently open.
|
_crashdlg: The crash dialog currently open.
|
||||||
_crashlogfile: A file handler to the fatal crash logfile.
|
_crashlogfile: A file handler to the fatal crash logfile.
|
||||||
"""
|
"""
|
||||||
@ -109,7 +109,6 @@ class Application(QApplication):
|
|||||||
'main': False,
|
'main': False,
|
||||||
}
|
}
|
||||||
self._timers = []
|
self._timers = []
|
||||||
self._opened_urls = []
|
|
||||||
self._shutting_down = False
|
self._shutting_down = False
|
||||||
self._keyparsers = None
|
self._keyparsers = None
|
||||||
self._crashdlg = None
|
self._crashdlg = None
|
||||||
@ -312,7 +311,6 @@ class Application(QApplication):
|
|||||||
self.commandmanager.run_safely_init(cmd.lstrip(':'))
|
self.commandmanager.run_safely_init(cmd.lstrip(':'))
|
||||||
else:
|
else:
|
||||||
log.init.debug("Startup URL {}".format(cmd))
|
log.init.debug("Startup URL {}".format(cmd))
|
||||||
self._opened_urls.append(cmd)
|
|
||||||
try:
|
try:
|
||||||
url = urlutils.fuzzy_url(cmd)
|
url = urlutils.fuzzy_url(cmd)
|
||||||
except urlutils.FuzzyUrlError as e:
|
except urlutils.FuzzyUrlError as e:
|
||||||
@ -582,32 +580,40 @@ class Application(QApplication):
|
|||||||
log.destroy.debug("maybe_quit quitting.")
|
log.destroy.debug("maybe_quit quitting.")
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
#@cmdutils.register(instance='', nargs=0)
|
@cmdutils.register(instance='', nargs=0)
|
||||||
#def restart(self, shutdown=True, pages=None):
|
def restart(self, shutdown=True, pages=None):
|
||||||
# """Restart qutebrowser while keeping existing tabs open."""
|
"""Restart qutebrowser while keeping existing tabs open."""
|
||||||
# # We don't use _recover_pages here as it's too forgiving when
|
# We don't use _recover_pages here as it's too forgiving when
|
||||||
# # exceptions occur.
|
# exceptions occur.
|
||||||
# if pages is None:
|
if pages is None:
|
||||||
# pages = []
|
pages = []
|
||||||
# for tab in self.mainwindow.tabs.widgets:
|
for tab in self.mainwindow.tabs.widgets:
|
||||||
# urlstr = tab.url().toString()
|
urlstr = tab.url().toString()
|
||||||
# if urlstr:
|
if urlstr:
|
||||||
# pages.append(urlstr)
|
pages.append(urlstr)
|
||||||
# pythonpath = os.pathsep.join(sys.path)
|
log.destroy.debug("sys.executable: {}".format(sys.executable))
|
||||||
# os.environ['PYTHONPATH'] = pythonpath
|
log.destroy.debug("sys.path: {}".format(sys.path))
|
||||||
# argv = sys.argv[:]
|
log.destroy.debug("sys.argv: {}".format(sys.argv))
|
||||||
# for page in self._opened_urls:
|
log.destroy.debug("frozen: {}".format(hasattr(sys, 'frozen')))
|
||||||
# try:
|
if hasattr(sys, 'frozen'):
|
||||||
# argv.remove(page)
|
args = [sys.executable]
|
||||||
# except ValueError as e:
|
cwd = os.path.abspath(os.path.dirname(sys.executable))
|
||||||
# logger.destroy.debug("Error while removing page: {}: "
|
else:
|
||||||
# "{}".format(e.__class__.__name__, e))
|
args = [sys.executable, '-m', 'qutebrowser']
|
||||||
# argv = [sys.executable] + argv + pages
|
cwd = os.path.join(os.path.abspath(os.path.dirname(
|
||||||
# log.procs.debug("Running {} with args {} (PYTHONPATH={})".format(
|
qutebrowser.__file__)), '..')
|
||||||
# sys.executable, argv, pythonpath))
|
for arg in sys.argv[1:]:
|
||||||
# subprocess.Popen(argv)
|
if arg.startswith('-'):
|
||||||
# if shutdown:
|
# We only want to preserve options on a restart.
|
||||||
# self.shutdown()
|
args.append(arg)
|
||||||
|
# Add all open pages so they get reopened.
|
||||||
|
args += pages
|
||||||
|
log.destroy.debug("args: {}".format(args))
|
||||||
|
log.destroy.debug("cwd: {}".format(cwd))
|
||||||
|
# Open a new process and immediately shutdown the existing one
|
||||||
|
subprocess.Popen(args, cwd=cwd)
|
||||||
|
if shutdown:
|
||||||
|
self.shutdown()
|
||||||
|
|
||||||
@cmdutils.register(instance='', split=False, debug=True)
|
@cmdutils.register(instance='', split=False, debug=True)
|
||||||
def debug_pyeval(self, s):
|
def debug_pyeval(self, s):
|
||||||
|
Loading…
Reference in New Issue
Block a user