X Tutup
Skip to content

Commit 70ec8e9

Browse files
wait for keypress to clear URL containing messages
1 parent e7d6974 commit 70ec8e9

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

bpython/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def confirm(self, q):
321321
return reply.lower() in (_('y'), _('yes'))
322322

323323

324-
def notify(self, s, n=10):
324+
def notify(self, s, n=10, wait_for_keypress=False):
325325
return self.statusbar.message(s, n)
326326

327327
def file_prompt(self, s):

bpython/curtsiesfrontend/interaction.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ def pop_permanent_message(self, msg):
5454
def has_focus(self):
5555
return self.in_prompt or self.in_confirm or self.waiting_for_refresh
5656

57-
def message(self, msg):
57+
def message(self, msg, schedule_refresh=True):
5858
"""Sets a temporary message"""
5959
self.message_start_time = time.time()
6060
self._message = msg
61-
self.schedule_refresh(time.time() + self.message_time)
61+
if schedule_refresh:
62+
self.schedule_refresh(time.time() + self.message_time)
6263

6364
def _check_for_expired_message(self):
6465
if self._message and time.time() > self.message_start_time + self.message_time:
@@ -128,10 +129,10 @@ def should_show_message(self):
128129
return bool(self.current_line)
129130

130131
# interaction interface - should be called from other greenlets
131-
def notify(self, msg, n=3):
132+
def notify(self, msg, n=3, wait_for_keypress=False):
132133
self.request_greenlet = greenlet.getcurrent()
133134
self.message_time = n
134-
self.message(msg)
135+
self.message(msg, schedule_refresh=wait_for_keypress)
135136
self.waiting_for_refresh = True
136137
self.request_refresh()
137138
self.main_greenlet.switch(msg)

bpython/repl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def __init__(self, config, statusbar=None):
240240
def confirm(self, s):
241241
raise NotImplementedError
242242

243-
def notify(self, s, n=10):
243+
def notify(self, s, n=10, wait_for_keypress=False):
244244
raise NotImplementedError
245245

246246
def file_prompt(self, s):

bpython/urwid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ def callback_wrapper(result):
556556

557557
self.prompt(q, callback_wrapper, single=True)
558558

559-
def notify(self, s, n=10):
559+
def notify(self, s, n=10, wait_for_keypress=False):
560560
return self.statusbar.message(s, n)
561561

562562
def prompt(self, s, callback=None, single=False):

0 commit comments

Comments
 (0)
X Tutup