Remove `callback` arg to webkit print preview
mypy 1.11 has new and improved support for checking partial functions,
and it works great! It says:
qutebrowser/components/misccommands.py: note: In function "_print_preview":
qutebrowser/components/misccommands.py:74: error: Unexpected keyword argument "callback" for "to_printer" of
"AbstractPrinting" [call-arg]
diag.paintRequested.connect(functools.partial(
^
qutebrowser/browser/browsertab.py:269: note: "to_printer" of "AbstractPrinting" defined here
We indeed removed the callback arg in 377749c76f
And running `:print --preview` on webkit crashes with:
TypeError: WebKitPrinting.to_printer() got an unexpected keyword argument 'callback'
With this change print preview works again (on webkit), which I'm a
little surprised by!
This commit is contained in:
parent
e2f718a518
commit
b91e142643
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
import os
|
||||
import signal
|
||||
import functools
|
||||
import logging
|
||||
import pathlib
|
||||
from typing import Optional, Sequence, Callable
|
||||
|
|
@ -60,10 +59,6 @@ def stop(tab: Optional[apitypes.Tab]) -> None:
|
|||
|
||||
def _print_preview(tab: apitypes.Tab) -> None:
|
||||
"""Show a print preview."""
|
||||
def print_callback(ok: bool) -> None:
|
||||
if not ok:
|
||||
message.error("Printing failed!")
|
||||
|
||||
tab.printing.check_preview_support()
|
||||
diag = QPrintPreviewDialog(tab)
|
||||
diag.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose)
|
||||
|
|
@ -71,8 +66,7 @@ def _print_preview(tab: apitypes.Tab) -> None:
|
|||
diag.windowFlags() |
|
||||
Qt.WindowType.WindowMaximizeButtonHint |
|
||||
Qt.WindowType.WindowMinimizeButtonHint)
|
||||
diag.paintRequested.connect(functools.partial(
|
||||
tab.printing.to_printer, callback=print_callback))
|
||||
diag.paintRequested.connect(tab.printing.to_printer)
|
||||
diag.exec()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue