Skip to content

Commit 87621e1

Browse files
authored
Merge pull request #1103 from freedomofpress/screenresrefactor
reduce minimum size
2 parents 6f70b18 + 6444668 commit 87621e1

23 files changed

+76
-162
lines changed

securedrop_client/api_jobs/downloads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _get_realistic_timeout(self, size_in_bytes: int) -> int:
8383
8484
* Minimum timeout allowed is 25 seconds
8585
"""
86-
TIMEOUT_BYTES_PER_SECOND = 100000.0
86+
TIMEOUT_BYTES_PER_SECOND = 100_000.0
8787
TIMEOUT_ADJUSTMENT_FACTOR = 1.5
8888
TIMEOUT_BASE = 25
8989
timeout = math.ceil((size_in_bytes / TIMEOUT_BYTES_PER_SECOND) * TIMEOUT_ADJUSTMENT_FACTOR)

securedrop_client/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def from_home_dir(cls: Type[T], sdc_home: str) -> T:
2727
logger.error("Error opening config file at {}: {}".format(full_path, e))
2828
json_config = {}
2929

30-
return cls(journalist_key_fingerprint=json_config.get("journalist_key_fingerprint", None),)
30+
return cls(journalist_key_fingerprint=json_config.get("journalist_key_fingerprint", None))
3131

3232
@property
3333
def is_valid(self) -> bool:

securedrop_client/export.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ class Export(QObject):
5959
DISK_TEST_METADATA = {"device": "disk-test"}
6060

6161
PRINT_FN = "print_archive.sd-export"
62-
PRINT_METADATA = {
63-
"device": "printer",
64-
}
62+
PRINT_METADATA = {"device": "printer"}
6563

6664
DISK_FN = "archive.sd-export"
6765
DISK_METADATA = {"device": "disk", "encryption_method": "luks"}

securedrop_client/gui/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def __init__(self) -> None:
7878
self.main_pane.setLayout(layout)
7979
self.left_pane = LeftPane()
8080
self.main_view = MainView(self.main_pane)
81-
layout.addWidget(self.left_pane, 1)
82-
layout.addWidget(self.main_view, 8)
81+
layout.addWidget(self.left_pane)
82+
layout.addWidget(self.main_view)
8383

8484
# Set the main window's central widget to show Top Pane and Main Pane
8585
self.central_widget = QWidget()

securedrop_client/gui/widgets.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ def __init__(self):
177177
layout.setSpacing(0)
178178
layout.setAlignment(Qt.AlignBottom)
179179
self.setFixedWidth(198)
180-
self.setMinimumHeight(558)
181180

182181
# Set background image
183182
self.logo = QWidget()
@@ -190,7 +189,6 @@ def __init__(self):
190189
)
191190
self.logo.setPalette(self.offline_palette)
192191
self.logo.setAutoFillBackground(True)
193-
self.logo.setMaximumHeight(884)
194192
self.logo.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
195193
self.logo.setEnabled(False)
196194

@@ -396,7 +394,6 @@ def __init__(self):
396394
palette.setBrush(QPalette.Background, QBrush(QColor("#0096DC")))
397395
self.setPalette(palette)
398396
self.setAutoFillBackground(True)
399-
self.setMinimumHeight(20)
400397
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
401398

402399
# Set layout
@@ -422,17 +419,12 @@ def __init__(self):
422419
self.user_icon_font.setLetterSpacing(QFont.AbsoluteSpacing, 0.58)
423420
self.user_icon.setFont(self.user_icon_font)
424421
self.user_icon.clicked.connect(self.user_button.click)
425-
# Set cursor.
426422
self.user_icon.setCursor(QCursor(Qt.PointingHandCursor))
427423

428424
# Add widgets to user auth layout
429-
layout.addWidget(self.login_button, 1)
430-
layout.addWidget(self.user_icon, 1)
431-
layout.addWidget(self.user_button, 4)
432-
433-
# Align content to the top left
434-
layout.addStretch()
435-
layout.setAlignment(Qt.AlignTop)
425+
layout.addWidget(self.login_button, alignment=Qt.AlignTop)
426+
layout.addWidget(self.user_icon, alignment=Qt.AlignTop)
427+
layout.addWidget(self.user_button, alignment=Qt.AlignTop)
436428

437429
def setup(self, window, controller):
438430
self.user_button.setup(controller)
@@ -793,7 +785,6 @@ def __init__(self):
793785
super().__init__()
794786

795787
self.setObjectName("SourceList")
796-
self.setFixedWidth(540)
797788
self.setUniformItemSizes(True)
798789

799790
# Set layout.
@@ -986,7 +977,7 @@ class SourceWidget(QWidget):
986977

987978
SIDE_MARGIN = 10
988979
SOURCE_WIDGET_VERTICAL_MARGIN = 10
989-
PREVIEW_WIDTH = 412
980+
PREVIEW_WIDTH = 380
990981
PREVIEW_HEIGHT = 60
991982

992983
def __init__(self, controller: Controller, source: Source):
@@ -1059,8 +1050,8 @@ def __init__(self, controller: Controller, source: Source):
10591050
self.paperclip.setFixedSize(QSize(22, 22))
10601051
self.timestamp = QLabel()
10611052
self.timestamp.setObjectName("SourceWidget_timestamp")
1062-
metadata_layout.addWidget(self.paperclip, 0, Qt.AlignRight)
1063-
metadata_layout.addWidget(self.timestamp, 0, Qt.AlignRight)
1053+
metadata_layout.addWidget(self.paperclip, alignment=Qt.AlignRight)
1054+
metadata_layout.addWidget(self.timestamp, alignment=Qt.AlignRight)
10641055
metadata_layout.addStretch()
10651056

10661057
# Set up a source_widget
@@ -1321,7 +1312,7 @@ def _construct_message(self, source: Source) -> str:
13211312

13221313
message_tuple = (
13231314
"<big>Deleting the Source account for",
1324-
"<b>{}</b> will also".format(source.journalist_designation,),
1315+
"<b>{}</b> will also".format(source.journalist_designation),
13251316
"delete {} files, {} replies, and {} messages.</big>".format(files, replies, messages),
13261317
"<br>",
13271318
"<small>This Source will no longer be able to correspond",

securedrop_client/logic.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,7 @@ def call_api(
397397
new_api_thread.started.connect(new_api_runner.call_api)
398398

399399
# Add the thread related objects to the api_threads dictionary.
400-
self.api_threads[new_thread_id] = {
401-
"thread": new_api_thread,
402-
"runner": new_api_runner,
403-
}
400+
self.api_threads[new_thread_id] = {"thread": new_api_thread, "runner": new_api_runner}
404401

405402
# Start the thread and related activity.
406403
new_api_thread.start()
@@ -834,7 +831,7 @@ def print_file(self, file_uuid: str) -> None:
834831

835832
@login_required
836833
def on_submission_download(
837-
self, submission_type: Union[Type[db.File], Type[db.Message]], submission_uuid: str,
834+
self, submission_type: Union[Type[db.File], Type[db.Message]], submission_uuid: str
838835
) -> None:
839836
"""
840837
Download the file associated with the Submission (which may be a File or Message).

