Add arguments for :report
This commit is contained in:
parent
5852b5dbc9
commit
ea2271c294
|
|
@ -25,6 +25,8 @@ Changed
|
|||
a new `-c` flag to customize the Tor control port.
|
||||
- `:config-write-py` now adds a note about `config.py` files being targeted at
|
||||
advanced users.
|
||||
- `:report` now takes two optional arguments for bug/contact information, so
|
||||
that it can be used without the report window popping up.
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
|
|
|||
|
|
@ -1015,8 +1015,15 @@ Which count to pass the command.
|
|||
|
||||
[[report]]
|
||||
=== report
|
||||
Syntax: +:report ['info'] ['contact']+
|
||||
|
||||
Report a bug in qutebrowser.
|
||||
|
||||
==== positional arguments
|
||||
* +'info'+: Information about the bug report. If given, no report dialog shows up.
|
||||
|
||||
* +'contact'+: Contact information for the report.
|
||||
|
||||
[[restart]]
|
||||
=== restart
|
||||
Restart qutebrowser while keeping existing tabs open.
|
||||
|
|
|
|||
|
|
@ -125,9 +125,13 @@ class _CrashDialog(QDialog):
|
|||
self.setWindowTitle("Whoops!")
|
||||
self.resize(QSize(640, 600))
|
||||
self._vbox = QVBoxLayout(self)
|
||||
|
||||
http_client = httpclient.HTTPClient()
|
||||
self._paste_client = pastebin.PastebinClient(http_client, self)
|
||||
self._pypi_client = autoupdate.PyPIVersionClient(self)
|
||||
self._paste_client.success.connect(self.on_paste_success)
|
||||
self._paste_client.error.connect(self.show_error)
|
||||
|
||||
self._init_text()
|
||||
|
||||
self._init_contact_input()
|
||||
|
|
@ -296,13 +300,17 @@ class _CrashDialog(QDialog):
|
|||
except Exception:
|
||||
log.misc.exception("Failed to save contact information!")
|
||||
|
||||
def report(self):
|
||||
"""Paste the crash info into the pastebin."""
|
||||
def report(self, *, info=None, contact=None):
|
||||
"""Paste the crash info into the pastebin.
|
||||
|
||||
If info/contact are given as arguments, they override the values
|
||||
entered in the dialog.
|
||||
"""
|
||||
lines = []
|
||||
lines.append("========== Report ==========")
|
||||
lines.append(self._info.toPlainText())
|
||||
lines.append(info or self._info.toPlainText())
|
||||
lines.append("========== Contact ==========")
|
||||
lines.append(self._contact.toPlainText())
|
||||
lines.append(contact or self._contact.toPlainText())
|
||||
lines.append("========== Debug log ==========")
|
||||
lines.append(self._debug_log.toPlainText())
|
||||
self._paste_text = '\n\n'.join(lines)
|
||||
|
|
@ -326,8 +334,6 @@ class _CrashDialog(QDialog):
|
|||
self._btn_report.setEnabled(False)
|
||||
self._btn_cancel.setEnabled(False)
|
||||
self._btn_report.setText("Reporting...")
|
||||
self._paste_client.success.connect(self.on_paste_success)
|
||||
self._paste_client.error.connect(self.show_error)
|
||||
self.report()
|
||||
|
||||
@pyqtSlot()
|
||||
|
|
|
|||
|
|
@ -162,14 +162,25 @@ class CrashHandler(QObject):
|
|||
earlyinit.init_faulthandler(self._crash_log_file)
|
||||
|
||||
@cmdutils.register(instance='crash-handler')
|
||||
def report(self):
|
||||
"""Report a bug in qutebrowser."""
|
||||
def report(self, info=None, contact=None):
|
||||
"""Report a bug in qutebrowser.
|
||||
|
||||
Args:
|
||||
info: Information about the bug report. If given, no report dialog
|
||||
shows up.
|
||||
contact: Contact information for the report.
|
||||
"""
|
||||
pages = self._recover_pages()
|
||||
cmd_history = objreg.get('command-history')[-5:]
|
||||
all_objects = debug.get_all_objects()
|
||||
|
||||
self._crash_dialog = crashdialog.ReportDialog(pages, cmd_history,
|
||||
all_objects)
|
||||
self._crash_dialog.show()
|
||||
|
||||
if info is None:
|
||||
self._crash_dialog.show()
|
||||
else:
|
||||
self._crash_dialog.report(info=info, contact=contact)
|
||||
|
||||
@pyqtSlot()
|
||||
def shutdown(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue