-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action to (re-)generate and print conversation transcript
Co-authored-by: Cory Francis Myers <cory@freedom.press>
- Loading branch information
1 parent
95ca10a
commit aea7579
Showing
10 changed files
with
412 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .device import Device # noqa: F401 | ||
from .dialog import ExportDialog as Dialog # noqa: F401 | ||
from .print_dialog import PrintDialog # noqa: F401 | ||
from .print_transcript_dialog import PrintTranscriptDialog # noqa: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
securedrop_client/gui/conversation/export/print_transcript_dialog.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from PyQt5.QtCore import QSize, pyqtSlot | ||
|
||
from securedrop_client.gui.conversation.export import PrintDialog | ||
|
||
from .device import Device | ||
|
||
|
||
class PrintTranscriptDialog(PrintDialog): | ||
"""Adapts the dialog used to print files to allow printing of a conversation transcript. | ||
- Adjust the init arguments to the needs of conversation transcript printing. | ||
- Adds a method to allow a transcript to be printed. | ||
- Overrides the slot that handles the printing action to call said method. | ||
""" | ||
|
||
def __init__(self, device: Device, file_name: str, transcript_location: str) -> None: | ||
super().__init__(device, "", file_name) | ||
|
||
self.transcript_location = transcript_location | ||
|
||
def _print_transcript(self) -> None: | ||
self._device.print_transcript(self.transcript_location) | ||
self.close() | ||
|
||
@pyqtSlot() | ||
def _on_print_preflight_check_succeeded(self) -> None: | ||
# If the continue button is disabled then this is the result of a background preflight check | ||
self.stop_animate_header() | ||
self.header_icon.update_image("printer.svg", svg_size=QSize(64, 64)) | ||
self.header.setText(self.ready_header) | ||
if not self.continue_button.isEnabled(): | ||
self.continue_button.clicked.disconnect() | ||
self.continue_button.clicked.connect(self._print_transcript) | ||
|
||
self.continue_button.setEnabled(True) | ||
self.continue_button.setFocus() | ||
return | ||
|
||
self._print_transcript() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.