Skip to content

Commit

Permalink
add header separator line and button message
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Jan 8, 2020
1 parent c9c7eb1 commit 5736cf7
Showing 1 changed file with 73 additions and 36 deletions.
109 changes: 73 additions & 36 deletions securedrop_client/gui/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1941,9 +1941,9 @@ class FramelessModal(QDialog):

CSS = '''
#frameless_modal {
min-width: 800;
max-width: 800;
min-height: 400;
min-width: 800px;
max-width: 800px;
min-height: 400px;
background-color: #fff;
border: 1px solid #2a319d;
}
Expand All @@ -1953,24 +1953,38 @@ class FramelessModal(QDialog):
font-weight: 600;
font-size: 12px;
color: #2a319d;
margin: 0px 0px 0px 40px;
}
#content {
margin: 0px 40px 0px 40px;
}
#header {
font-family: 'Montserrat';
font-weight: 500;
font-size: 24px;
color: #2a319d;
padding-bottom: 20px;
margin: 0px 40px 0px 40px;
}
#header_line {
min-height: 2px;
max-height: 2px;
background-color: rgba(42, 49, 157, 0.15);
border: none;
margin: 20px 40px 0px 40px;
}
#body {
font-family: 'Montserrat';
font-weight: 400;
font-size: 16px;
line-height: 27px;
color: #302aa3;
padding-bottom: 20px;
padding-left: 2px;
margin: 0px 40px 0px 40px;
}
#window_buttons QPushButton {
#window_buttons {
margin: 0px 0px 40px 0px;
}
QDialogButtonBox {
margin: 0px 40px 40px 40px;
}
#button_box QPushButton {
height: 40px;
margin: 0px 0px 0px 12px;
padding-left: 20px;
Expand All @@ -1979,19 +1993,24 @@ class FramelessModal(QDialog):
font-family: 'Montserrat';
font-weight: 500;
font-size: 15px;
line-height: 1.83px;
color: #2a319d;
}
#window_buttons QPushButton::disabled {
#button_box QPushButton::disabled {
border: 2px solid rgba(42, 49, 157, 0.4);
color: rgba(42, 49, 157, 0.4);
}
#continue_disabled_message {
font-family: 'Source Sans Pro';
font-weight: 500;
font-size: 16px;
color: #ff3366;
padding-bottom: 6px;
}
'''

def __init__(self):
parent = QApplication.activeWindow()
super().__init__(parent)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

self.setObjectName('frameless_modal')
self.setStyleSheet(self.CSS)
Expand Down Expand Up @@ -2025,37 +2044,48 @@ def __init__(self):

# Content including: header, body, help menu, and buttons
content = QWidget()
content.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
content_layout = QVBoxLayout()
content_layout.setContentsMargins(40, 20, 40, 40)
content.setLayout(content_layout)
self.header = QLabel()
self.header.setObjectName('header')
self.header.setWordWrap(True)
header_line = QWidget()
header_line.setObjectName('header_line')
self.body = QLabel()
self.body.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.body.setObjectName('body')
self.body.setWordWrap(True)
self.body_layout = QVBoxLayout()
self.body.setLayout(self.body_layout)
content_layout.addWidget(self.header)
content_layout.addWidget(header_line)
content_layout.addWidget(self.body)

