Skip to content

Commit de46e53

Browse files
committed
about_popup: Terminal size added.
1 parent 743db7d commit de46e53

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

tests/ui_tools/test_popups.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def mock_external_classes(self, mocker: MockerFixture) -> None:
195195

196196
mocker.patch(MODULE + ".detected_python_in_full", lambda: "[Python version]")
197197

198+
terminal_size = "24 rows x 80 cols"
199+
198200
self.about_view = AboutView(
199201
self.controller,
200202
"About",
@@ -208,6 +210,7 @@ def mock_external_classes(self, mocker: MockerFixture) -> None:
208210
maximum_footlinks=3,
209211
exit_confirmation_enabled=False,
210212
transparency_enabled=False,
213+
terminal_size=terminal_size,
211214
)
212215

213216
@pytest.mark.parametrize(
@@ -259,6 +262,7 @@ def test_feature_level_content(
259262
maximum_footlinks=3,
260263
exit_confirmation_enabled=False,
261264
transparency_enabled=False,
265+
terminal_size="24 rows x 80 cols",
262266
)
263267

264268
assert len(about_view.feature_level_content) == (
@@ -299,7 +303,8 @@ def test_copied_content(self) -> None:
299303
300304
#### Detected Environment
301305
Platform: WSL
302-
Python: [Python version]"""
306+
Python: [Python version]
307+
Terminal Size: 24 rows x 80 cols"""
303308
assert self.about_view.copy_info == expected_output
304309

305310

zulipterminal/core.py

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import itertools
66
import os
7+
import shutil
78
import signal
89
import sys
910
import time
@@ -301,6 +302,9 @@ def popup_with_message(self, text: str, width: int) -> None:
301302
self.show_pop_up(NoticeView(self, text, width, "NOTICE"), "area:error")
302303

303304
def show_about(self) -> None:
305+
terminal_size = shutil.get_terminal_size()
306+
terminal_size_str = f"{terminal_size.columns} cols x {terminal_size.lines} rows"
307+
304308
self.show_pop_up(
305309
AboutView(
306310
self,
@@ -315,6 +319,7 @@ def show_about(self) -> None:
315319
maximum_footlinks=self.maximum_footlinks,
316320
exit_confirmation_enabled=self.exit_confirmation,
317321
transparency_enabled=self.transparency_enabled,
322+
terminal_size=terminal_size_str,
318323
),
319324
"area:help",
320325
)

zulipterminal/ui_tools/views.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,7 @@ def __init__(
10921092
notify_enabled: bool,
10931093
exit_confirmation_enabled: bool,
10941094
transparency_enabled: bool,
1095+
terminal_size: str,
10951096
) -> None:
10961097
self.feature_level_content = (
10971098
[("Feature level", str(server_feature_level))]
@@ -1119,7 +1120,11 @@ def __init__(
11191120
),
11201121
(
11211122
"Detected Environment",
1122-
[("Platform", PLATFORM), ("Python", detected_python_in_full())],
1123+
[
1124+
("Platform", PLATFORM),
1125+
("Python", detected_python_in_full()),
1126+
("Terminal Size", terminal_size),
1127+
],
11231128
),
11241129
]
11251130

0 commit comments

Comments
 (0)