Skip to content

Commit

Permalink
helper: Show confirmation overlay before displaying any media.
Browse files Browse the repository at this point in the history
  • Loading branch information
preetmishra committed Jul 31, 2020
1 parent a940409 commit 7ba52ef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions zulipterminal/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import time
from collections import OrderedDict, defaultdict
from functools import wraps
from functools import partial, wraps
from itertools import chain, combinations
from re import ASCII, match
from tempfile import gettempdir
Expand All @@ -17,6 +17,7 @@

import lxml.html
import requests
import urwid
from mypy_extensions import TypedDict


Expand Down Expand Up @@ -677,4 +678,7 @@ def open_media(controller: Any, media_link: str, message_id: int) -> None:
'darwin': 'open',
}
command = image_viewers[sys.platform]
subprocess.run([command, img_path])
callback = partial(subprocess.run, [command, img_path])
question = urwid.Text("Your requested media has been downloaded."
" Do you want to view it?")
controller.show_confirmation_overlay(question, callback)

0 comments on commit 7ba52ef

Please sign in to comment.