Some style fixes in PR #3480's review
This commit is contained in:
parent
1d568a5cf4
commit
f45d572677
@ -479,7 +479,7 @@ def qute_configdiff(url):
|
|||||||
|
|
||||||
|
|
||||||
@add_handler('pastebin-version')
|
@add_handler('pastebin-version')
|
||||||
def qute_pastebin_version(url): # transfusion: pylint: disable=unused-argument
|
def qute_pastebin_version(_url):
|
||||||
"""Handler that pastebins the version string."""
|
"""Handler that pastebins the version string."""
|
||||||
utils.pastebin_version()
|
utils.pastebin_version()
|
||||||
return 'text/plain', b'Paste called.'
|
return 'text/plain', b'Paste called.'
|
||||||
|
@ -42,7 +42,7 @@ class PastebinClient(QObject):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
API_URL = 'https://crashes.qutebrowser.org/api/'
|
API_URL = 'https://crashes.qutebrowser.org/api/'
|
||||||
MISC_API_URL = 'http://paste.the-compiler.org/api/'
|
MISC_API_URL = 'https://paste.the-compiler.org/api/'
|
||||||
success = pyqtSignal(str)
|
success = pyqtSignal(str)
|
||||||
error = pyqtSignal(str)
|
error = pyqtSignal(str)
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ class PastebinClient(QObject):
|
|||||||
client.error.connect(self.error)
|
client.error.connect(self.error)
|
||||||
client.success.connect(self.on_client_success)
|
client.success.connect(self.on_client_success)
|
||||||
self._client = client
|
self._client = client
|
||||||
self.api_url = api_url
|
self._api_url = api_url
|
||||||
|
|
||||||
def paste(self, name, title, text, parent=None):
|
def paste(self, name, title, text, parent=None):
|
||||||
"""Paste the text into a pastebin and return the URL.
|
"""Paste the text into a pastebin and return the URL.
|
||||||
@ -77,7 +77,7 @@ class PastebinClient(QObject):
|
|||||||
}
|
}
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
data['reply'] = parent
|
data['reply'] = parent
|
||||||
url = QUrl(urllib.parse.urljoin(self.api_url, 'create'))
|
url = QUrl(urllib.parse.urljoin(self._api_url, 'create'))
|
||||||
self._client.post(url, data)
|
self._client.post(url, data)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
|
@ -370,7 +370,11 @@ def nop():
|
|||||||
@cmdutils.register()
|
@cmdutils.register()
|
||||||
@cmdutils.argument('win_id', win_id=True)
|
@cmdutils.argument('win_id', win_id=True)
|
||||||
def version(win_id, paste=False):
|
def version(win_id, paste=False):
|
||||||
"""Show version information."""
|
"""Show version information.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
paste: Paste to pastebin.
|
||||||
|
"""
|
||||||
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
tabbed_browser = objreg.get('tabbed-browser', scope='window',
|
||||||
window=win_id)
|
window=win_id)
|
||||||
tabbed_browser.openurl(QUrl('qute://version'), newtab=True)
|
tabbed_browser.openurl(QUrl('qute://version'), newtab=True)
|
||||||
|
@ -920,8 +920,7 @@ def yaml_dump(data, f=None):
|
|||||||
|
|
||||||
|
|
||||||
def pastebin_version():
|
def pastebin_version():
|
||||||
"""Pastebins version and logs to messages"""
|
"""Pastebin the version and log the url to messages."""
|
||||||
|
|
||||||
app = qutebrowser.utils.objreg.get('app')
|
app = qutebrowser.utils.objreg.get('app')
|
||||||
http_client = httpclient.HTTPClient()
|
http_client = httpclient.HTTPClient()
|
||||||
|
|
||||||
@ -938,9 +937,10 @@ def pastebin_version():
|
|||||||
qutebrowser.utils.message.info("Failed to pastebin version"
|
qutebrowser.utils.message.info("Failed to pastebin version"
|
||||||
" info: {}".format(text))
|
" info: {}".format(text))
|
||||||
|
|
||||||
|
misc_api = pastebin.PastebinClient.MISC_API_URL
|
||||||
pbclient = pastebin.PastebinClient(http_client, parent=app,
|
pbclient = pastebin.PastebinClient(http_client, parent=app,
|
||||||
api_url=
|
api_url=misc_api)
|
||||||
pastebin.PastebinClient.MISC_API_URL)
|
|
||||||
pbclient.success.connect(_on_paste_version_success)
|
pbclient.success.connect(_on_paste_version_success)
|
||||||
pbclient.error.connect(_on_paste_version_err)
|
pbclient.error.connect(_on_paste_version_err)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user