Skip to content

Commit 32abc79

Browse files
core/boxes: Logic for initial keypress on FILE_UPLOAD
show_file_upload_view in core.py creates an instance of FileUploadView when called. It is called by `ctrl + o`keypress on WriteBox.
1 parent 4c40015 commit 32abc79

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

zulipterminal/core.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@
2929
from zulipterminal.model import Model
3030
from zulipterminal.platform_code import PLATFORM
3131
from zulipterminal.ui import Screen, View
32+
from zulipterminal.ui_tools.boxes import WriteBox
3233
from zulipterminal.ui_tools.utils import create_msg_box_list
3334
from zulipterminal.ui_tools.views import (
3435
AboutView,
3536
EditHistoryView,
3637
EditModeView,
3738
EmojiPickerView,
39+
FileUploadView,
3840
FullRawMsgView,
3941
FullRenderedMsgView,
4042
HelpView,
@@ -274,6 +276,12 @@ def show_msg_info(
274276
)
275277
self.show_pop_up(msg_info_view, "area:msg")
276278

279+
def show_file_upload_popup(self, write_box: WriteBox) -> None:
280+
file_upload_view = FileUploadView(
281+
self, write_box, "Upload File"
282+
)
283+
self.show_pop_up(file_upload_view, "area:msg")
284+
277285
def show_emoji_picker(self, message: Message) -> None:
278286
all_emoji_units = [
279287
(emoji_name, emoji["code"], emoji["aliases"])

zulipterminal/ui_tools/boxes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,9 @@ def keypress(self, size: urwid_Size, key: str) -> Optional[str]:
727727
self.is_in_typeahead_mode = False
728728
self.view.set_footer_text()
729729

730+
if is_command_key("FILE_UPLOAD", key):
731+
self.model.controller.show_file_upload_popup(self)
732+
730733
if is_command_key("SEND_MESSAGE", key):
731734
self.send_stop_typing_status()
732735
if self.compose_box_status == "open_with_stream":

0 commit comments

Comments
 (0)