Skip to content

Commit d0eb65f

Browse files
committed
core: Add a member function to show full msg view on toggling.
This function: * Adds header content (non-scrollable) to the popup. * Fetches message content from FullMsgView class.
1 parent 797999f commit d0eb65f

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

zulipterminal/core.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
import zulip
1313
from typing_extensions import Literal
1414

15+
from zulipterminal.config.keys import primary_key_for_command
1516
from zulipterminal.config.themes import ThemeSpec
1617
from zulipterminal.helper import Message, asynch
1718
from zulipterminal.model import Model
1819
from zulipterminal.ui import Screen, View
20+
from zulipterminal.ui_tools.boxes import MessageBox
1921
from zulipterminal.ui_tools.utils import create_msg_box_list
2022
from zulipterminal.ui_tools.views import (
21-
AboutView, EditHistoryView, EditModeView, HelpView, MsgInfoView,
22-
NoticeView, PopUpConfirmationView, StreamInfoView, StreamMembersView,
23+
AboutView, EditHistoryView, EditModeView, FullMsgView, HelpView,
24+
MsgInfoView, NoticeView, PopUpConfirmationView, StreamInfoView,
25+
StreamMembersView,
2326
)
2427
from zulipterminal.version import ZT_VERSION
2528

@@ -235,6 +238,26 @@ def show_about(self) -> None:
235238
'area:help'
236239
)
237240

241+
def show_full_msg(
242+
self, message: Message,
243+
message_links: 'OrderedDict[str, Tuple[str, int, bool]]',
244+
time_mentions: List[Tuple[str, str]],
245+
) -> None:
246+
msg_box = MessageBox(message, self.model, None)
247+
if not msg_box.need_recipient_header():
248+
msg_box.widget_list.insert(0, msg_box.top_header_bar(msg_box))
249+
250+
header = msg_box.widget_list[:2]
251+
help_txt = ('Press {} to cycle b/w raw and rendered message'
252+
.format(primary_key_for_command('CYCLE_COMPOSE_FOCUS')))
253+
header.append(urwid.Text(('area:help', help_txt), align='center'))
254+
content = msg_box.widget_list[2].original_widget[-1]
255+
self.show_pop_up(
256+
FullMsgView(self, message, message_links, time_mentions, content,
257+
'Full message view (up/down scrolls)'),
258+
'area:msg', urwid.Pile(header)
259+
)
260+
238261
def show_edit_history(
239262
self, message: Message,
240263
message_links: 'OrderedDict[str, Tuple[str, int, bool]]',

0 commit comments

Comments
 (0)