in client/securedrop_client/gui/conversation/export/print_dialog.py [0:0]
def __init__(self, device: Export, file_name: str, filepaths: list[str]) -> None:
super().__init__()
self._device = device
self.filepaths = filepaths
self.file_name = SecureQLabel(
file_name, wordwrap=False, max_length=self.FILENAME_WIDTH_PX
).text()
# Hold onto the error status we receive from the Export VM. Only required
# because we're reusing the same modal dialog with different text depending
# on conditions, and need to pass methods to Qt handlers with a predefined
# message signature.
self.status: ExportStatus | None = None
# Connect device signals to slots
self._device.print_preflight_check_succeeded.connect(
self._on_print_preflight_check_succeeded
)
self._device.print_preflight_check_failed.connect(self._on_print_preflight_check_failed)
# For now, connect both success and error signals to close the print dialog.
self._device.print_succeeded.connect(self._on_print_complete)
self._device.print_failed.connect(self._on_print_complete)
# Connect parent signals to slots
self.continue_button.setEnabled(False)
self.continue_button.clicked.connect(self._run_preflight)
# Dialog content
self.starting_header = _(
"Preparing to print:<br />" '<span style="font-weight:normal">{}</span>'
).format(self.file_name)
self.ready_header = _(
"Ready to print:<br />" '<span style="font-weight:normal">{}</span>'
).format(self.file_name)
self.insert_usb_header = _("Connect USB printer")
self.error_header = _("Printing failed")
self.starting_message = _(
"<h2>Managing printout risks</h2>"
"<b>QR codes and web addresses</b>"
"<br />"
"Never type in and open web addresses or scan QR codes contained in printed "
"documents without taking security precautions. If you are unsure how to "
"manage this risk, please contact your administrator."
"<br /><br />"
"<b>Printer dots</b>"
"<br />"
"Any part of a printed page may contain identifying information "
"invisible to the naked eye, such as printer dots. Please carefully "
"consider this risk when working with or publishing scanned printouts."
)
self.insert_usb_message = _("Please connect your printer to a USB port.")
self.generic_error_message = _("See your administrator for help.")
self.unprintable_type_error_message = _("This file type cannot be printed.")
self._show_starting_instructions()
self.start_animate_header()
self._run_preflight()