Skip to content

Commit

Permalink
remove default cancel seletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Dec 17, 2019
1 parent 867ca3c commit bd60bfa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
30 changes: 16 additions & 14 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from PyQt5.QtGui import QIcon, QPalette, QBrush, QColor, QFont, QLinearGradient
from PyQt5.QtWidgets import QListWidget, QLabel, QWidget, QListWidgetItem, QHBoxLayout, \
QPushButton, QVBoxLayout, QLineEdit, QScrollArea, QDialog, QAction, QMenu, QMessageBox, \
QToolButton, QSizePolicy, QPlainTextEdit, QStatusBar, QGraphicsDropShadowEffect
QToolButton, QSizePolicy, QPlainTextEdit, QStatusBar, QGraphicsDropShadowEffect, \
QDialogButtonBox

from securedrop_client.db import DraftReply, Source, Message, File, Reply, User
from securedrop_client.storage import source_exists
Expand Down Expand Up @@ -1987,13 +1988,12 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
starting_message = SecureQLabel(_('Preparing to print:\n' + self.file_name))
starting_message.setWordWrap(True)
starting_cancel_button = QPushButton(_('CANCEL'))
starting_cancel_button.setAutoDefault(False)
starting_continue_button = QPushButton(_('CONTINUE'))
starting_layout.addWidget(starting_message)
starting_buttons = QWidget()
starting_buttons_layout = QHBoxLayout()
starting_buttons_layout.addWidget(starting_cancel_button)
starting_buttons_layout.addWidget(starting_continue_button)
starting_buttons.setLayout(starting_buttons_layout)
starting_buttons = QDialogButtonBox(Qt.Horizontal)
starting_buttons.addButton(starting_cancel_button, QDialogButtonBox.ActionRole)
starting_buttons.addButton(starting_continue_button, QDialogButtonBox.ActionRole)
starting_layout.addWidget(starting_buttons)
starting_cancel_button.clicked.connect(self._cancel)
starting_continue_button.clicked.connect(self._print)
Expand Down Expand Up @@ -2023,6 +2023,7 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
buttons_layout = QHBoxLayout()
buttons.setLayout(buttons_layout)
cancel_button = QPushButton(_('CANCEL'))
cancel_button.setAutoDefault(False)
retry_button = QPushButton(_('CONTINUE'))
buttons_layout.addWidget(cancel_button)
buttons_layout.addWidget(retry_button)
Expand Down Expand Up @@ -2145,19 +2146,18 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
self.setLayout(layout)

# Starting export
self.starting = QWidget()
starting_layout = QVBoxLayout()
self.starting.setLayout(starting_layout)
starting_message = SecureQLabel(_('Preparing to export:\n' + self.file_name))
starting_message.setWordWrap(True)
starting_cancel_button = QPushButton(_('CANCEL'))
starting_cancel_button.setAutoDefault(False)
starting_continue_button = QPushButton(_('CONTINUE'))
starting_buttons = QDialogButtonBox(Qt.Horizontal)
starting_buttons.addButton(starting_cancel_button, QDialogButtonBox.ActionRole)
starting_buttons.addButton(starting_continue_button, QDialogButtonBox.ActionRole)
self.starting = QWidget()
starting_layout = QVBoxLayout()
self.starting.setLayout(starting_layout)
starting_layout.addWidget(starting_message)
starting_buttons = QWidget()
starting_buttons_layout = QHBoxLayout()
starting_buttons_layout.addWidget(starting_cancel_button)
starting_buttons_layout.addWidget(starting_continue_button)
starting_buttons.setLayout(starting_buttons_layout)
starting_layout.addWidget(starting_buttons)
starting_cancel_button.clicked.connect(self._cancel)
starting_continue_button.clicked.connect(self._export)
Expand Down Expand Up @@ -2190,6 +2190,7 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
buttons_layout = QHBoxLayout()
buttons.setLayout(buttons_layout)
usb_cancel_button = QPushButton(_('CANCEL'))
usb_cancel_button.setAutoDefault(False)
retry_export_button = QPushButton(_('OK'))
buttons_layout.addWidget(usb_cancel_button)
buttons_layout.addWidget(retry_export_button)
Expand All @@ -2215,6 +2216,7 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
buttons_layout = QHBoxLayout()
buttons.setLayout(buttons_layout)
passphrase_cancel_button = QPushButton(_('CANCEL'))
passphrase_cancel_button.setAutoDefault(False)
unlock_disk_button = QPushButton(_('SUBMIT'))
buttons_layout.addWidget(passphrase_cancel_button)
buttons_layout.addWidget(unlock_disk_button)
Expand Down
12 changes: 6 additions & 6 deletions tests/gui/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,7 +1560,7 @@ def test_ExportDialog_cancel(mocker):

starting_layout = dialog.starting.layout()
starting_buttons = starting_layout.takeAt(1).widget()
starting_cancel_button = starting_buttons.layout().takeAt(0).widget()
starting_cancel_button = starting_buttons.buttons()[0]
starting_cancel_button.click()

dialog.close.assert_called_with()
Expand All @@ -1575,8 +1575,8 @@ def test_ExportDialog_continue(mocker):

starting_layout = dialog.starting.layout()
starting_buttons = starting_layout.takeAt(1).widget()
starting_cancel_button = starting_buttons.layout().takeAt(1).widget()
starting_cancel_button.click()
starting_continue_button = starting_buttons.buttons()[1]
starting_continue_button.click()

controller.run_export_preflight_checks.assert_called_with()

Expand Down Expand Up @@ -1799,7 +1799,7 @@ def test_PrintDialog_cancel(mocker):

starting_layout = dialog.starting.layout()
starting_buttons = starting_layout.takeAt(1).widget()
starting_cancel_button = starting_buttons.layout().takeAt(0).widget()
starting_cancel_button = starting_buttons.buttons()[0]
starting_cancel_button.click()

dialog.close.assert_called_with()
Expand All @@ -1814,8 +1814,8 @@ def test_PrintDialog_continue(mocker):

starting_layout = dialog.starting.layout()
starting_buttons = starting_layout.takeAt(1).widget()
starting_cancel_button = starting_buttons.layout().takeAt(1).widget()
starting_cancel_button.click()
starting_continue_button = starting_buttons.buttons()[1]
starting_continue_button.click()

controller.print_file.assert_called_with('mock_uuid')

Expand Down

0 comments on commit bd60bfa

Please sign in to comment.