Skip to content

Commit 305b8b7

Browse files
committed
enhancement: core/themes: Enclosing the title inside popup.
This is a follow-up commit from PR #849. Visible improvements: * Title standouts more in a popup. * Popup border blends with the background.
1 parent bbf86ab commit 305b8b7

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

zulipterminal/config/themes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
'edit_tag': 'standout',
4444
'edit_author': 'bold',
4545
'edit_time': 'bold',
46+
'popup_border': 'standout',
47+
'popup_title': 'bold',
4648
}
4749

4850

@@ -171,6 +173,10 @@
171173
None, DEF['white'], DEF['black']),
172174
('muted', 'light blue', 'black',
173175
None, DEF['light_blue'], DEF['black']),
176+
('popup_title', 'black', 'white',
177+
None, DEF['black'], DEF['white']),
178+
('popup_border', 'white', 'black',
179+
None, DEF['white'], DEF['black']),
174180
],
175181
'gruvbox_dark': [
176182
# default colorscheme on 16 colors, gruvbox colorscheme
@@ -251,6 +257,10 @@
251257
None, WHITE, BLACK),
252258
('muted', 'light blue', 'black',
253259
None, LIGHTBLUE, BLACK),
260+
('popup_title', 'black', 'white',
261+
None, BLACK, WHITE),
262+
('popup_border', 'white', 'black',
263+
None, WHITE, BLACK),
254264
],
255265
'zt_light': [
256266
(None, 'black', 'white'),
@@ -291,6 +301,8 @@
291301
('edit_time', 'dark blue', 'white'),
292302
('current_user', 'dark gray', 'white'),
293303
('muted', 'dark gray', 'white'),
304+
('popup_title', 'white', 'black'),
305+
('popup_border', 'black', 'white'),
294306
],
295307
'zt_blue': [
296308
(None, 'black', 'light blue'),
@@ -331,6 +343,8 @@
331343
('edit_time', 'dark blue', 'light blue'),
332344
('current_user', 'light gray', 'light blue'),
333345
('muted', 'light gray', 'light blue'),
346+
('popup_title', 'light blue', 'white'),
347+
('popup_border', 'white', 'light blue'),
334348
]
335349
} # type: Dict[str, ThemeSpec]
336350

zulipterminal/core.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,28 @@ def maximum_popup_dimensions(self) -> Tuple[int, int]:
162162
return max_cols, max_rows
163163

164164
def show_pop_up(self, to_show: Any) -> None:
165-
double_lines = dict(tlcorner='╔', tline='═', trcorner='╗',
166-
rline='║', lline='║',
167-
blcorner='╚', bline='═', brcorner='╝')
165+
border_lines = dict(tlcorner='▛', tline='▀', trcorner='▜',
166+
rline='▐', lline='▌',
167+
blcorner='▙', bline='▄', brcorner='▟')
168+
text = urwid.Text(to_show.title, align='center')
169+
title_map = urwid.AttrMap(urwid.Filler(text), 'popup_title')
170+
title_box_adapter = urwid.BoxAdapter(title_map, height=1)
171+
title_box = urwid.LineBox(
172+
title_box_adapter, tlcorner='▀', tline='▀', trcorner='▀',
173+
rline='', lline='', blcorner='', bline='', brcorner=''
174+
)
175+
title = urwid.AttrMap(title_box, 'popup_title')
176+
content = urwid.LineBox(to_show, **border_lines)
168177
self.loop.widget = urwid.Overlay(
169-
urwid.LineBox(to_show,
170-
to_show.title,
171-
**double_lines),
178+
urwid.AttrMap(urwid.Frame(header=title, body=content),
179+
'popup_border'),
172180
self.view,
173181
align='center',
174182
valign='middle',
175183
# +2 to both of the following, due to LineBox
184+
# +2 to height, due to title enhancement
176185
width=to_show.width + 2,
177-
height=to_show.height + 2,
186+
height=to_show.height + 4,
178187
)
179188

180189
def exit_popup(self) -> None:

0 commit comments

Comments
 (0)