securedrop_client/resources/css/reply_message.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#ReplyWidget_message {
2-
min-width: 508px;
3-
max-width: 508px;
42
font-family: 'Source Sans Pro';
53
font-weight: 400;
64
font-size: 15px;
@@ -10,8 +8,6 @@
108
}
119

1210
#ReplyWidget_message_pending {
13-
min-width: 508px;
14-
max-width: 508px;
1511
font-family: 'Source Sans Pro';
1612
font-weight: 400;
1713
font-size: 15px;
@@ -21,8 +17,6 @@
2117
}
2218

2319
#ReplyWidget_message_failed {
24-
min-width: 508px;
25-
max-width: 508px;
2620
font-family: 'Source Sans Pro';
2721
font-weight: 400;
2822
font-size: 15px;

securedrop_client/resources/css/sdclient.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100

101101
#UserProfile {
102102
padding: 15px;
103+
min-height: 200px
103104
}
104105

105106
#UserProfile_icon {
@@ -148,7 +149,7 @@
148149
}
149150

150151
#MainView_view_holder {
151-
min-width: 667;
152+
min-width: 500;
152153
border: none;
153154
background-color: #f3f5f9;
154155
}
@@ -171,19 +172,19 @@
171172
}
172173

173174
#EmptyConversationView_no_sources QLabel#EmptyConversationView_instructions {
174-
min-width: 520px;
175175
max-width: 600px;
176176
}
177177

178178
#EmptyConversationView_no_source_selected QLabel#EmptyConversationView_instructions {
179-
min-width: 520px;
180179
max-width: 520px;
181180
}
182181

183182
QListView#SourceList {
184183
border: none;
185184
show-decoration-selected: 0;
186185
border-right: 3px solid #f3f5f9;
186+
min-width: 500px;
187+
max-width: 540px;
187188
}
188189

189190
QListView#SourceList::item:selected {

securedrop_client/resources/css/speech_bubble_message.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
#SpeechBubble_message {
2-
min-width: 508px;
3-
max-width: 508px;
42
font-family: 'Source Sans Pro';
53
font-weight: 400;
64
font-size: 15px;
@@ -10,8 +8,6 @@
108
}
119

1210
#SpeechBubble_message_decryption_error {
13-
min-width: 508px;
14-
max-width: 508px;
1511
font-family: 'Source Sans Pro';
1612
font-weight: 400;
1713
font-size: 15px;

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@
3434
"Intended Audience :: Developers",
3535
"Operating System :: OS Independent",
3636
),
37-
entry_points={"console_scripts": ["sd-client = securedrop_client.app:run",],},
37+
entry_points={"console_scripts": ["sd-client = securedrop_client.app:run"]},
3838
)

0 commit comments

Comments
 (0)