Fix parent/child relationships
This commit is contained in:
parent
17cd86d564
commit
af9e4ae072
@ -130,13 +130,13 @@ class Application(QApplication):
|
|||||||
websettings.init()
|
websettings.init()
|
||||||
quickmarks.init()
|
quickmarks.init()
|
||||||
proxy.init()
|
proxy.init()
|
||||||
self.cookiejar = CookieJar()
|
self.cookiejar = CookieJar(self)
|
||||||
self.networkmanager = NetworkManager(self.cookiejar)
|
self.networkmanager = NetworkManager(self.cookiejar)
|
||||||
self.commandmanager = CommandManager()
|
self.commandmanager = CommandManager()
|
||||||
self.searchmanager = SearchManager()
|
self.searchmanager = SearchManager(self)
|
||||||
self.downloadmanager = DownloadManager()
|
self.downloadmanager = DownloadManager(self)
|
||||||
self.downloadmodel = DownloadModel(self.downloadmanager)
|
self.downloadmodel = DownloadModel(self.downloadmanager)
|
||||||
self.mainwindow = MainWindow()
|
self.mainwindow = MainWindow(self)
|
||||||
|
|
||||||
self.modeman.mainwindow = self.mainwindow
|
self.modeman.mainwindow = self.mainwindow
|
||||||
self.installEventFilter(self.modeman)
|
self.installEventFilter(self.modeman)
|
||||||
@ -162,7 +162,7 @@ class Application(QApplication):
|
|||||||
else:
|
else:
|
||||||
confdir = self.args.confdir
|
confdir = self.args.confdir
|
||||||
try:
|
try:
|
||||||
self.config = ConfigManager(confdir, 'qutebrowser.conf')
|
self.config = ConfigManager(confdir, 'qutebrowser.conf', self)
|
||||||
except (config.ValidationError,
|
except (config.ValidationError,
|
||||||
config.NoOptionError,
|
config.NoOptionError,
|
||||||
configparser.InterpolationError,
|
configparser.InterpolationError,
|
||||||
@ -194,7 +194,7 @@ class Application(QApplication):
|
|||||||
'prompt': PassthroughKeyParser('keybind.prompt', self, warn=False),
|
'prompt': PassthroughKeyParser('keybind.prompt', self, warn=False),
|
||||||
'yesno': PromptKeyParser(self),
|
'yesno': PromptKeyParser(self),
|
||||||
}
|
}
|
||||||
self.modeman = ModeManager()
|
self.modeman = ModeManager(self)
|
||||||
self.modeman.register('normal', self._keyparsers['normal'].handle)
|
self.modeman.register('normal', self._keyparsers['normal'].handle)
|
||||||
self.modeman.register('hint', self._keyparsers['hint'].handle)
|
self.modeman.register('hint', self._keyparsers['hint'].handle)
|
||||||
self.modeman.register('insert', self._keyparsers['insert'].handle,
|
self.modeman.register('insert', self._keyparsers['insert'].handle,
|
||||||
@ -221,7 +221,7 @@ class Application(QApplication):
|
|||||||
self.setOrganizationName("qutebrowser")
|
self.setOrganizationName("qutebrowser")
|
||||||
self.setApplicationName("qutebrowser")
|
self.setApplicationName("qutebrowser")
|
||||||
self.setApplicationVersion(qutebrowser.__version__)
|
self.setApplicationVersion(qutebrowser.__version__)
|
||||||
self.messagebridge = MessageBridge()
|
self.messagebridge = MessageBridge(self)
|
||||||
self.rl_bridge = ReadlineBridge()
|
self.rl_bridge = ReadlineBridge()
|
||||||
|
|
||||||
def _handle_segfault(self):
|
def _handle_segfault(self):
|
||||||
@ -307,7 +307,7 @@ class Application(QApplication):
|
|||||||
Python interpreter once all 500ms.
|
Python interpreter once all 500ms.
|
||||||
"""
|
"""
|
||||||
signal(SIGINT, lambda *args: self.exit(128 + SIGINT))
|
signal(SIGINT, lambda *args: self.exit(128 + SIGINT))
|
||||||
timer = QTimer()
|
timer = QTimer(self)
|
||||||
timer.start(500)
|
timer.start(500)
|
||||||
timer.timeout.connect(lambda: None)
|
timer.timeout.connect(lambda: None)
|
||||||
self._timers.append(timer)
|
self._timers.append(timer)
|
||||||
|
@ -601,7 +601,7 @@ class CommandDispatcher:
|
|||||||
def run_userscript(self, cmd, *args):
|
def run_userscript(self, cmd, *args):
|
||||||
"""Run an userscript given as argument."""
|
"""Run an userscript given as argument."""
|
||||||
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
||||||
runner = UserscriptRunner()
|
runner = UserscriptRunner(self._tabs)
|
||||||
runner.got_cmd.connect(self._tabs.got_cmd)
|
runner.got_cmd.connect(self._tabs.got_cmd)
|
||||||
runner.run(cmd, *args, env={'QUTE_URL': url})
|
runner.run(cmd, *args, env={'QUTE_URL': url})
|
||||||
self._userscript_runners.append(runner)
|
self._userscript_runners.append(runner)
|
||||||
@ -664,7 +664,7 @@ class CommandDispatcher:
|
|||||||
if elem.isNull():
|
if elem.isNull():
|
||||||
raise CommandError("No editable element focused!")
|
raise CommandError("No editable element focused!")
|
||||||
text = elem.evaluateJavaScript('this.value')
|
text = elem.evaluateJavaScript('this.value')
|
||||||
self._editor = ExternalEditor()
|
self._editor = ExternalEditor(self._tabs)
|
||||||
self._editor.editing_finished.connect(
|
self._editor.editing_finished.connect(
|
||||||
partial(self.on_editing_finished, elem))
|
partial(self.on_editing_finished, elem))
|
||||||
self._editor.edit(text)
|
self._editor.edit(text)
|
||||||
|
@ -29,8 +29,8 @@ class CookieJar(QNetworkCookieJar):
|
|||||||
|
|
||||||
"""Our own cookie jar to save cookies to disk if desired."""
|
"""Our own cookie jar to save cookies to disk if desired."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
datadir = get_standard_dir(QStandardPaths.DataLocation)
|
datadir = get_standard_dir(QStandardPaths.DataLocation)
|
||||||
self._linecp = LineConfigParser(datadir, 'cookies')
|
self._linecp = LineConfigParser(datadir, 'cookies')
|
||||||
cookies = []
|
cookies = []
|
||||||
|
@ -99,7 +99,7 @@ class DownloadItem(QObject):
|
|||||||
reply.finished.connect(self.on_reply_finished)
|
reply.finished.connect(self.on_reply_finished)
|
||||||
reply.error.connect(self.on_reply_error)
|
reply.error.connect(self.on_reply_error)
|
||||||
reply.readyRead.connect(self.on_ready_read)
|
reply.readyRead.connect(self.on_ready_read)
|
||||||
self.timer = QTimer()
|
self.timer = QTimer(self)
|
||||||
self.timer.timeout.connect(self.update_speed)
|
self.timer.timeout.connect(self.update_speed)
|
||||||
self.timer.setInterval(self.SPEED_REFRESH_INTERVAL)
|
self.timer.setInterval(self.SPEED_REFRESH_INTERVAL)
|
||||||
self.timer.start()
|
self.timer.start()
|
||||||
@ -347,7 +347,7 @@ class DownloadManager(QObject):
|
|||||||
suggested_filepath = os.path.join(download_location,
|
suggested_filepath = os.path.join(download_location,
|
||||||
suggested_filename)
|
suggested_filename)
|
||||||
logger.debug("fetch: {} -> {}".format(reply.url(), suggested_filepath))
|
logger.debug("fetch: {} -> {}".format(reply.url(), suggested_filepath))
|
||||||
download = DownloadItem(reply)
|
download = DownloadItem(reply, self)
|
||||||
download.finished.connect(partial(self.on_finished, download))
|
download.finished.connect(partial(self.on_finished, download))
|
||||||
download.data_changed.connect(partial(self.on_data_changed, download))
|
download.data_changed.connect(partial(self.on_data_changed, download))
|
||||||
download.error.connect(self.on_error)
|
download.error.connect(self.on_error)
|
||||||
@ -356,7 +356,7 @@ class DownloadManager(QObject):
|
|||||||
self.downloads.append(download)
|
self.downloads.append(download)
|
||||||
self.download_added.emit()
|
self.download_added.emit()
|
||||||
|
|
||||||
q = Question()
|
q = Question(self)
|
||||||
q.text = "Save file to:"
|
q.text = "Save file to:"
|
||||||
q.mode = PromptMode.text
|
q.mode = PromptMode.text
|
||||||
q.default = suggested_filepath
|
q.default = suggested_filepath
|
||||||
|
@ -53,7 +53,6 @@ class Command:
|
|||||||
handler, completion, modes, not_modes, needs_js, debug):
|
handler, completion, modes, not_modes, needs_js, debug):
|
||||||
# I really don't know how to solve this in a better way, I tried.
|
# I really don't know how to solve this in a better way, I tried.
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
super().__init__()
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.split = split
|
self.split = split
|
||||||
self.hide = hide
|
self.hide = hide
|
||||||
|
@ -54,8 +54,8 @@ class _BlockingFIFOReader(QObject):
|
|||||||
got_line = pyqtSignal(str)
|
got_line = pyqtSignal(str)
|
||||||
finished = pyqtSignal()
|
finished = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, filepath):
|
def __init__(self, filepath, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self.filepath = filepath
|
self.filepath = filepath
|
||||||
self.fifo = None
|
self.fifo = None
|
||||||
|
|
||||||
@ -110,8 +110,8 @@ class _BaseUserscriptRunner(QObject):
|
|||||||
QProcess.UnknownError: "An unknown error occurred.",
|
QProcess.UnknownError: "An unknown error occurred.",
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self.filepath = None
|
self.filepath = None
|
||||||
self.proc = None
|
self.proc = None
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class _BaseUserscriptRunner(QObject):
|
|||||||
*args: The arguments to hand to the command
|
*args: The arguments to hand to the command
|
||||||
env: A dictionary of environment variables to add.
|
env: A dictionary of environment variables to add.
|
||||||
"""
|
"""
|
||||||
self.proc = QProcess()
|
self.proc = QProcess(self)
|
||||||
procenv = QProcessEnvironment.systemEnvironment()
|
procenv = QProcessEnvironment.systemEnvironment()
|
||||||
procenv.insert('QUTE_FIFO', self.filepath)
|
procenv.insert('QUTE_FIFO', self.filepath)
|
||||||
if env is not None:
|
if env is not None:
|
||||||
@ -184,8 +184,8 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner):
|
|||||||
thread: The QThread where reader runs.
|
thread: The QThread where reader runs.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self.reader = None
|
self.reader = None
|
||||||
self.thread = None
|
self.thread = None
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner):
|
|||||||
os.mkfifo(self.filepath) # pylint: disable=no-member
|
os.mkfifo(self.filepath) # pylint: disable=no-member
|
||||||
|
|
||||||
self.reader = _BlockingFIFOReader(self.filepath)
|
self.reader = _BlockingFIFOReader(self.filepath)
|
||||||
self.thread = QThread()
|
self.thread = QThread(self)
|
||||||
self.reader.moveToThread(self.thread)
|
self.reader.moveToThread(self.thread)
|
||||||
self.reader.got_line.connect(self.got_cmd)
|
self.reader.got_line.connect(self.got_cmd)
|
||||||
self.thread.started.connect(self.reader.read)
|
self.thread.started.connect(self.reader.read)
|
||||||
@ -247,8 +247,8 @@ class _WindowsUserscriptRunner(_BaseUserscriptRunner):
|
|||||||
(overwrite) to write to the file!
|
(overwrite) to write to the file!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self.oshandle = None
|
self.oshandle = None
|
||||||
|
|
||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
|
@ -163,6 +163,7 @@ class String(BaseType):
|
|||||||
typestr = 'string'
|
typestr = 'string'
|
||||||
|
|
||||||
def __init__(self, minlen=None, maxlen=None, forbidden=None, none=False):
|
def __init__(self, minlen=None, maxlen=None, forbidden=None, none=False):
|
||||||
|
super().__init__()
|
||||||
self.minlen = minlen
|
self.minlen = minlen
|
||||||
self.maxlen = maxlen
|
self.maxlen = maxlen
|
||||||
self.forbidden = forbidden
|
self.forbidden = forbidden
|
||||||
@ -237,6 +238,7 @@ class Int(BaseType):
|
|||||||
typestr = 'int'
|
typestr = 'int'
|
||||||
|
|
||||||
def __init__(self, minval=None, maxval=None, none=False):
|
def __init__(self, minval=None, maxval=None, none=False):
|
||||||
|
super().__init__()
|
||||||
self.minval = minval
|
self.minval = minval
|
||||||
self.maxval = maxval
|
self.maxval = maxval
|
||||||
self.none = none
|
self.none = none
|
||||||
@ -290,6 +292,7 @@ class Float(BaseType):
|
|||||||
typestr = 'float'
|
typestr = 'float'
|
||||||
|
|
||||||
def __init__(self, minval=None, maxval=None):
|
def __init__(self, minval=None, maxval=None):
|
||||||
|
super().__init__()
|
||||||
self.minval = minval
|
self.minval = minval
|
||||||
self.maxval = maxval
|
self.maxval = maxval
|
||||||
|
|
||||||
@ -321,6 +324,7 @@ class Perc(BaseType):
|
|||||||
typestr = 'percentage'
|
typestr = 'percentage'
|
||||||
|
|
||||||
def __init__(self, minval=None, maxval=None):
|
def __init__(self, minval=None, maxval=None):
|
||||||
|
super().__init__()
|
||||||
self.minval = minval
|
self.minval = minval
|
||||||
self.maxval = maxval
|
self.maxval = maxval
|
||||||
|
|
||||||
@ -354,6 +358,7 @@ class PercList(List):
|
|||||||
typestr = 'perc-list'
|
typestr = 'perc-list'
|
||||||
|
|
||||||
def __init__(self, minval=None, maxval=None):
|
def __init__(self, minval=None, maxval=None):
|
||||||
|
super().__init__()
|
||||||
self.minval = minval
|
self.minval = minval
|
||||||
self.maxval = maxval
|
self.maxval = maxval
|
||||||
|
|
||||||
@ -385,6 +390,7 @@ class PercOrInt(BaseType):
|
|||||||
typestr = 'percentage-or-int'
|
typestr = 'percentage-or-int'
|
||||||
|
|
||||||
def __init__(self, minperc=None, maxperc=None, minint=None, maxint=None):
|
def __init__(self, minperc=None, maxperc=None, minint=None, maxint=None):
|
||||||
|
super().__init__()
|
||||||
self.minperc = minperc
|
self.minperc = minperc
|
||||||
self.maxperc = maxperc
|
self.maxperc = maxperc
|
||||||
self.minint = minint
|
self.minint = minint
|
||||||
@ -523,6 +529,7 @@ class Regex(BaseType):
|
|||||||
typestr = 'regex'
|
typestr = 'regex'
|
||||||
|
|
||||||
def __init__(self, flags=0):
|
def __init__(self, flags=0):
|
||||||
|
super().__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
@ -542,6 +549,7 @@ class RegexList(List):
|
|||||||
typestr = 'regex-list'
|
typestr = 'regex-list'
|
||||||
|
|
||||||
def __init__(self, flags=0):
|
def __init__(self, flags=0):
|
||||||
|
super().__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
|
|
||||||
def transform(self, value):
|
def transform(self, value):
|
||||||
@ -578,6 +586,7 @@ class Directory(BaseType):
|
|||||||
typestr = 'directory'
|
typestr = 'directory'
|
||||||
|
|
||||||
def __init__(self, none=False):
|
def __init__(self, none=False):
|
||||||
|
super().__init__()
|
||||||
self.none = none
|
self.none = none
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
@ -617,6 +626,7 @@ class WebKitBytes(BaseType):
|
|||||||
typestr = 'bytes'
|
typestr = 'bytes'
|
||||||
|
|
||||||
def __init__(self, maxsize=None):
|
def __init__(self, maxsize=None):
|
||||||
|
super().__init__()
|
||||||
self.maxsize = maxsize
|
self.maxsize = maxsize
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
@ -658,6 +668,7 @@ class WebKitBytesList(List):
|
|||||||
typestr = 'bytes-list'
|
typestr = 'bytes-list'
|
||||||
|
|
||||||
def __init__(self, maxsize=None, length=None):
|
def __init__(self, maxsize=None, length=None):
|
||||||
|
super().__init__()
|
||||||
self.length = length
|
self.length = length
|
||||||
self.bytestype = WebKitBytes(maxsize)
|
self.bytestype = WebKitBytes(maxsize)
|
||||||
|
|
||||||
|
@ -63,21 +63,22 @@ class Completer(QObject):
|
|||||||
|
|
||||||
def _init_command_completion(self):
|
def _init_command_completion(self):
|
||||||
"""Initialize the command completion model."""
|
"""Initialize the command completion model."""
|
||||||
self._models['command'] = CFM(CommandCompletionModel(self))
|
self._models['command'] = CFM(CommandCompletionModel(self), self)
|
||||||
|
|
||||||
def _init_setting_completions(self):
|
def _init_setting_completions(self):
|
||||||
"""Initialize setting completion models."""
|
"""Initialize setting completion models."""
|
||||||
self._models['section'] = CFM(SettingSectionCompletionModel(self))
|
self._models['section'] = CFM(SettingSectionCompletionModel(self),
|
||||||
|
self)
|
||||||
self._models['option'] = {}
|
self._models['option'] = {}
|
||||||
self._models['value'] = {}
|
self._models['value'] = {}
|
||||||
for sectname in configdata.DATA:
|
for sectname in configdata.DATA:
|
||||||
model = SettingOptionCompletionModel(sectname, self)
|
model = SettingOptionCompletionModel(sectname, self)
|
||||||
self._models['option'][sectname] = CFM(model)
|
self._models['option'][sectname] = CFM(model, self)
|
||||||
config.instance().changed.connect(model.on_config_changed)
|
config.instance().changed.connect(model.on_config_changed)
|
||||||
self._models['value'][sectname] = {}
|
self._models['value'][sectname] = {}
|
||||||
for opt in configdata.DATA[sectname].keys():
|
for opt in configdata.DATA[sectname].keys():
|
||||||
model = SettingValueCompletionModel(sectname, opt, self)
|
model = SettingValueCompletionModel(sectname, opt, self)
|
||||||
self._models['value'][sectname][opt] = CFM(model)
|
self._models['value'][sectname][opt] = CFM(model, self)
|
||||||
config.instance().changed.connect(model.on_config_changed)
|
config.instance().changed.connect(model.on_config_changed)
|
||||||
|
|
||||||
def _get_new_completion(self, parts, cursor_part):
|
def _get_new_completion(self, parts, cursor_part):
|
||||||
|
@ -77,6 +77,7 @@ def modular_question(message, mode, default=None):
|
|||||||
q.mode = mode
|
q.mode = mode
|
||||||
q.default = default
|
q.default = default
|
||||||
instance().question.emit(q, True)
|
instance().question.emit(q, True)
|
||||||
|
q.deleteLater()
|
||||||
return q.answer
|
return q.answer
|
||||||
|
|
||||||
|
|
||||||
@ -86,6 +87,7 @@ def alert(message):
|
|||||||
q.text = message
|
q.text = message
|
||||||
q.mode = PromptMode.alert
|
q.mode = PromptMode.alert
|
||||||
instance().question.emit(q, True)
|
instance().question.emit(q, True)
|
||||||
|
q.deleteLater()
|
||||||
|
|
||||||
|
|
||||||
def question(message, mode, handler, cancelled_handler=None, default=None):
|
def question(message, mode, handler, cancelled_handler=None, default=None):
|
||||||
@ -99,7 +101,7 @@ def question(message, mode, handler, cancelled_handler=None, default=None):
|
|||||||
cancelled by the user, or None.
|
cancelled by the user, or None.
|
||||||
default: The default value to display.
|
default: The default value to display.
|
||||||
"""
|
"""
|
||||||
q = Question()
|
q = Question(instance())
|
||||||
q.text = message
|
q.text = message
|
||||||
q.mode = mode
|
q.mode = mode
|
||||||
q.default = default
|
q.default = default
|
||||||
@ -118,7 +120,7 @@ def confirm_action(message, yes_action, no_action=None, default=None):
|
|||||||
no_action: Callable to be called when the user answered no.
|
no_action: Callable to be called when the user answered no.
|
||||||
default: True/False to set a default value, or None.
|
default: True/False to set a default value, or None.
|
||||||
"""
|
"""
|
||||||
q = Question()
|
q = Question(instance())
|
||||||
q.text = message
|
q.text = message
|
||||||
q.mode = PromptMode.yesno
|
q.mode = PromptMode.yesno
|
||||||
q.default = default
|
q.default = default
|
||||||
|
@ -46,9 +46,9 @@ class _CrashDialog(QDialog):
|
|||||||
_crash_info: A list of tuples with title and crash information.
|
_crash_info: A list of tuples with title and crash information.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
"""Constructor for CrashDialog."""
|
"""Constructor for CrashDialog."""
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self._crash_info = None
|
self._crash_info = None
|
||||||
self._hbox = None
|
self._hbox = None
|
||||||
self._lbl = None
|
self._lbl = None
|
||||||
@ -79,7 +79,7 @@ class _CrashDialog(QDialog):
|
|||||||
|
|
||||||
Should be extended by superclass to provide the actual buttons.
|
Should be extended by superclass to provide the actual buttons.
|
||||||
"""
|
"""
|
||||||
self._hbox = QHBoxLayout()
|
self._hbox = QHBoxLayout(self)
|
||||||
self._hbox.addStretch()
|
self._hbox.addStretch()
|
||||||
self._vbox.addLayout(self._hbox)
|
self._vbox.addLayout(self._hbox)
|
||||||
|
|
||||||
@ -156,14 +156,14 @@ class ExceptionCrashDialog(_CrashDialog):
|
|||||||
_exc: An exception tuple (type, value, traceback)
|
_exc: An exception tuple (type, value, traceback)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, pages, cmdhist, exc):
|
def __init__(self, pages, cmdhist, exc, parent=None):
|
||||||
self._pages = pages
|
self._pages = pages
|
||||||
self._cmdhist = cmdhist
|
self._cmdhist = cmdhist
|
||||||
self._exc = exc
|
self._exc = exc
|
||||||
self._btn_quit = None
|
self._btn_quit = None
|
||||||
self._btn_restore = None
|
self._btn_restore = None
|
||||||
self._btn_pastebin = None
|
self._btn_pastebin = None
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
self.setModal(True)
|
self.setModal(True)
|
||||||
|
|
||||||
def _init_text(self):
|
def _init_text(self):
|
||||||
@ -213,11 +213,11 @@ class FatalCrashDialog(_CrashDialog):
|
|||||||
_btn_pastebin: The pastebin button.
|
_btn_pastebin: The pastebin button.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, log):
|
def __init__(self, log, parent=None):
|
||||||
self._log = log
|
self._log = log
|
||||||
self._btn_ok = None
|
self._btn_ok = None
|
||||||
self._btn_pastebin = None
|
self._btn_pastebin = None
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
|
|
||||||
def _init_text(self):
|
def _init_text(self):
|
||||||
super()._init_text()
|
super()._init_text()
|
||||||
|
@ -52,7 +52,7 @@ class DownloadView(QListView):
|
|||||||
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
|
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
|
||||||
self.setFlow(QListView.LeftToRight)
|
self.setFlow(QListView.LeftToRight)
|
||||||
self._menu = None
|
self._menu = None
|
||||||
self._model = DownloadModel()
|
self._model = DownloadModel(self)
|
||||||
self._model.rowsInserted.connect(self.updateGeometry)
|
self._model.rowsInserted.connect(self.updateGeometry)
|
||||||
self._model.rowsRemoved.connect(self.updateGeometry)
|
self._model.rowsRemoved.connect(self.updateGeometry)
|
||||||
self.setModel(self._model)
|
self.setModel(self._model)
|
||||||
@ -71,7 +71,7 @@ class DownloadView(QListView):
|
|||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
return
|
return
|
||||||
item = self.model().data(index, Role.item)
|
item = self.model().data(index, Role.item)
|
||||||
self._menu = QMenu()
|
self._menu = QMenu(self)
|
||||||
cancel = self._menu.addAction("Cancel")
|
cancel = self._menu.addAction("Cancel")
|
||||||
cancel.triggered.connect(item.cancel)
|
cancel.triggered.connect(item.cancel)
|
||||||
self._menu.popup(self.viewport().mapToGlobal(point))
|
self._menu.popup(self.viewport().mapToGlobal(point))
|
||||||
|
@ -48,8 +48,8 @@ class MainWindow(QWidget):
|
|||||||
_vbox: The main QVBoxLayout.
|
_vbox: The main QVBoxLayout.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parent=None):
|
||||||
super().__init__()
|
super().__init__(parent)
|
||||||
|
|
||||||
self.setWindowTitle('qutebrowser')
|
self.setWindowTitle('qutebrowser')
|
||||||
try:
|
try:
|
||||||
|
@ -120,21 +120,21 @@ class StatusBar(QWidget):
|
|||||||
self._hbox.setContentsMargins(0, 0, 0, 0)
|
self._hbox.setContentsMargins(0, 0, 0, 0)
|
||||||
self._hbox.setSpacing(5)
|
self._hbox.setSpacing(5)
|
||||||
|
|
||||||
self._stack = QStackedLayout()
|
self._stack = QStackedLayout(self)
|
||||||
self._stack.setContentsMargins(0, 0, 0, 0)
|
self._stack.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|
||||||
self.cmd = Command(self)
|
self.cmd = Command()
|
||||||
self._stack.addWidget(self.cmd)
|
self._stack.addWidget(self.cmd)
|
||||||
|
|
||||||
self.txt = Text(self)
|
self.txt = Text()
|
||||||
self._stack.addWidget(self.txt)
|
self._stack.addWidget(self.txt)
|
||||||
self._timer_was_active = False
|
self._timer_was_active = False
|
||||||
self._text_queue = deque()
|
self._text_queue = deque()
|
||||||
self._text_pop_timer = QTimer()
|
self._text_pop_timer = QTimer(self)
|
||||||
self._text_pop_timer.setInterval(config.get('ui', 'message-timeout'))
|
self._text_pop_timer.setInterval(config.get('ui', 'message-timeout'))
|
||||||
self._text_pop_timer.timeout.connect(self._pop_text)
|
self._text_pop_timer.timeout.connect(self._pop_text)
|
||||||
|
|
||||||
self.prompt = Prompt(self)
|
self.prompt = Prompt()
|
||||||
self._stack.addWidget(self.prompt)
|
self._stack.addWidget(self.prompt)
|
||||||
|
|
||||||
self.cmd.show_cmd.connect(self._show_cmd_widget)
|
self.cmd.show_cmd.connect(self._show_cmd_widget)
|
||||||
@ -146,16 +146,16 @@ class StatusBar(QWidget):
|
|||||||
|
|
||||||
self._hbox.addLayout(self._stack)
|
self._hbox.addLayout(self._stack)
|
||||||
|
|
||||||
self.keystring = KeyString(self)
|
self.keystring = KeyString()
|
||||||
self._hbox.addWidget(self.keystring)
|
self._hbox.addWidget(self.keystring)
|
||||||
|
|
||||||
self.url = Url(self)
|
self.url = Url()
|
||||||
self._hbox.addWidget(self.url)
|
self._hbox.addWidget(self.url)
|
||||||
|
|
||||||
self.percentage = Percentage(self)
|
self.percentage = Percentage()
|
||||||
self._hbox.addWidget(self.percentage)
|
self._hbox.addWidget(self.percentage)
|
||||||
|
|
||||||
self.prog = Progress(self)
|
self.prog = Progress()
|
||||||
self._hbox.addWidget(self.prog)
|
self._hbox.addWidget(self.prog)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -197,7 +197,7 @@ class Prompt(QWidget):
|
|||||||
Return:
|
Return:
|
||||||
The answer to the question. No, it's not always 42.
|
The answer to the question. No, it's not always 42.
|
||||||
"""
|
"""
|
||||||
loop = EventLoop()
|
loop = EventLoop(self)
|
||||||
self.loops.append(loop)
|
self.loops.append(loop)
|
||||||
loop.destroyed.connect(lambda: self.loops.remove(loop))
|
loop.destroyed.connect(lambda: self.loops.remove(loop))
|
||||||
self.question.answered.connect(loop.quit)
|
self.question.answered.connect(loop.quit)
|
||||||
|
Loading…
Reference in New Issue
Block a user