Skip to content

Commit 24519ac

Browse files
zee-bitneiljp
authored andcommitted
core/run/views: Add 'Application Configuration' section in About popup.
The new section represents the application-specific configuration which the application is running with, determined by default options and those specified in the zuliprc file and command line. Fixes #812. Tests amended.
1 parent 35ad81b commit 24519ac

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

tests/core/test_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ def controller(self, mocker) -> None:
2828
mocker.patch(CORE + '.Controller.show_loading')
2929

3030
self.config_file = 'path/to/zuliprc'
31+
self.theme_name = 'zt_dark'
3132
self.theme = 'default'
3233
self.in_explore_mode = False
3334
self.autohide = True # FIXME Add tests for no-autohide
3435
self.notify_enabled = False
3536
self.footlinks_enabled = True
36-
result = Controller(self.config_file, self.theme, 256,
37+
result = Controller(self.config_file, self.theme_name, self.theme, 256,
3738
self.in_explore_mode, self.autohide,
3839
self.notify_enabled, self.footlinks_enabled)
3940
result.view.message_view = mocker.Mock() # set in View.__init__

tests/ui_tools/test_popups.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@ def mock_external_classes(self, mocker):
126126
return_value=(64, 64))
127127
mocker.patch(VIEWS + '.urwid.SimpleFocusListWalker', return_value=[])
128128
server_version, server_feature_level = MINIMUM_SUPPORTED_SERVER_VERSION
129+
129130
self.about_view = AboutView(self.controller, 'About',
130131
zt_version=ZT_VERSION,
131132
server_version=server_version,
132-
server_feature_level=server_feature_level)
133+
server_feature_level=server_feature_level,
134+
theme_name='zt_dark',
135+
color_depth=256,
136+
autohide_enabled=False,
137+
footlink_enabled=True)
133138

134139
@pytest.mark.parametrize('key', {*keys_for_command('GO_BACK'),
135140
*keys_for_command('ABOUT')})
@@ -161,7 +166,11 @@ def test_feature_level_content(self, mocker, zulip_version):
161166

162167
about_view = AboutView(self.controller, 'About', zt_version=ZT_VERSION,
163168
server_version=server_version,
164-
server_feature_level=server_feature_level)
169+
server_feature_level=server_feature_level,
170+
theme_name='zt_dark',
171+
color_depth=256,
172+
autohide_enabled=False,
173+
footlink_enabled=True)
165174

166175
assert len(about_view.feature_level_content) == (
167176
1 if server_feature_level else 0

zulipterminal/cli/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def main(options: Optional[List[str]]=None) -> None:
352352
theme_data = THEMES[theme_to_use[0]]
353353

354354
Controller(zuliprc_path,
355+
theme_to_use[0],
355356
theme_data,
356357
color_depth,
357358
args.explore,

zulipterminal/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ class Controller:
2828
the application.
2929
"""
3030

31-
def __init__(self, config_file: str, theme: ThemeSpec,
31+
def __init__(self, config_file: str, theme_name: str, theme: ThemeSpec,
3232
color_depth: int, in_explore_mode: bool,
3333
autohide: bool, notify: bool, footlinks: bool) -> None:
34+
self.theme_name = theme_name
3435
self.theme = theme
3536
self.color_depth = color_depth
3637
self.in_explore_mode = in_explore_mode
@@ -160,7 +161,10 @@ def show_about(self) -> None:
160161
self.show_pop_up(
161162
AboutView(self, 'About', zt_version=ZT_VERSION,
162163
server_version=self.model.server_version,
163-
server_feature_level=self.model.server_feature_level)
164+
server_feature_level=self.model.server_feature_level,
165+
theme_name=self.theme_name, color_depth=self.color_depth,
166+
autohide_enabled=self.autohide,
167+
footlink_enabled=self.footlinks_enabled)
164168
)
165169

166170
def show_edit_history(

zulipterminal/ui_tools/views.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,9 @@ def __init__(self, controller: Any,
991991
class AboutView(PopUpView):
992992
def __init__(self, controller: Any, title: str, *, zt_version: str,
993993
server_version: str,
994-
server_feature_level: Optional[int]) -> None:
994+
server_feature_level: Optional[int],
995+
theme_name: str, color_depth: int,
996+
autohide_enabled: bool, footlink_enabled: bool) -> None:
995997
self.feature_level_content = (
996998
[('Feature level', str(server_feature_level))]
997999
if server_feature_level else []
@@ -1000,6 +1002,11 @@ def __init__(self, controller: Any, title: str, *, zt_version: str,
10001002
('Application', [('Zulip Terminal', zt_version)]),
10011003
('Server', [('Version', server_version)]
10021004
+ self.feature_level_content),
1005+
('Application Configuration', [
1006+
('Theme', theme_name),
1007+
('Autohide', 'enabled' if autohide_enabled else 'disabled'),
1008+
('Footlink', 'enabled' if footlink_enabled else 'disabled'),
1009+
('Color depth', str(color_depth))])
10031010
]
10041011

10051012
popup_width, column_widths = self.calculate_table_widths(contents,

0 commit comments

Comments
 (0)