# Buttons
window_buttons = QWidget()
window_buttons.setObjectName('window_buttons')
button_layout = QVBoxLayout()
window_buttons.setLayout(button_layout)
cancel_button = QPushButton(_('CANCEL'))
cancel_button.setAutoDefault(False)
cancel_button.clicked.connect(self.close)
self.continue_button = QPushButton(_('CONTINUE'))
window_buttons = QDialogButtonBox(Qt.Horizontal)
window_buttons.setObjectName('window_buttons')
window_buttons.addButton(cancel_button, QDialogButtonBox.ActionRole)
window_buttons.addButton(self.continue_button, QDialogButtonBox.ActionRole)
content_layout.addWidget(self.header)
content_layout.addWidget(self.body)
content_layout.addStretch()
content_layout.addWidget(window_buttons, alignment=Qt.AlignRight)
button_box = QDialogButtonBox(Qt.Horizontal)
button_box.setObjectName('button_box')
button_box.addButton(cancel_button, QDialogButtonBox.ActionRole)
button_box.addButton(self.continue_button, QDialogButtonBox.ActionRole)
self.continue_disabled_message = QLabel(_(
'<i>The CONTINUE button will be \ndisabled until the Export VM\n is ready</i>'))
self.continue_disabled_message.setObjectName('continue_disabled_message')
button_layout.addWidget(self.continue_disabled_message, alignment=Qt.AlignRight)
button_layout.addWidget(button_box, alignment=Qt.AlignRight)

# Layout
layout = QVBoxLayout(self)
self.setLayout(layout)
layout.addWidget(titlebar, alignment=Qt.AlignTop)
layout.addWidget(titlebar)
layout.addWidget(content)
layout.addStretch(1)
layout.addWidget(window_buttons)


class PrintDialog(FramelessModal):
Expand All @@ -2078,15 +2108,16 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
self.continue_button.setEnabled(False)

# Dialog content
self.starting_header = _('Preparing to print: {}'.format(self.file_name))
self.starting_header = _(
'<b>Preparing to print:</b>'
'<br />'
'{}'.format(self.file_name))
self.insert_usb_header = _('Insert USB printer')
self.error_header = _('Unable to print')
self.starting_message = _(
'Proceed with caution when printing files.\n\n'
'Anonymity\n'
'<h2>Proceed with caution when exporting files</h2>'
'Documents submitted by sources may contain information that identifies who they are. '
'To protect your sources, please consider redacting documents before printing them.\n\n'
'The CONTINUE button will be disabled until the Export VM is ready.')
'To protect your sources, please consider redacting documents before printing them.')
self.insert_usb_message = _('Please connect your printer to a USB port.')
self.generic_error_message = _('See your administrator for help.')
self.usb_error_message = _(
Expand Down Expand Up @@ -2181,22 +2212,27 @@ def __init__(self, controller: Controller, file_uuid: str, file_name: str):
self.continue_button.setEnabled(False)

# Dialog content
self.starting_header = _('Preparing to export: {}'.format(self.file_name))
self.starting_header = _(
'<b>Preparing to export:</b>'
'<br />'
'{}'.format(self.file_name))
self.insert_usb_header = _('Insert encrypted USB drive')
self.passphrase_header = _('Enter passphrase for USB drive')
self.error_header = _('Unable to export')
self.starting_message = _(
'Proceed with caution when exporting files.\n\n'
'Malware\n'
'<h2>Proceed with caution when exporting files</h2>'
'<b>Malware</b>'
'<br />'
'This workstation lets you open documents securely. If you open documents on another '
'computer, any embedded malware may spread to your computer or network. If you are '
'unsure how to manage this risk, please print the document, or contact your '
'administrator.\n\n'
'Anonymity\n'
'administrator.'
'<br /><br />'
'<b>Anonymity</b>'
'<br />'
'Documents submitted by sources may contain information or hidden metadata that '
'identifies who they are. To protect your sources, please consider redacting documents '
'before working with them on network-connected computers.\n\n'
'The CONTINUE button will be disabled until the Export VM is ready.')
'before working with them on network-connected computers.')
self.exporting_message = _('Exporting: {}'.format(self.file_name))
self.insert_usb_message = _(
'Please insert one of the export drives provisioned specifically '
Expand Down Expand Up @@ -2272,6 +2308,7 @@ def _on_continue_button_clicked(self):
@pyqtSlot()
def _on_start_export_vm_success(self):
self.continue_button.setEnabled(True)
self.continue_disabled_message.hide()

@pyqtSlot(object)
def _on_start_export_vm_failure(self, error: ExportError):
Expand Down

0 comments on commit 5736cf7

Please sign in to comment.